sendmail 인증시도(실패) IP 접속 기록 남기는 방법
기본적으로 sendmail의 PAM 인증을 할 때 IP 로그가 남지 않습니다.
어디서나 IP에 대한것은 설정을 하지 않아도 서버에서 기본적으로 남것중 하나 인데 인증시도 하여 실패한 기록만 있을 뿐입니다.
결론부터 말하면 로그레벨을 조정하면 됩니다.
아래와 같이 sendmail의 로그 레벨을 조정하여 ip를 남길 수 있습니다.
vim /etc/mail/sendmail.cf
# log level
O LogLevel=14
* semail 로그레벨을 남기지 않았을때의 형태 입니다.
기본설정된 로그레벨은 9 입니다.
$ tail -f /var/log/messages | grep auth
Nov 28 11:41:23 testserver saslauthd[112343]: do_auth : auth failure: [user=mike] [service=smtp] [realm=pabburi.co.kr] [mech=pam] [reason=PAM auth error]
Nov 28 11:51:23 testserver saslauthd[111222]: do_auth : auth failure: [user=mapwanyac] [service=smtp] [realm=pabburi.co.kr] [mech=pam] [reason=PAM auth error]
* sendmail 로그레벨 14일때 볼 수 있는 것입니다.
tail -f maillog | grep "AUTH failure (LOGIN)"
Nov 28 11:21:13 pabburi sendmail[152342]: 123abcderfer: AUTH failure (LOGIN): authentication failure (-13) SASL(-13): authentication failure: checkpass failed, relay=[11.22.33.44]
Nov 28 11:22:13 pabburi sendmail[124568]: 123abcderfer: AUTH failure (LOGIN): authentication failure (-13) SASL(-13): authentication failure: checkpass failed, relay=[11.22.33.44]
이제 무작위 대입하는 친구를 차단 할 수 있습니다.
* --------------------------- *
위와는 별개로 리눅스에서 접속한 IP 보는 명령은(IP 접속기록)
아래는 로그인한 유저를 보는 방법으로 뒤쪽에 숫자를 넣으면 보여질 갯수 입니다.
last -20
