mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 16:21:34 +01:00
Fix crowdsec install order
This commit is contained in:
parent
22bdc1d19b
commit
219a9099a3
2 changed files with 14 additions and 9 deletions
|
|
@ -63,9 +63,9 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.crowdsec.preStart =
|
systemd.services.crowdsec.serviceConfig.ExecStartPre =
|
||||||
let
|
let
|
||||||
addCollection = collection: ''
|
installCollection = collection: ''
|
||||||
if ! cscli collections list | grep -q "${collection}"; then
|
if ! cscli collections list | grep -q "${collection}"; then
|
||||||
cscli collections install ${collection}
|
cscli collections install ${collection}
|
||||||
fi
|
fi
|
||||||
|
|
@ -78,7 +78,9 @@ in
|
||||||
(lib.optional (lib.elem "iptables" cfg.sources) "crowdsecurity/iptables")
|
(lib.optional (lib.elem "iptables" cfg.sources) "crowdsecurity/iptables")
|
||||||
]
|
]
|
||||||
|> lib.flatten
|
|> lib.flatten
|
||||||
|> lib.map addCollection
|
|> lib.map installCollection
|
||||||
|> lib.concatLines;
|
|> lib.concatLines
|
||||||
|
|> (text: pkgs.writeShellScript "crowdsec-install-collections" "set -e\n${text}")
|
||||||
|
|> lib.mkAfter;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,13 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.crowdsec.preStart = ''
|
systemd.services.crowdsec.serviceConfig.ExecStartPre = lib.mkAfter (
|
||||||
if ! cscli bouncers list | grep -q "firewall"; then
|
pkgs.writeShellScript "crowdsec-add-bouncer" ''
|
||||||
cscli bouncers add "firewall" --key "cs-firewall-bouncer"
|
set -e
|
||||||
fi
|
if ! cscli bouncers list | grep -q "firewall"; then
|
||||||
'';
|
cscli bouncers add "firewall" --key "cs-firewall-bouncer"
|
||||||
|
fi
|
||||||
|
''
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue