forked from nyanloutre/nixos-config
envoi mail après login
This commit is contained in:
parent
651a0d3c64
commit
a93d836d36
@ -11,6 +11,16 @@ let
|
|||||||
musique_port = 52349;
|
musique_port = 52349;
|
||||||
factorio_port = 52351;
|
factorio_port = 52351;
|
||||||
airsonic_port = 4040;
|
airsonic_port = 4040;
|
||||||
|
|
||||||
|
login_mail_alert = pkgs.writeShellScriptBin "mail_alert.sh" ''
|
||||||
|
if [ "$PAM_TYPE" != "close_session" ]; then
|
||||||
|
${pkgs.system-sendmail}/bin/sendmail paul@nyanlout.re <<EOF
|
||||||
|
From: root@nyanlout.re
|
||||||
|
Subject: SSH Login: $PAM_USER from $PAM_RHOST
|
||||||
|
`env`
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -415,9 +425,12 @@ in
|
|||||||
|
|
||||||
users.groups.acme.members = [ "matrix-synapse" ];
|
users.groups.acme.members = [ "matrix-synapse" ];
|
||||||
|
|
||||||
security.sudo.extraRules = [
|
security = {
|
||||||
|
sudo.extraRules = [
|
||||||
{ commands = [ { command = "${pkgs.smartmontools}/bin/smartctl"; options = [ "NOPASSWD" ]; } ]; users = [ "telegraf" ]; }
|
{ commands = [ { command = "${pkgs.smartmontools}/bin/smartctl"; options = [ "NOPASSWD" ]; } ]; users = [ "telegraf" ]; }
|
||||||
];
|
];
|
||||||
|
pam.services.sshd.text = pkgs.lib.mkDefault( pkgs.lib.mkAfter "session optional ${pkgs.pam}/lib/security/pam_exec.so seteuid ${login_mail_alert}/bin/mail_alert.sh" );
|
||||||
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
wireguard.interfaces = {
|
wireguard.interfaces = {
|
||||||
|
Loading…
Reference in New Issue
Block a user