- Mitglied seit
- 8 Jun 2014
- Beiträge
- 24
- Punkte für Reaktionen
- 0
- Punkte
- 0
Hat jemand eine Idee wie ich eine Email Notification implementieren kann wenn jemand versucht (erfolgreich/los) sich mit ssh in die fritzbox einzuloggen?
Zuletzt bearbeitet:
root@fritz:/var/mod/root# cat /var/log/messages | grep drop
Jun 8 19:34:34 fritz authpriv.warn dropbear[31147]: Failed loading /mod/etc/dropbear/dropbear_ecdsa_host_key
Jun 8 19:34:34 fritz authpriv.info dropbear[31147]: Child connection from A.B.C.D:51241
Jun 8 19:34:37 fritz authpriv.notice dropbear[31147]: Password auth succeeded for 'root' from A.B.C.D:51241
Jun 8 19:35:40 fritz authpriv.info dropbear[31147]: Exit (root): Disconnect received
Jun 8 19:35:47 fritz authpriv.warn dropbear[31188]: Failed loading /mod/etc/dropbear/dropbear_ecdsa_host_key
Jun 8 19:35:47 fritz authpriv.info dropbear[31188]: Child connection from A.B.C.D:51244
Jun 8 19:35:47 fritz authpriv.warn dropbear[31188]: Login attempt for nonexistent user from A.B.C.D:51244
Jun 8 19:35:49 fritz authpriv.warn dropbear[31188]: Login attempt for nonexistent user from A.B.C.D:51244
Jun 8 19:35:52 fritz authpriv.warn dropbear[31188]: Login attempt for nonexistent user from A.B.C.D:51244
Jun 8 19:35:52 fritz authpriv.info dropbear[31188]: Exit before auth: Max auth tries reached - user 'is invalid' from A.B.C.D:51244
Jun 8 19:36:05 fritz authpriv.warn dropbear[31191]: Failed loading /mod/etc/dropbear/dropbear_ecdsa_host_key
Jun 8 19:36:05 fritz authpriv.info dropbear[31191]: Child connection from A.B.C.D:51246
Jun 8 19:36:08 fritz authpriv.warn dropbear[31191]: Bad password attempt for 'root' from A.B.C.D:51246
Jun 8 19:36:10 fritz authpriv.warn dropbear[31191]: Bad password attempt for 'root' from A.B.C.D:51246
Jun 8 19:36:10 fritz authpriv.info dropbear[31191]: Exit before auth (user 'root', 2 fails): Max auth tries reached - user 'root' from A.B.C.D:51246
root@fritz:/var/mod/root#
cat /var/log/messages | grep drop > /var/tmp/dropbearlog.txt
(while true; do \
mv /var/tmp/dropbearlog.txt /var/tmp/dropbearlog.bak ; \
cat /var/log/messages | grep drop > /var/tmp/dropbearlog.txt; \
[ "$(tail -n 1 /tmp/dropbearlog.bak)" = "$(tail -n 1 /tmp/dropbearlog.txt)" ] || \
mailer send -i "/var/tmp/dropbearlog.txt" -s "Freetz-Dropbear Mailer" -t "[email protected]" ; \
sleep 60 ; \
done ) &
mailer -?
usage: mailer mailer [-s subject] -f from -t to -m mailserver [-a authname [-w passwd]] -i file(s) [-r] [-d attachfile(s)] [-l] [-c charset]
options:
-? - print this help
-p STRING - pidfile. ("/var/run/mmailer.pid")
-s STRING - subject. ("FRITZ!Box")
-f STRING - from. (NULL)
-t STRING - to. (NULL)
-m STRING - mailserver. (NULL)
-a STRING - authname. (NULL)
-w STRING - passwd. (NULL)
-n - no SMTP-Auth. (NOTSET)
-d STRING - attachment(s). (NULL)
-i STRING - inline part(s) - add text file(s) here. (NULL)
-r - use "multipart/related" if possible. (NOTSET)
-l - SMTP with SSL or TLS. (NOTSET)
-c STRING - charset (default: iso-8859-1, no charset conversion!). (NULL)
-D STRING - switch debug logs on. (NULL)
note: please use filename extensions if possible
echo $SSH_CONNECTION
busybox chroot /var/media/ftp/FRITZ/internal/fritzDebianLenny_mips /usr/sbin/rsyslogd
mount -o bind /proc/ /var/media/ftp/FRITZ/internal/fritzDebianLenny_mips/proc/
mount -o bind /dev/ /var/media/ftp/FRITZ/internal/fritzDebianLenny_mips/dev/
cat /var/log/messages | grep drop > /var/tmp/dropbearlog.txt
(while true; do \
mv /var/tmp/dropbearlog.txt /var/tmp/dropbearlog.bak ; \
cat /var/log/messages | grep drop > /var/tmp/dropbearlog.txt; \
[ "$(tail -n 1 /tmp/dropbearlog.bak)" = "$(tail -n 1 /tmp/dropbearlog.txt)" ] || \
mailer send -i "/var/tmp/dropbearlog.txt" -s "Freetz-Dropbear Mailer" -t "[email protected]" ; \
sleep 60 ; \
done ) &
echo 'echo \$SSH_CONNECTION' > ~/.profile
cp /etc/profile /var/tmp/profile
echo "mailerscript" >> /var/tmp/profile
mount -o bind /var/tmp/profile /etc/profile
koyaanisqatsi meint aber die "~/.profile".
Die legt man einfach neu an und dann wird die auch ausgeführt.
(nach der /etc/profile)