리눅스는 시스템의 보안 관련 정보를 감사
할 수 있는 auditd
라는 데몬을 제공합니다.
auditd
는 사전에 정의된 규칙에 의거하여 시스템에서 발생하는 보안
과 인증 관련 이벤트
의 로그를 기록합니다.
권한 없는 계정이 root 권한을 얻으려고 시도하거나 서버 데몬이 SELinux 의 보안 정책에 위배되는 동작을 수행했는지 등의 시스템의 보안 위반 사례를 확인
할 수 있으며 이를 통해 위협을 식별하고 방지하는데 사용할 수 있습니다.
Audit
내용은 시스템의 audit 로그 파일인 /var/log/audit/audit.log
에 남기고 있습니다.
audit.log
파일을 대상으로 특정 조건에 맞게 보고서를 만들수 있는 aureport
명령어가 있습니다.
% aureport
Summary Report
======================
Range of time in logs: 05/18/2022 06:05:40.600 - 05/31/2022 08:10:01.457
Selected time for report: 05/18/2022 06:05:40 - 05/31/2022 08:10:01.457
Number of changes in configuration: 30
Number of changes to accounts, groups, or roles: 15
Number of logins: 3
Number of failed logins: 520
Number of authentications: 13
Number of failed authentications: 15
Number of users: 3
Number of terminals: 5
Number of host names: 132
Number of executables: 10
Number of commands: 2
Number of files: 0
Number of AVC's: 0
Number of MAC events: 0
Number of failed syscalls: 0
Number of anomaly events: 0
Number of responses to anomaly events: 0
Number of crypto events: 5340
Number of integrity events: 0
Number of virt events: 0
Number of keys: 0
Number of process IDs: 1295
Number of events: 9233
-au
, --auth
: 인증 시도에 대한 리포트 생성하며 su, sudo 명령어 시도시에 로그를 남깁니다.-a
, --avc
: avc message(SElinux) 에 대한 리포트로 다음 장에서 설명할 SELinux 의 에러 상황을 확인하는데 유용합니다.-f, --file
: 파일이나 Unix domain 소켓에 대한 리포트-x
: 실행한 모든 명령어 목록에 대한 리포트-l
, --login
: 로그인에 대한 리포트-h
, --hostReport
: 호스트에 대한 리포트--failed
: 실패한 건만 리포트. --success
: 성공한 건만 리포트. --summary
: 요약 리포트. -ts
, --start
: 리포트 대상 시작일-te
, --end
: 리포트 대상 종료일예를 들어, 아래와 같이 명령할 수 있습니다.
% aureport -x --summary --start this-month --end now
Executable Summary Report
=================================
total file
=================================
6470 /usr/sbin/sshd
1344 /usr/sbin/crond
1131 /usr/lib/systemd/systemd
39 /usr/lib/systemd/systemd-update-utmp
28 /usr/bin/su
23 /usr/bin/sudo
13 /usr/sbin/useradd
2 /usr/sbin/groupadd
2 /usr/bin/crontab
1 /usr/bin/passwd
su
나 sudo
명령어를 실행한 내역을 확인하려면 aureport -au
를 실행하면 됩니다.
% aureport -au
로그인 실패 건을 확인하려면 다음과 같이 -l
과 같이 사용하면 됩니다.
% sudo aureport -l --failed
참고 사이트
-> https://www.lesstif.com/ws/audit-daemon-46366745.html