submission configured, vaultwarden url changed
This commit is contained in:
parent
5894fa9aa5
commit
4ee6c7957c
2 changed files with 61 additions and 46 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
home.stateVersion = "26.05";
|
home = {
|
||||||
|
stateVersion = "26.05";
|
||||||
|
packages = with pkgs; [
|
||||||
|
gh
|
||||||
|
];
|
||||||
|
};
|
||||||
programs = {
|
programs = {
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
gh = {
|
|
||||||
enable = true;
|
|
||||||
settings.git_protocol = "ssh";
|
|
||||||
};
|
|
||||||
bash = {
|
bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
historyControl = [ "ignoreboth" ];
|
historyControl = [ "ignoreboth" ];
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
wifi-security.psk = "$BOGALE_2_4_PSK";
|
wifi-security.psk = "$BOGALE_2_4_PSK";
|
||||||
};
|
};
|
||||||
firewall = {
|
firewall = {
|
||||||
allowedTCPPorts = [ 25 80 443 993 ];
|
allowedTCPPorts = [ 25 80 443 587 993 ];
|
||||||
allowedUDPPorts = [ 443 ];
|
allowedUDPPorts = [ 443 ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -37,6 +37,21 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
systemd = {
|
systemd = {
|
||||||
|
tmpfiles.rules = [
|
||||||
|
"d /var/spool/postfix 0755 postfix postfix -"
|
||||||
|
"d /var/spool/postfix/private 0755 postfix postfix -"
|
||||||
|
];
|
||||||
|
timers.network-watchdog = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
after = [ "NetworkManager.service" ];
|
||||||
|
wants = [ "NetworkManager.service" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnBootSec = 5;
|
||||||
|
AccuracySec = 1;
|
||||||
|
OnUnitActiveSec = 5;
|
||||||
|
Unit = "network-watchdog.service";
|
||||||
|
};
|
||||||
|
};
|
||||||
services.network-watchdog = {
|
services.network-watchdog = {
|
||||||
path = [ pkgs.iputils ];
|
path = [ pkgs.iputils ];
|
||||||
serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
|
|
@ -46,24 +61,18 @@
|
||||||
else
|
else
|
||||||
failures=$(($(cat /run/network.failures)+1))
|
failures=$(($(cat /run/network.failures)+1))
|
||||||
if [ $failures -ge 3 ]; then
|
if [ $failures -ge 3 ]; then
|
||||||
systemctl restart NetworkManager
|
systemctl restart NetworkManager.service
|
||||||
failures=0
|
failures=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo $failures > /run/network.failures
|
echo $failures > /run/network.failures
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
timers.network-watchdog = {
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
timerConfig = {
|
|
||||||
OnBootSec = 5;
|
|
||||||
AccuracySec = 1;
|
|
||||||
OnUnitActiveSec = 5;
|
|
||||||
Unit = "network-watchdog.service";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
services = {
|
services = let
|
||||||
|
saslSocket = "/var/spool/postfix/private/auth";
|
||||||
|
sslCertDir = config.security.acme.certs."bogaledev.ru".directory;
|
||||||
|
in {
|
||||||
postgresql.enable = true;
|
postgresql.enable = true;
|
||||||
openssh = {
|
openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -85,59 +94,67 @@
|
||||||
dovecot2 = {
|
dovecot2 = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
mail_path = "~";
|
|
||||||
ssl = "required";
|
ssl = "required";
|
||||||
mail_gid = "vmail";
|
mail_gid = "vmail";
|
||||||
mail_uid = "vmail";
|
mail_uid = "vmail";
|
||||||
protocols.imap = true;
|
protocols.imap = true;
|
||||||
mail_driver = "maildir";
|
mail_driver = "maildir";
|
||||||
mail_home = "/var/mail/vmail";
|
mail_path = "/var/mail/vmail";
|
||||||
auth_mechanisms = [ "plain" ];
|
auth_mechanisms = [ "plain" ];
|
||||||
dovecot_config_version = "2.4.5";
|
dovecot_config_version = "2.4.5";
|
||||||
dovecot_storage_version = "2.4.5";
|
dovecot_storage_version = "2.4.5";
|
||||||
ssl_server_key_file = "/var/lib/acme/bogaledev.ru/key.pem";
|
ssl_server_key_file = "${sslCertDir}/key.pem";
|
||||||
ssl_server_cert_file = "/var/lib/acme/bogaledev.ru/fullchain.pem";
|
ssl_server_cert_file = "${sslCertDir}/fullchain.pem";
|
||||||
"passdb passwd-file".passwd_file_path = "/secrets/dovecot-passwd";
|
"passdb passwd-file".passwd_file_path = "/secrets/dovecot-passwd";
|
||||||
|
"service auth"."unix_listener ${saslSocket}" = {
|
||||||
|
mode = "0660";
|
||||||
|
user = "postfix";
|
||||||
|
group = "postfix";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
postfix = {
|
postfix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
#enableSubmission = true;
|
enableSubmission = true;
|
||||||
virtualMapType = "regexp";
|
virtualMapType = "regexp";
|
||||||
virtual = ''/.*@bogaledev.ru/ mail@bogaledev.ru'';
|
virtual = "/.*@bogaledev.ru/ mail@bogaledev.ru";
|
||||||
mapFiles.mailbox = pkgs.writeText "mailbox" ''mail@bogaledev.ru /'';
|
mapFiles = {
|
||||||
|
smtp_passwd = "/secrets/smtp_passwd";
|
||||||
|
mailbox = pkgs.writeText "mailbox" "mail@bogaledev.ru /";
|
||||||
|
};
|
||||||
settings.main = {
|
settings.main = {
|
||||||
|
smtpd_sasl_type = "dovecot";
|
||||||
|
smtpd_sasl_path = saslSocket;
|
||||||
|
smtp_sasl_auth_enable = "yes";
|
||||||
|
smtpd_sasl_auth_enable = "yes";
|
||||||
virtual_uid_maps = "static:1819";
|
virtual_uid_maps = "static:1819";
|
||||||
virtual_gid_maps = "static:1819";
|
virtual_gid_maps = "static:1819";
|
||||||
smtp_tls_security_level = "encrypt";
|
smtp_tls_security_level = "encrypt";
|
||||||
smtpd_tls_security_level = "encrypt";
|
smtpd_tls_security_level = "encrypt";
|
||||||
|
relayhost = [ "smtp.resend.com:2587" ];
|
||||||
virtual_mailbox_domains = "bogaledev.ru";
|
virtual_mailbox_domains = "bogaledev.ru";
|
||||||
virtual_mailbox_base = "/var/spool/mail/vmail";
|
virtual_mailbox_base = "/var/spool/mail/vmail";
|
||||||
|
smtp_sasl_tls_security_options = "noanonymous";
|
||||||
virtual_mailbox_maps = "hash:/etc/postfix/mailbox";
|
virtual_mailbox_maps = "hash:/etc/postfix/mailbox";
|
||||||
|
smtp_sasl_password_maps = "hash:/etc/postfix/smtp_passwd";
|
||||||
smtpd_tls_chain_files = [
|
smtpd_tls_chain_files = [
|
||||||
"/var/lib/acme/bogaledev.ru/key.pem"
|
"${sslCertDir}/key.pem"
|
||||||
"/var/lib/acme/bogaledev.ru/fullchain.pem"
|
"${sslCertDir}/fullchain.pem"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
vaultwarden = {
|
vaultwarden = {
|
||||||
enable = true;
|
enable = true;
|
||||||
configureNginx = true;
|
|
||||||
dbBackend = "postgresql";
|
dbBackend = "postgresql";
|
||||||
configurePostgres = true;
|
configurePostgres = true;
|
||||||
domain = "vw.bogaledev.ru";
|
|
||||||
package = pkgs.vaultwarden-postgresql;
|
package = pkgs.vaultwarden-postgresql;
|
||||||
environmentFile = "/secrets/vaultwarden.env";
|
environmentFile = "/secrets/vaultwarden.env";
|
||||||
config = {
|
config = {
|
||||||
#EMAIL_TOKEN_SIZE = 8;
|
|
||||||
#SMTP_SECURITY = "off";
|
|
||||||
#SMTP_HOST = "localhost";
|
|
||||||
SIGNUPS_ALLOWED = false;
|
SIGNUPS_ALLOWED = false;
|
||||||
#REQUIRE_DEVICE_EMAIL = true;
|
|
||||||
TRASH_AUTO_DELETE_DAYS = 90;
|
TRASH_AUTO_DELETE_DAYS = 90;
|
||||||
PASSWORD_HINTS_ALLOWED = false;
|
PASSWORD_HINTS_ALLOWED = false;
|
||||||
EMERGENCY_ACCESS_ALLOWED = false;
|
EMERGENCY_ACCESS_ALLOWED = false;
|
||||||
#SMTP_FROM = "vaultwarden@bogaledev.ru";
|
DOMAIN = "https://bogaledev.ru/vw";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
nginx = {
|
nginx = {
|
||||||
|
|
@ -159,21 +176,18 @@
|
||||||
"~ \\.php$".extraConfig = ''
|
"~ \\.php$".extraConfig = ''
|
||||||
fastcgi_pass unix:${config.services.phpfpm.pools.main.socket};
|
fastcgi_pass unix:${config.services.phpfpm.pools.main.socket};
|
||||||
'';
|
'';
|
||||||
|
"/vw" = {
|
||||||
|
proxyPass = "http://127.0.0.1:8000";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
extraConfig = ''
|
||||||
|
allow fc00::/64;
|
||||||
|
allow 10.0.0.0/24;
|
||||||
|
allow 192.168.1.0/24;
|
||||||
|
deny all;
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
virtualHosts."vw.bogaledev.ru" = {
|
|
||||||
quic = true;
|
|
||||||
forceSSL = true;
|
|
||||||
useACMEHost = "bogaledev.ru";
|
|
||||||
serverAliases = [ "vw-wl.bogaledev.ru" ];
|
|
||||||
extraConfig = ''
|
|
||||||
allow fc00::/64;
|
|
||||||
allow 10.0.0.0/24;
|
|
||||||
allow 192.168.1.0/24;
|
|
||||||
deny all;
|
|
||||||
add_header Alt-Svc 'h3=":443"; ma=86400' always;
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue