summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2022-12-30 01:18:28 +0100
committerPatrick Spek <p.spek@tyil.nl>2022-12-30 01:18:28 +0100
commitedcd3521eda6ffc3c3f13ddbd3db21aad7f5d8e7 (patch)
tree290d9025333e5e8f2e4eae11860ba7a5eb686191
parent9368dfb7373619cff64c95a70ac1ed9646a189f9 (diff)
Include notification script for openssh
-rw-r--r--playbooks.d/ssh/playbook.bash4
-rw-r--r--playbooks.d/ssh/share/notify.sh8
2 files changed, 12 insertions, 0 deletions
diff --git a/playbooks.d/ssh/playbook.bash b/playbooks.d/ssh/playbook.bash
index 12f6bb6..0d70699 100644
--- a/playbooks.d/ssh/playbook.bash
+++ b/playbooks.d/ssh/playbook.bash
@@ -31,6 +31,10 @@ playbook_sync() {
"time=$(date -u "+%FT%T")" \
> /etc/motd
+ info "$BASHTARD_PLAYBOOK" "Installing notification script"
+ file_template "notify.sh" \
+ > /etc/ssh/notify.sh
+
[[ $BASHTARD_COMMAND == "add" ]] && return
svc reload "sshd"
diff --git a/playbooks.d/ssh/share/notify.sh b/playbooks.d/ssh/share/notify.sh
new file mode 100644
index 0000000..00e0b9f
--- /dev/null
+++ b/playbooks.d/ssh/share/notify.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [ "$PAM_TYPE" != "open_session" ]
+then
+ exit 0
+fi
+
+ntfy send "$PAM_USER@$(hostname -f)" "Login Succesful"