/var/log/audit/
감사로그로서
audit log는
의심가는 활동에 대한 모니터링을 제공한다
1.관리자가 해당 활동을 지정할 수 있다
2.auditctl 명령어로 활동을 설정
3.auditsearch 명령어로 감사로그를 조회할 수 있다!
/etc/passwd를 조회하는 행동을 의심가는 행동으로 정의해 보자
auditctl -w /etc/passwd -p war -k password-file
w: 감시할 명령어를 입력
p: 감사에 걸리는 구체적인 행위(w:write , a:attribute, r:read)
k: 필터키 설정
dopa로 접속
/etc/passwd에 접근
[dopa@server1 ~]$ vi /etc/passwd
[dopa@server1 ~]$ grep atom /etc/passwd
atom:x:1014:1014::/home/atom:/bin/bash
ausearch -f /etc/passwd > au_passwd
vi au_passwd
/grep
type=CWD msg=audit(1626405812.345:532): cwd="/home/dopa"
type=SYSCALL msg=audit(1626405812.345:532): arch=c000003e syscall=2 success=yes exit=3
a0=7f7cfc60b552 a1=80000 a2=1b6 a3=24 items=1 ppid=5116 pid=5167 auid=1025 uid=1025 gid=5002
euid=1025 suid=1025 fsuid=1025 egid=5002 sgid=5002 fsgid=5002 tty=pts2 ses=14 comm="vim"
exe="/usr/bin/vim" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="password-file"
/vi
type=CWD msg=audit(1626405827.378:537): cwd="/home/dopa"
type=SYSCALL msg=audit(1626405827.378:537): arch=c000003e syscall=257 success=yes exit=3
a0=ffffffffffffff9c a1=7ffc9a7336b5 a2=0 a3=0 items=1 ppid=5116 pid=5182 auid=1025 uid=1025
gid=5002 euid=1025 suid=1025 fsuid=1025 egid=5002 sgid=5002 fsgid=5002 tty=pts2 ses=14 comm="grep"
exe="/usr/bin/grep" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="password-file"
dopa가 /etc/passwd에 접근한 것을 확인할 수있다!
추가!!
aureport --failed -1 ------> user의 로그인 실패 정보
- 07/16/2021 10:15:14 jeff 192.168.56.104 ssh /usr/sbin/sshd no 596
- 07/16/2021 10:25:37 jeff 192.168.56.104 ssh /usr/sbin/sshd no 641
- 07/16/2021 10:33:16 root 192.168.56.104 ssh /usr/sbin/sshd no 666
- 07/16/2021 12:22:35 jeff 192.168.56.104 ssh /usr/sbin/sshd no 405
- 07/16/2021 12:22:47 user5 192.168.56.104 ssh /usr/sbin/sshd no 430
- 07/16/2021 12:23:10 abel 192.168.56.104 ssh /usr/sbin/sshd no 531
위와 같이 로그인 실패기록을 확인할 수 있다!!
의심가는 호스트 검거 성공!!