[LINUX] Skip Line on successful SSH login with ifttt

Overview

When SSH login is successful, Line will be notified.

Preparation

--Create a WebHook if if with ifttt

Output the curl command with Documentation from https://ifttt.com/maker_webhooks. image.png

work

vi /etc/ssh/sshrc

sshrc


curl -s -o /dev/null -X POST -H "Content-Type: application/json" -d @- https://maker.ifttt.com/trigger/event name/with/key/Key<< EOS
{"value1":"[SSH login]username: $USER, IP: $SSH_CLIENT"}

This is okay. However, be aware that if you have standard output for any trivial matter here, you will not be able to use sftp.

result

Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-74-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

 System information disabled due to load higher than 8.0


 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

0 packages can be updated.
0 updates are security updates.


Last login: Sat Jan 25 15:50:56 2020 from 
mirmdock@mirm_dockernode:~$ 

image.png

reference

https://qiita.com/tekitoh/items/8acccb313d6e7a14c2ec https://bacchi.me/linux/ssh-login-alert/

Recommended Posts

Skip Line on successful SSH login with ifttt
[LINE login] Verify state with Flask