Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Проверяем конфиг ssh
- grep -i port /etc/ssh/sshd_config
- меняем порт
- nano /etc/ssh/sshd_config
- #Port 22 → Port 2279
- systemctl restart sshd
- grep -i port /etc/ssh/sshd_config
- nano /usr/local/bin/hitme.sh
- chmod +x /usr/local/bin/hitme.sh
- #!/bin/bash
- token="ваш токен"
- chat_id="ваш id"
- sendmsg="https://api.telegram.org/bot$token/sendMessage?parse_mode=html"
- msg=/tmp/ssh_msg.tcdxt
- tail -n 1 /var/log/auth.log > $msg
- curl $sendmsg -d chat_id=$chat_id -d text="$(<$msg)"
- rm /tmp/ssh_msg_info.txt
- ставим Incron
- apt-get install incron
- Разрешаем рут
- nano /etc/incron.allow
- incrontab -l
- incrontab -e
- /var/log/auth.log IN_MODIFY /usr/local/bin/hitme.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement