mirror of
https://github.com/m8tin/cis.git
synced 2026-04-02 19:01:30 +02:00
filter for private IP added
This commit is contained in:
@@ -73,10 +73,21 @@ function setup() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$PAM_TYPE" != "close_session" ] && ! setup && [ "${PAM_USER}" != "" ] && [ "${PAM_USER}" == "root" ]; then
|
if [ "$PAM_TYPE" != "close_session" ] && ! setup && [ "${PAM_USER}" != "" ]; then
|
||||||
|
|
||||||
|
# Log root logins only
|
||||||
|
[ "${PAM_USER}" != "root" ] \
|
||||||
|
&& exit 0
|
||||||
|
|
||||||
|
# Skip logins from private IPs
|
||||||
|
echo "${PAM_RHOST}" | grep -Eq "^192\.168\..*$" \
|
||||||
|
&& exit 0
|
||||||
|
|
||||||
_MESSAGE="[$(date --rfc-3339=seconds)] - Login from IP: '${PAM_RHOST}' as user 'root@$(hostname)'"
|
_MESSAGE="[$(date --rfc-3339=seconds)] - Login from IP: '${PAM_RHOST}' as user 'root@$(hostname)'"
|
||||||
|
|
||||||
log "${_MESSAGE}"
|
log "${_MESSAGE}"
|
||||||
sendEMail "${_MESSAGE}"
|
sendEMail "${_MESSAGE}"
|
||||||
sendSlackMessage "${_MESSAGE}"
|
sendSlackMessage "${_MESSAGE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user