ssh-gotify-wl.txt - grimoire - dark wiki & knowledge base
(HTM) git clone https://git.drkhsh.at/grimoire.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
ssh-gotify-wl.txt (471B)
---
1 #!/bin/sh
2
3 baseurl="https://<gotify endpoint>"
4 token="XXX"
5
6 NETWORKS="$(cat /etc/ssh/whitelist)"
7 ip=`echo $SSH_CONNECTION | cut -d " " -f 1`
8 hostname=`hostname`
9 echo $ip | grepcidr "$NETWORKS" >/dev/null && exit 0
10
11 title="SSH login on $hostname"
12 message="$USER has logged in via SSH from $ip on $hostname"
13 logger -t ssh-wrapper $USER login from $ip
14 curl -s "${baseurl}/message?token=${token}" \
15 -F "title=${title}" -F "message=${message}" > /dev/null