https://github.com/rolandfarkascom/linux-slack-alert
A simple slack notification for SSH logins with IP API ability to look up country, city and other location specific information.
https://github.com/rolandfarkascom/linux-slack-alert
alert bash bash-script centos curl debian linux notification-service notification-services notifications redhat shell shell-script shell-scripts slack slack-bot slackbot ssh ubuntu
Last synced: 5 months ago
JSON representation
A simple slack notification for SSH logins with IP API ability to look up country, city and other location specific information.
- Host: GitHub
- URL: https://github.com/rolandfarkascom/linux-slack-alert
- Owner: rolandfarkasCOM
- License: gpl-3.0
- Created: 2024-09-16T19:42:15.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-16T20:58:55.000Z (almost 2 years ago)
- Last Synced: 2025-06-05T08:08:49.740Z (about 1 year ago)
- Topics: alert, bash, bash-script, centos, curl, debian, linux, notification-service, notification-services, notifications, redhat, shell, shell-script, shell-scripts, slack, slack-bot, slackbot, ssh, ubuntu
- Language: Shell
- Homepage: https://www.rolandfarkas.com/setting-up-linux-ssh-login-alerts-with-slack-notifications-a-step-by-step-guide/
- Size: 15.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Linux Slack Alert
A simple slack notification for SSH logins
The notify.sh file includes a simple notification for slack which can be customised with a special name (eg.: if you have host names and IP's) and a group name in case you want to group your servers.
The advanced.sh file is a copy of the notify.sh but it includes IP API location details eg: Country, City, Proxy info, Latitude, Longtitude and so on. (More info on: https://freeipapi.com/)
Create the scripts folder
```bash
mkdir /etc/ssh/scripts/
```
Add the notify.sh file to the scripts folder
```bash
touch /etc/ssh/scripts/notify.sh
```
Edit the notify.sh file and copy either the notify.sh contents or the advanced.sh contents and update the required parameters
```bash
nano /etc/ssh/scripts/notify.sh
```
Set the required permissions for the notify.sh file
```bash
sudo chmod +x /etc/ssh/scripts/notify.sh
```
Add the notify.sh file to the sshd service
```bash
sudo echo "session optional pam_exec.so seteuid /etc/ssh/scripts/notify.sh" >> /etc/pam.d/sshd
```
** Only required for advanced script so you can parse the IPAPI json response
```bash
sudo apt-get install jq
```