mirror of
https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git
synced 2024-12-28 20:10:34 +05:00
move scripts to external files
This commit is contained in:
parent
b3f7ee38cb
commit
0c20bb3a85
14
mail-server/script/create_dkim_certificate
Normal file
14
mail-server/script/create_dkim_certificate
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Create dkim dir
|
||||||
|
mkdir -p "${cfg.dkimKeyDirectory}"
|
||||||
|
chown rmilter:rmilter "${cfg.dkimKeyDirectory}"
|
||||||
|
|
||||||
|
if [ ! -f "${dkim_key}" ] || [ ! -f "${dkim_txt}" ]
|
||||||
|
then
|
||||||
|
|
||||||
|
${pkgs.opendkim}/bin/opendkim-genkey -s "${cfg.dkimSelector}" \
|
||||||
|
-d ${cfg.domain} \
|
||||||
|
--directory="${cfg.dkimKeyDirectory}"
|
||||||
|
chown rmilter:rmilter "${dkim_key}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# vim: set filetype=sh
|
@ -25,21 +25,7 @@ let
|
|||||||
|
|
||||||
dkim_key = "${cfg.dkimKeyDirectory}/${cfg.dkimSelector}.private";
|
dkim_key = "${cfg.dkimKeyDirectory}/${cfg.dkimSelector}.private";
|
||||||
dkim_txt = "${cfg.dkimKeyDirectory}/${cfg.dkimSelector}.txt";
|
dkim_txt = "${cfg.dkimKeyDirectory}/${cfg.dkimSelector}.txt";
|
||||||
create_dkim_cert =
|
create_dkim_cert = builtins.readFile ./script/create_dkim_certificate;
|
||||||
''
|
|
||||||
# Create dkim dir
|
|
||||||
mkdir -p "${cfg.dkimKeyDirectory}"
|
|
||||||
chown rmilter:rmilter "${cfg.dkimKeyDirectory}"
|
|
||||||
|
|
||||||
if [ ! -f "${dkim_key}" ] || [ ! -f "${dkim_txt}" ]
|
|
||||||
then
|
|
||||||
|
|
||||||
${pkgs.opendkim}/bin/opendkim-genkey -s "${cfg.dkimSelector}" \
|
|
||||||
-d ${cfg.domain} \
|
|
||||||
--directory="${cfg.dkimKeyDirectory}"
|
|
||||||
chown rmilter:rmilter "${dkim_key}"
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = with cfg; lib.mkIf enable {
|
config = with cfg; lib.mkIf enable {
|
||||||
|
Loading…
Reference in New Issue
Block a user