fix merge bug in systemd
This commit is contained in:
parent
78f6d93804
commit
0c414738e1
2 changed files with 20 additions and 19 deletions
16
mail-server/script/create_certificate
Normal file
16
mail-server/script/create_certificate
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Create certificates if they do not exist yet
|
||||||
|
dir="${cfg.certificateDirectory}"
|
||||||
|
fqdn="${cfg.hostPrefix}.${cfg.domain}"
|
||||||
|
case $fqdn in /*) fqdn=$(cat "$fqdn");; esac
|
||||||
|
key="''${dir}/key-${cfg.domain}.pem";
|
||||||
|
cert="''${dir}/cert-${cfg.domain}.pem";
|
||||||
|
|
||||||
|
if [ ! -f "''${key}" ] || [ ! -f "''${cert}" ]
|
||||||
|
then
|
||||||
|
mkdir -p "${cfg.certificateDirectory}"
|
||||||
|
(umask 077; "${pkgs.openssl}/bin/openssl" genrsa -out "''${key}" 2048) &&
|
||||||
|
"${pkgs.openssl}/bin/openssl" req -new -key "''${key}" -x509 -subj "/CN=''${fqdn}" \
|
||||||
|
-days 3650 -out "''${cert}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# vim: set filetype=sh
|
|
@ -20,22 +20,7 @@ let
|
||||||
cfg = config.mailserver;
|
cfg = config.mailserver;
|
||||||
|
|
||||||
create_certificate = if cfg.certificateScheme == 2 then
|
create_certificate = if cfg.certificateScheme == 2 then
|
||||||
''
|
builtins.readFile ./script/create_certificate
|
||||||
# Create certificates if they do not exist yet
|
|
||||||
dir="${cfg.certificateDirectory}"
|
|
||||||
fqdn="${cfg.hostPrefix}.${cfg.domain}"
|
|
||||||
case $fqdn in /*) fqdn=$(cat "$fqdn");; esac
|
|
||||||
key="''${dir}/key-${cfg.domain}.pem";
|
|
||||||
cert="''${dir}/cert-${cfg.domain}.pem";
|
|
||||||
|
|
||||||
if [ ! -f "''${key}" ] || [ ! -f "''${cert}" ]
|
|
||||||
then
|
|
||||||
mkdir -p "${cfg.certificateDirectory}"
|
|
||||||
(umask 077; "${pkgs.openssl}/bin/openssl" genrsa -out "''${key}" 2048) &&
|
|
||||||
"${pkgs.openssl}/bin/openssl" req -new -key "''${key}" -x509 -subj "/CN=''${fqdn}" \
|
|
||||||
-days 3650 -out "''${cert}"
|
|
||||||
fi
|
|
||||||
''
|
|
||||||
else "";
|
else "";
|
||||||
|
|
||||||
dkim_key = "${cfg.dkimKeyDirectory}/${cfg.dkimSelector}.private";
|
dkim_key = "${cfg.dkimKeyDirectory}/${cfg.dkimSelector}.private";
|
||||||
|
@ -67,9 +52,9 @@ in
|
||||||
''
|
''
|
||||||
# Create mail directory and set permissions. See
|
# Create mail directory and set permissions. See
|
||||||
# <http://wiki2.dovecot.org/SharedMailboxes/Permissions>.
|
# <http://wiki2.dovecot.org/SharedMailboxes/Permissions>.
|
||||||
mkdir -p "${mail_dir}"
|
mkdir -p "${mailDirectory}"
|
||||||
chgrp "${vmail_group_name}" "${mail_dir}"
|
chgrp "${vmailGroupName}" "${mailDirectory}"
|
||||||
chmod 02770 "${mail_dir}"
|
chmod 02770 "${mailDirectory}"
|
||||||
|
|
||||||
${create_certificate}
|
${create_certificate}
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue