Bladeren bron

pam notify

master
Robin Thoni 8 jaren geleden
bovenliggende
commit
aa619388d0
3 gewijzigde bestanden met toevoegingen van 27 en 0 verwijderingen
  1. 12
    0
      pam/install
  2. 3
    0
      pam/notify-pam
  3. 12
    0
      pam/notify-pam.sh

+ 12
- 0
pam/install Bestand weergeven

@@ -0,0 +1,12 @@
1
+#! /usr/bin/env bash
2
+
3
+dir="$(dirname $(readlink -f "${0}"))"
4
+
5
+cp "${dir}/notify-pma.sh" /usr/local/bin/notify-pma &&
6
+if [ ! -f /etc/pam.d/notify-pam ]
7
+then
8
+  cp "${dir}/notify-pma" /etc/pam.d/notify-pma &&
9
+  echo "@include notify-pam" >> /etc/pam.d/sudo &&
10
+  echo "@include notify-pam" >> /etc/pam.d/common-session
11
+fi
12
+

+ 3
- 0
pam/notify-pam Bestand weergeven

@@ -0,0 +1,3 @@
1
+#%PAM-1.0
2
+
3
+session    optional     pam_exec.so /usr/local/bin/notify-pam

+ 12
- 0
pam/notify-pam.sh Bestand weergeven

@@ -0,0 +1,12 @@
1
+#! /usr/bin/env sh
2
+
3
+[ "$PAM_TYPE" = "open_session" ] || exit 0
4
+{
5
+  echo "User: $PAM_USER"
6
+  echo "Ruser: $PAM_RUSER"
7
+  echo "Rhost: $PAM_RHOST"
8
+  echo "Service: $PAM_SERVICE"
9
+  echo "TTY: $PAM_TTY"
10
+  echo "Date: `date`"
11
+  echo "Server: `hostname -f`"
12
+} | mail -s "`hostname -s` $PAM_SERVICE login: $PAM_USER" root

Laden…
Annuleren
Opslaan