Dude, Do you even audit? 🧐

Dude, Do you even audit? 🧐
μ§€κΈˆ 이 μˆœκ°„, Linux Auditing System 슈퍼 μœ μ € & λ‚΄λΆ€ ꡬ쑰 μž˜μ•Œ!

Paran Lee <p4ranlee@gmail.com>

Index

    1. audit 을 μ–΄λ–»κ²Œ ν™œμš©ν• κΉŒ?
    • 1.1 큰 κ·Έλ¦Ό
    • 1.2 man
    • 1.3 audit 슈퍼 μœ μ €κ°€ 되기
    1. λ¦¬λˆ…μŠ€ 컀널 audit λ‚΄λΆ€ ꡬ쑰 뢄석!
    • 2.1. μ–Έμ œ μ–΄λ–»κ²Œ μ΄ˆκΈ°ν™” λ˜λŠ”κ°€?
    • 2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€
    • 2.3. audit rule 을 μ–΄λ–»κ²Œ λ‘œλ“œν• κΉŒ?
    1. μ°Έκ³ 

1. audit 을 μ–΄λ–»κ²Œ ν™œμš©ν• κΉŒ? πŸ€”

  • πŸ€” μ–΄λ–»κ²Œ 증거(둜그)λ₯Ό 남기면 μ’‹μ„κΉŒμš”?
    • μŠ€ν† λ¦¬μ§€ μ„œλ²„ /opt 디렉토리 μ•ˆμ— μ€‘μš”ν•œ νŒŒμΌμ„ λˆ„κ°€ μ§€μš°μ…¨μ–΄μš₯!?
    • μ»¨ν…Œμ΄λ„ˆ μ•ˆμ— μ΄μƒν•œ μ†Œν”„νŠΈμ›¨μ–΄κ°€ 자꾸 μ„€μΉ˜λ˜μš”. λˆ„κ°€ μ„€μΉ˜ν•œκ±°μ£ ..?
    • 사내 μ†ŒμŠ€ μ„œλ²„μ— 자꾸 μ΄μƒν•œ IP κ°€ μ ‘κ·Όν•©λ‹ˆλ‹€. μ΄λŸ¬λ‹€κ°€ μ „λΆ€ DRM κ±Έλ¦¬κ±°λ‚˜ μ†ŒμŠ€ μ½Έμ½Έμ½Έ 유좜 μ•„λ‹ˆκ² μ£ ?!

κ³ λ―Όν•˜μ§€ 말고, audit 을 μ‚¬μš©ν•΄λ΄…μ‹œλ‹€!

1. audit 을 μ–΄λ–»κ²Œ ν™œμš©ν• κΉŒ? πŸ€”

  • audit 을 잘 μ‚¬μš©ν•˜κΈ° μœ„ν•œ μ‚¬μš©λ²•, 그리고 컀널/μœ μ € λ™μž‘κ³Ό μ†Œν”„νŠΈμ›¨μ–΄ μ»΄ν¬λ„ŒνŠΈλŠ” μ–΄λ–»κ²Œ κ΅¬μ„±λ˜μ–΄ μžˆλŠ”μ§€ μ‚΄νŽ΄λ΄…λ‹ˆλ‹€.
audit_components

1.1 큰 그림

  • μœ μ € ν”„λ‘œμ„ΈμŠ€κ°€ ν•˜λŠ” ν–‰λ™μ˜ 둜그λ₯Ό 남기기 μœ„ν•œ 컀널 ν”„λ‘œμ„ΈμŠ€ kaudit 와 μœ μ € libaudit ν”„λ ˆμž„μ›Œν¬λ₯Ό ν™œμš©ν•œ μ†Œν”„νŠΈμ›¨μ–΄ μΈν”„λΌμž…λ‹ˆλ‹€.
audit_components
  • 컀널 슀페이슀의 audit lsm hook 둜 ctx -> audit_context -> skb
  • netlink 둜 auditd 와 ν†΅μ‹ ν•˜λ©° 행동 λ‘œκΉ… 및 μƒˆλ‘œμš΄ 룰을 μ μš©ν•©λ‹ˆλ‹€.

1.1 μ£Όμš” νŠΉμ§•

  • 컀널 ν”„λ‘œμ„ΈμŠ€λ‘œ 상주 쀑인 kaudit 은 security/lsm_audit.c Hook 을 μ‚¬μš©ν•˜μ—¬ ctx 정보λ₯Ό κ°€μ Έμ˜΅λ‹ˆλ‹€.
  • auditd κ°€ μ˜¬λΌμ˜€λ©΄μ„œ audit.rules νŒŒμΌμ„ 읽어 정책을 μ μš©ν•©λ‹ˆλ‹€.
  • auditctl 둜 운영 쀑인 μ‹œμŠ€ν…œμ— μ μš©ν•©λ‹ˆλ‹€.
  • 아킀텍쳐 지원 : arm, x86, s390 (32, 64 bit)
  • λ¦¬λˆ…μŠ€ 컀널 μ‹œμŠ€ν…œ 콜 ν…Œμ΄λΈ”μ˜ μƒˆλ‘œμš΄ μ‹œμŠ€ν…œ μ½œμ„ νŒ”λ‘œμš° μ—… ν•©λ‹ˆλ‹€.
    • (예) _S(280, "bpf") audit 3.0 BPF μ‹œμŠ€ν…œ 콜 감사 μ •μ±… 지원
    • Add bpf syscall command argument interpretation to auparse
    • 호슀트 λ¨Έμ‹ μ—μ„œ virtual machine, container κ°μ‹œ κ΄€λ ¨ feature λ₯Ό ν™•μž₯ μ€‘μž…λ‹ˆλ‹€.
  • audit 은 λΉ¨κ°„ λͺ¨μžμ˜ μ•ˆλ³΄κ°€ μ€‘μš”ν•œ μ„œλ²„ μ†”λ£¨μ…˜μ—μ„œ μΉ¨μž… 탐지 μ‹œμŠ€ν…œ(Intrusion Detection System)으둜 ν™œμš© μ€‘μž…λ‹ˆλ‹€.

1.2 man

  • auditd λŠ” μœ μ € 곡간 Linux Auditing System μž…λ‹ˆλ‹€.
    • audit recordsλ₯Ό λ””μŠ€ν¬μ— μ“°λŠ” μž„λ¬΄λ₯Ό 맑은 친ꡬ죠.
  • λ‘œκ·ΈλŠ” ausearch λ˜λŠ” aureport λ₯Ό ν†΅ν•˜μ—¬ νŽΈλ¦¬ν•˜κ²Œ λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€.
  • auditctl 을 톡해 운영 쀑에 audit 섀정을 λ°”κΎΈκ±°λ‚˜ 룰을 λ³€κ²½ν•  수 μžˆμ–΄μš”!
  • augenrules 은 /etc/audit/rules.d/ μ•ˆμ— μžˆλŠ” λ£° νŒŒμΌλ“€μ„ /etc/audit/audit.rules 파일둜 λ§Œλ“€μ–΄ μ€λ‹ˆλ‹€.
  • auditd.conf 섀정을 λ°”κΎΈμ–΄μ„œ auditd λ₯Ό μž…λ§›λŒ€λ‘œ μ„€μ •ν•  수 μžˆμ–΄μš”!

1.3 audit 슈퍼 μœ μ €κ°€ 되기 - μ‹€ν–‰ ν™•μΈν•˜κΈ°

# service auditd status
Redirecting to /bin/systemctl status auditd.service
● auditd.service - Security Auditing Service
   Loaded: loaded (/usr/lib/systemd/system/auditd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2022-09-28 01:42:53 KST; 54min ago
     Docs: man:auditd(8)
           https://github.com/linux-audit/audit-documentation
 Main PID: 1014 (auditd)
    Tasks: 4 (limit: 49134)
   Memory: 3.6M
   CGroup: /system.slice/auditd.service
           β”œβ”€1014 /sbin/auditd
           └─1016 /usr/sbin/sedispatch

 9μ›” 28 01:42:53 localhost.localdomain augenrules[1033]: enabled 1
 9μ›” 28 01:42:53 localhost.localdomain augenrules[1033]: failure 1
 9μ›” 28 01:42:53 localhost.localdomain augenrules[1033]: pid 1014
 9μ›” 28 01:42:53 localhost.localdomain augenrules[1033]: rate_limit 0
 9μ›” 28 01:42:53 localhost.localdomain augenrules[1033]: backlog_limit 8192
 9μ›” 28 01:42:53 localhost.localdomain augenrules[1033]: lost 0
 9μ›” 28 01:42:53 localhost.localdomain augenrules[1033]: backlog 4
 9μ›” 28 01:42:53 localhost.localdomain augenrules[1033]: backlog_wait_time 60000
 9μ›” 28 01:42:53 localhost.localdomain augenrules[1033]: backlog_wait_time_actual 0
 9μ›” 28 01:42:53 localhost.localdomain systemd[1]: Started Security Auditing Service.
  • λ¦¬λˆ…μŠ€ μ»€λ„μ˜ kauditd
  • μœ μ € 슀페이슀의 λ ˆλ“œν–‡/λ°λΉ„μ•ˆ 계열 배포판 auditd 둜 ν™œμ„±ν™” λ˜μ–΄μžˆμŠ΅λ‹ˆλ‹€.

1.3 audit 슈퍼 μœ μ €κ°€ 되기 - μ‹€ν–‰ ν™•μΈν•˜κΈ°

# λ ˆλ“œν–‡ 계열 # dnf install auditd
# λ°λΉ„μ•ˆ 계열 # apt install auditd

1.3 audit 슈퍼 μœ μ €κ°€ 되기 - aureport

ssh μ ‘κ·Ό, 즉 sshd fork ν•˜μ—¬ μœ μ €κ°€ λ‘œκ·ΈμΈν•˜λŠ” ν–‰μœ„μ˜ 둜그λ₯Ό 봐 λ³ΌκΉŒμš”!

#  aureport -l --failed

Login Report
============================================
# date time auid host term exe success event
============================================
1. 2022λ…„ 09μ›” 28일 05:33:54 (unknown) 192.168.66.1 ssh /usr/sbin/sshd no 205
2. 2022λ…„ 09μ›” 28일 05:33:54 (unknown) 192.168.66.1 ssh /usr/sbin/sshd no 216
3. 2022λ…„ 09μ›” 28일 05:34:06 (unknown) 192.168.66.1 ssh /usr/sbin/sshd no 227
4. 2022λ…„ 09μ›” 28일 05:35:44 ahnlab 192.168.66.1 ssh /usr/sbin/sshd no 268
5. 2022λ…„ 09μ›” 28일 05:35:44 ahnlab 192.168.66.1 ssh /usr/sbin/sshd no 281
#  aureport -l --success

Login Report
============================================
# date time auid host term exe success event
============================================
1. 2022λ…„ 09μ›” 28일 04:47:43 1000 ::1 /dev/pts/1 /usr/sbin/sshd yes 208
2. 2022λ…„ 09μ›” 28일 05:35:38 1000 192.168.66.1 /dev/pts/1 /usr/sbin/sshd yes 245
3. 2022λ…„ 09μ›” 28일 05:35:46 1000 192.168.66.1 ssh /usr/sbin/sshd yes 299

1.3 audit 슈퍼 μœ μ €κ°€ 되기 - file rule

  • μ™ΈλΆ€μ—μ„œ /etc/ssh/sshd_config νŒŒμΌμ„ μ½κ±°λ‚˜ μˆ˜μ •ν•˜λ €λŠ” λͺ¨λ“  μ‹œλ„λ₯Ό λ‚¨κ²¨λ³ΌκΉŒμš”?
  • ν•΄λ‹Ή rule 을 sshd_config ν‚€λ‘œ 기둝해보죠!
 $ auditctl -w /etc/ssh/sshd_config -p warx -k sshd_config
 $ # ausearch -k sshd_config
----
time->Wed Sep 28 06:04:31 2022
type=SYSCALL msg=audit(1664312671.115:387): arch=c000003e syscall=44 success=yes exit=1088 a0=4 a1=7ffc4fcb9be0 a2=440 a3=0 items=0 ppid=7613 pid=52609 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=3 comm="auditctl" exe="/usr/sbin/auditctl" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)
type=CONFIG_CHANGE msg=audit(1664312671.115:387): auid=1000 ses=3 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 op=add_rule key="sshd_config" list=4 res=1
----
time->Wed Sep 28 06:04:46 2022
type=PATH msg=audit(1664312686.595:388): item=0 name="/etc/ssh/sshd_config" inode=103004708 dev=fd:00 mode=0100600 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:etc_t:s0 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
type=SYSCALL msg=audit(1664312686.595:388): arch=c000003e syscall=257 success=yes exit=3 a0=ffffff9c a1=55dbad3cf050 a2=0 a3=0 items=1 ppid=7613 pid=53627 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=3 comm="vim" exe="/usr/bin/vim" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="sshd_config"

1.3 audit 슈퍼 μœ μ €κ°€ 되기 - record type

  • type=SYSCALL
    • type ν•„λ“œμ—λŠ” λ ˆμ½”λ“œ μœ ν˜•μ΄ ν¬ν•¨λ©λ‹ˆλ‹€. 이 μ˜ˆμ œμ—μ„œ SYSCALL 값은 컀널에 λŒ€ν•œ μ‹œμŠ€ν…œ ν˜ΈμΆœμ— μ˜ν•΄ 이 λ ˆμ½”λ“œκ°€ νŠΈλ¦¬κ±°λ˜μ—ˆμŒμ„ μ§€μ •ν•©λ‹ˆλ‹€.
  • key=“sshd_config”
    • ν‚€ ν•„λ“œλŠ” 감사 λ‘œκ·Έμ—μ„œ 이 이벀트λ₯Ό μƒμ„±ν•œ κ·œμΉ™κ³Ό κ΄€λ ¨λœ κ΄€λ¦¬μž μ •μ˜ λ¬Έμžμ—΄μ„ κΈ°λ‘ν•©λ‹ˆλ‹€.
type=SYSCALL msg=audit(1364481363.243:24287): arch=c000003e
syscall=2 success=no exit=-13 
a0=7fffd19c5592 a1=0 a2=7fffd19c4b50 a3=a items=1 
ppid=2686 pid=3538 auid=1000 
uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 
tty=pts0 ses=1 comm="cat" exe="/bin/cat" 
subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 
key="sshd_config"

1.3 audit 슈퍼 μœ μ €κ°€ 되기 - record type

  • ppid=2686
    • ppid ν•„λ“œλŠ” μƒμœ„ ν”„λ‘œμ„ΈμŠ€ ID(PPID)λ₯Ό κΈ°λ‘ν•©λ‹ˆλ‹€. 이 경우 2686 은 bash 와 같은 μƒμœ„ ν”„λ‘œμ„ΈμŠ€μ˜ PPIDμ˜€μŠ΅λ‹ˆλ‹€.
  • pid=3538
    • pid ν•„λ“œλŠ” ν”„λ‘œμ„ΈμŠ€ ID(PID)λ₯Ό κΈ°λ‘ν•©λ‹ˆλ‹€. 이 경우 3538 은 cat ν”„λ‘œμ„ΈμŠ€μ˜ PIDμž…λ‹ˆλ‹€.
  • auid=1000
    • auid ν•„λ“œλŠ” loginuid인 Audit μ‚¬μš©μž IDλ₯Ό κΈ°λ‘ν•©λ‹ˆλ‹€. 이 IDλŠ” 둜그인 μ‹œ μ‚¬μš©μžμ—κ²Œ ν• λ‹Ήλ˜λ©°, 예λ₯Ό λ“€μ–΄ su - john λͺ…λ ΉμœΌλ‘œ μ‚¬μš©μž 계정을 μ „ν™˜ν•˜μ—¬ μ‚¬μš©μžμ˜ IDκ°€ 변경될 κ²½μš°μ—λ„ λͺ¨λ“  ν”„λ‘œμ„ΈμŠ€μ— μƒμ†λ©λ‹ˆλ‹€.
type=SYSCALL msg=audit(1364481363.243:24287): arch=c000003e
syscall=2 success=no exit=-13 a0=7fffd19c5592 a1=0 a2=7fffd19c4b50 a3=a items=1 
ppid=2686 pid=3538 auid=1000 uid=1000 gid=1000 euid=1000
suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 
tty=pts0 ses=1 comm="cat" exe="/bin/cat" 
subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key="sshd_config"

1.3 audit 슈퍼 μœ μ €κ°€ 되기 - network rule

  • μœ μž…, μœ μΆœλ˜λŠ” λ„€νŠΈμ›Œν¬ 연결을 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.
    • 172.20.14.41:60822 μ—μ„œ ν˜„μž¬ localhost 둜 접근을 확인 κ°€λŠ₯ν•©λ‹ˆλ‹€!
 $ auditctl -a always,exit -F arch=b64 -S accept,connect -F key=external-access
type=PROCTITLE msg=audit(2022λ…„ 08μ›” 02일 09:47:19.345:372385) : 
proctitle=/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
type=SOCKADDR msg=audit(2022λ…„ 08μ›” 02일 09:47:19.345:372385) : 
saddr={ fam=inet laddr=172.20.14.41 lport=60822 }
type=SYSCALL msg=audit(2022λ…„ 08μ›” 02일 09:47:19.345:372385) : 
arch=x86_64 syscall=accept success=yes exit=11 
a0=0x4 a1=0x7fffffffe870 a2=0x7fffffffe844 a3=0x3e8 
items=0 ppid=1 pid=22267 auid=unset uid=lighttpd gid=lighttpd 
euid=lighttpd suid=lighttpd fsuid=lighttpd egid=lighttpd sgid=lighttpd 
fsgid=lighttpd tty=(none) ses=unset comm=lighttpd 
exe=/usr/sbin/lighttpd key=my_accept

1.3 audit 슈퍼 μœ μ €κ°€ 되기 - process rule

  • 일반 μ‚¬μš©μžμ˜ root둜 κΆŒν•œ μƒμŠΉ μ‹œλ„λ₯Ό ν™•μΈν•΄λ³ΌκΉŒμš”?
 $ auditctl -a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -F key=10.2.5.b-elevated-privs-setuid
type=SYSCALL msg=audit(1659428449.377:378871): arch=c000003e
syscall=59 success=yes exit=0 a0=6f4f60 a1=6fa4b0 a2=822900 a3=7fffffffe260
items=2 ppid=14078 pid=15495 auid=1052 uid=1052 gid=1052
euid=0 suid=0 fsuid=0 egid=1052 sgid=1052 fsgid=1052
tty=pts8 ses=26782 comm="su" exe="/usr/bin/su"
key="10.2.5.b-elevated-privs-setuid" 
---
type=USER_AUTH msg=audit(1659428456.960:378872): pid=15495 uid=1052 auid=1052 ses=26782
msg='op=PAM:authentication grantors=pam_faillock,pam_unix acct="root" exe="/usr/bin/su" hostname=localhost.localdomain addr=? terminal=pts/8 res=success'
  • 이외에도 μ‹œμŠ€ν…œ λ£° μ˜ˆμ‹œλ₯Ό 쑰금 더 μ‚΄νŽ΄λ³Όλ €λ©΄? 30-stig.rules μ°Έκ³ !
    • Security Technical Implementation (STIG, λ―Έκ΅­ κ΅­λ°©μ„±μ˜ DISA λ³΄μ•ˆ ꡬ성 ν‘œμ€€)μ—μ„œ μš”κ΅¬ν•˜λŠ” 쑰건을 μΆ©μ‘±ν•  수 μžˆλ„λ‘ κ΅¬μ„±λœ Audit κ·œμΉ™μž…λ‹ˆλ‹€.

1.3 audit 슈퍼 μœ μ €κ°€ 되기 - config

κΈ°λ³Έ 섀정은 μ•„λž˜μ™€ 같이 확인 ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

  • event buffer μ‚¬μ΄μ¦ˆ 8192
  • burst of events μ‹œμ— 60000 만큼 κΈ°λ‹€λ¦°λ‹€.
# cat /etc/audit/rules.d/audit.rules 
## First rule - delete all
-D

## Increase the buffers to survive stress events.
## Make this bigger for busy systems
-b 8192

## This determine how long to wait in burst of events
--backlog_wait_time 60000

## Set failure mode to syslog
-f 1
# cat /etc/audit/audit.rules
## This file is automatically generated from /etc/audit/rules.d
-D
-b 8192
-f 1
--backlog_wait_time 60000

2. λ¦¬λˆ…μŠ€ 컀널 kauditd λ‚΄λΆ€ ꡬ쑰 뢄석!

  • kaudit 의 μ€‘μš”ν•œ 뢀뢄을 콕 찍먹해볼 μ‹œκ°„μž…λ‹ˆλ‹€.

2.1. kaduit μ–Έμ œ μ–΄λ–»κ²Œ μ΄ˆκΈ°ν™” λ κΉŒμš”?

-> arch_call_rest_init()
  -> rest_init()
    -> pid = kernel_thread(kernel_init, NULL, CLONE_FS);
      -> kernel_init()
        -> kernel_init_freeable()
          -> do_basic_setup()
            -> do_initcalls()
  • do_initcalls() λ‚΄μ˜ Linux 컀널 λΆ€νŒ… 쀑 μ΄ˆκΈ°ν™” 호좜 μƒλŒ€μ  μˆœμ„œλ₯Ό μ‚΄νŽ΄λ³΄λ©΄, 3λ²ˆμ§Έμ— ν•΄λ‹Ήν•˜λŠ” 것을 λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€.
    • early_initcall(), core_initcall()
    • postcore_initcall() β†’ postcore_initcall(audit_init);
    • arch_initcall(), subsys_initcall(), fs_initcall(), device_initcall()

2.1. kaduit μ–Έμ œ μ–΄λ–»κ²Œ μ΄ˆκΈ°ν™” λ κΉŒμš”?

# dmesg | grep audit
[    0.215458] audit: initializing netlink subsys (disabled)
[    0.215500] audit: type=2000 audit(1664301355.215:1): state=initialized audit_enabled=0 res=1
[    7.430702] audit: type=1404 audit(1664301363.005:2): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295 enabled=1 old-enabled=1 lsm=selinux res=1
[    7.786790] audit: type=1403 audit(1664301363.360:3): auid=4294967295 ses=4294967295 lsm=selinux res=1
$ ps -ef | grep audit
root          69       2  0 09:29 ?        00:00:00 [kauditd]
root        1038       1  0 09:29 ?        00:00:00 /sbin/auditd

2.1. kaduit μ–Έμ œ μ–΄λ–»κ²Œ μ΄ˆκΈ°ν™” λ κΉŒμš”?

  • audit_init() λ‹€μŒ ν•­λͺ©μ— μ£Όλͺ©ν•΄μ„œ 보면 μ–΄λ–¨κΉŒμš”?
    • skb_queue 자료ꡬ쑰 audit_queue
    • kauditd_thread(), audit_log()
/* Initialize audit support at boot time. */
static int __init audit_init(void)
{
	int i;

	if (audit_initialized == AUDIT_DISABLED)
		return 0;

	audit_buffer_cache = kmem_cache_create("audit_buffer",
					       sizeof(struct audit_buffer),
					       0, SLAB_PANIC, NULL);

	skb_queue_head_init(&audit_queue);
	skb_queue_head_init(&audit_retry_queue);
	skb_queue_head_init(&audit_hold_queue);

	for (i = 0; i < AUDIT_INODE_BUCKETS; i++)
		INIT_LIST_HEAD(&audit_inode_hash[i]);
	// ...
	audit_initialized = AUDIT_INITIALIZED;

	kauditd_task = kthread_run(kauditd_thread, NULL, "kauditd");
	// ...
	audit_log(NULL, GFP_KERNEL, AUDIT_KERNEL,
		"state=initialized audit_enabled=%u res=1",
		 audit_enabled);

	return 0;
}
  • 큐 자료ꡬ쑰 μ΄ˆκΈ°ν™” 및 kauditd 컀널 μŠ€λ ˆλ“œμ˜ 생성을 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.

2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€

int syscall_trace_enter(struct pt_regs *regs)
{
	unsigned long flags = read_thread_flags();

	if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
		report_syscall(regs, PTRACE_SYSCALL_ENTER);
		if (flags & _TIF_SYSCALL_EMU)
			return NO_SYSCALL;
	}

	/* Do the secure computing after ptrace; failures should be fast. */
	if (secure_computing() == -1)
		return NO_SYSCALL;

	if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
		trace_sys_enter(regs, regs->syscallno);

	audit_syscall_entry(regs->syscallno, regs->orig_x0, regs->regs[1],
			    regs->regs[2], regs->regs[3]);

	return regs->syscallno;
}

2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€

void syscall_trace_exit(struct pt_regs *regs)
{
	unsigned long flags = read_thread_flags();

	audit_syscall_exit(regs);

	if (flags & _TIF_SYSCALL_TRACEPOINT)
		trace_sys_exit(regs, syscall_get_return_value(current, regs));

	if (flags & (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP))
		report_syscall(regs, PTRACE_SYSCALL_EXIT);

	rseq_syscall(regs);
}

2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€

  • struct common_audit_data : 곡톡 lsm audit log 을 μœ„ν•œ data ꡬ쑰체
/* Auxiliary data to use in generating the audit record. */
struct common_audit_data {
	union 	{
		struct path path;
		struct dentry *dentry;
		struct inode *inode;
		struct lsm_network_audit *net;
		int cap;
		int ipc_id;
		struct task_struct *tsk;
		char *kmod_name;
		struct lsm_ioctlop_audit *op;
		struct file *file;
		struct lsm_ibpkey_audit *ibpkey;
		struct lsm_ibendport_audit *ibendport;
		int reason;
		const char *anonclass;
	} u;
}

2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€

  • common_lsm_audit() : Hook μ—μ„œ audit ν•˜κΈ° μœ„ν•΄ μ‚¬μš©ν•  ν•¨μˆ˜
/**
 * common_lsm_audit - generic LSM auditing function
 * @a:  auxiliary audit data
 * @pre_audit: lsm-specific pre-audit callback
 * @post_audit: lsm-specific post-audit callback
 *
 * setup the audit buffer for common security information
 * uses callback to print LSM specific information
 */
void common_lsm_audit(struct common_audit_data *a,
	void (*pre_audit)(struct audit_buffer *, void *),
	void (*post_audit)(struct audit_buffer *, void *))
{
	struct audit_buffer *ab;

	if (a == NULL)
		return;
	/* we use GFP_ATOMIC so we won't sleep */
	ab = audit_log_start(audit_context(), GFP_ATOMIC | __GFP_NOWARN,
			     AUDIT_AVC);

	if (ab == NULL)
		return;

	if (pre_audit)
		pre_audit(ab, a);

	dump_common_audit_data(ab, a);

	if (post_audit)
		post_audit(ab, a);

	audit_log_end(ab);
}

2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€

  • audit_log_start() : struct audit_buffer μΈμŠ€ν„΄μŠ€λ₯Ό λ§Œλ“€μ–΄μ€λ‹ˆλ‹€.
  • audit_log_end() : λ§Œλ“  버퍼λ₯Ό νμž‰ν•©λ‹ˆλ‹€.
/* The audit_buffer is used when formatting an audit record.  The caller
 * locks briefly to get the record off the freelist or to allocate the
 * buffer, and locks briefly to send the buffer to the netlink layer or
 * to place it on a transmit queue.  Multiple audit_buffers can be in
 * use simultaneously. */
struct audit_buffer {
	struct sk_buff       *skb;	/* formatted skb ready to send */
	struct audit_context *ctx;	/* NULL or associated context */
	gfp_t		     gfp_mask;
};
/**
 * audit_log - Log an audit record
 * @ctx: audit context
 * @gfp_mask: type of allocation
 * @type: audit message type
 * @fmt: format string to use
 * @...: variable parameters matching the format string
 *
 * This is a convenience function that calls audit_log_start,
 * audit_log_vformat, and audit_log_end.  It may be called
 * in any context.
 */
void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
	       const char *fmt, ...)
{
	struct audit_buffer *ab;
	va_list args;

	ab = audit_log_start(ctx, gfp_mask, type);
	if (ab) {
		va_start(args, fmt);
		audit_log_vformat(ab, fmt, args);
		va_end(args);
		audit_log_end(ab);
	}
}
  • 둜그λ₯Ό λ§Œλ“€κΈ°μœ„ν•œ 버퍼λ₯Ό μ‚¬μš©ν•˜λŠ” 루틴을 ν™•μΈν•©λ‹ˆλ‹€.

2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€

  • struct audit_context λ₯Ό 가지고 struct audit_buffer μΈμŠ€ν„΄μŠ€λ₯Ό λ§Œλ“€μ–΄μ€λ‹ˆλ‹€.
/**
 * audit_log_start - obtain an audit buffer
 * @ctx: audit_context (may be NULL)
 * @gfp_mask: type of allocation
 * @type: audit message type
 *
 * Returns audit_buffer pointer on success or NULL on error.
 *
 * Obtain an audit buffer.  This routine does locking to obtain the
 * audit buffer, but then no locking is required for calls to
 * audit_log_*format.  If the task (ctx) is a task that is currently in a
 * syscall, then the syscall is marked as auditable and an audit record
 * will be written at syscall exit.  If there is no associated task, then
 * task context (ctx) should be NULL.
 */
struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
				     int type)
{
	struct audit_buffer *ab;
	struct timespec64 t;
	unsigned int serial;

	if (audit_initialized != AUDIT_INITIALIZED)
		return NULL;

	if (unlikely(!audit_filter(type, AUDIT_FILTER_EXCLUDE)))
		return NULL;

	/* NOTE: don't ever fail/sleep on these two conditions:
	 * 1. auditd generated record - since we need auditd to drain the
	 *    queue; also, when we are checking for auditd, compare PIDs using
	 *    task_tgid_vnr() since auditd_pid is set in audit_receive_msg()
	 *    using a PID anchored in the caller's namespace
	 * 2. generator holding the audit_cmd_mutex - we don't want to block
	 *    while holding the mutex, although we do penalize the sender
	 *    later in audit_receive() when it is safe to block
	 */
	if (!(auditd_test_task(current) || audit_ctl_owner_current())) {
		long stime = audit_backlog_wait_time;

		while (audit_backlog_limit &&
		       (skb_queue_len(&audit_queue) > audit_backlog_limit)) {
			/* wake kauditd to try and flush the queue */
			wake_up_interruptible(&kauditd_wait);

			/* sleep if we are allowed and we haven't exhausted our
			 * backlog wait limit */
			if (gfpflags_allow_blocking(gfp_mask) && (stime > 0)) {
				long rtime = stime;

				DECLARE_WAITQUEUE(wait, current);

				add_wait_queue_exclusive(&audit_backlog_wait,
							 &wait);
				set_current_state(TASK_UNINTERRUPTIBLE);
				stime = schedule_timeout(rtime);
				atomic_add(rtime - stime, &audit_backlog_wait_time_actual);
				remove_wait_queue(&audit_backlog_wait, &wait);
			} else {
				if (audit_rate_check() && printk_ratelimit())
					pr_warn("audit_backlog=%d > audit_backlog_limit=%d\n",
						skb_queue_len(&audit_queue),
						audit_backlog_limit);
				audit_log_lost("backlog limit exceeded");
				return NULL;
			}
		}
	}

	ab = audit_buffer_alloc(ctx, gfp_mask, type);
	if (!ab) {
		audit_log_lost("out of memory in audit_log_start");
		return NULL;
	}

	audit_get_stamp(ab->ctx, &t, &serial);
	/* cancel dummy context to enable supporting records */
	if (ctx)
		ctx->dummy = 0;
	audit_log_format(ab, "audit(%llu.%03lu:%u): ",
			 (unsigned long long)t.tv_sec, t.tv_nsec/1000000, serial);

	return ab;
}
  • Hook 의 ctx -> audit_context -> audit_buffer

2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€

  • struct audit_buffer λ₯Ό 가지고 넷링크 톡신을 μœ„ν•œ sk_buff λ₯Ό λ§Œλ“€κ³ , audit_queue ν…ŒμΌμ— νμž‰ν•©λ‹ˆλ‹€.
/**
 * audit_log_end - end one audit record
 * @ab: the audit_buffer
 *
 * We can not do a netlink send inside an irq context because it blocks (last
 * arg, flags, is not set to MSG_DONTWAIT), so the audit buffer is placed on a
 * queue and a kthread is scheduled to remove them from the queue outside the
 * irq context.  May be called in any context.
 */
void audit_log_end(struct audit_buffer *ab)
{
	struct sk_buff *skb;
	struct nlmsghdr *nlh;

	if (!ab)
		return;

	if (audit_rate_check()) {
		skb = ab->skb;
		ab->skb = NULL;

		/* setup the netlink header, see the comments in
		 * kauditd_send_multicast_skb() for length quirks */
		nlh = nlmsg_hdr(skb);
		nlh->nlmsg_len = skb->len - NLMSG_HDRLEN;

		/* queue the netlink packet and poke the kauditd thread */
		skb_queue_tail(&audit_queue, skb);
		wake_up_interruptible(&kauditd_wait);
	} else
		audit_log_lost("rate limit exceeded");

	audit_buffer_free(ab);
}
  • queue the netlink packet and poke the kauditd thread

2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€

  • kthread μ—μ„œλŠ” irq context λ°–μ—μ„œ audit_queue μ²˜λ¦¬κ°€ κ°€λŠ₯ν•©λ‹ˆλ‹€!
    • audit buffer λŠ” audit_queue 에 λ“€μ–΄κ°€κ΅¬μš”.
    • ν”„λ‘œμ„ΈμŠ€ μ»¨ν…μŠ€νŠΈμ—μ„œ μ²˜λ¦¬ν•΄μ„œ 핸듀링이 μ‰¬μ›Œμ§€μ£ !
/**
 * kauditd_thread - Worker thread to send audit records to userspace
 * @dummy: unused
 */
static int kauditd_thread(void *dummy)
{
	int rc;
	u32 portid = 0;
	struct net *net = NULL;
	struct sock *sk = NULL;
	struct auditd_connection *ac;

#define UNICAST_RETRIES 5

	set_freezable();
	while (!kthread_should_stop()) {
		/* NOTE: see the lock comments in auditd_send_unicast_skb() */
		rcu_read_lock();
		ac = rcu_dereference(auditd_conn);
		if (!ac) {
			rcu_read_unlock();
			goto main_queue;
		}
		net = get_net(ac->net);
		sk = audit_get_sk(net);
		portid = ac->portid;
		rcu_read_unlock();

		/* attempt to flush the hold queue */
		rc = kauditd_send_queue(sk, portid,
					&audit_hold_queue, UNICAST_RETRIES,
					NULL, kauditd_rehold_skb);
		if (rc < 0) {
			sk = NULL;
			auditd_reset(ac);
			goto main_queue;
		}

		/* attempt to flush the retry queue */
		rc = kauditd_send_queue(sk, portid,
					&audit_retry_queue, UNICAST_RETRIES,
					NULL, kauditd_hold_skb);
		if (rc < 0) {
			sk = NULL;
			auditd_reset(ac);
			goto main_queue;
		}

main_queue:
		/* process the main queue - do the multicast send and attempt
		 * unicast, dump failed record sends to the retry queue; if
		 * sk == NULL due to previous failures we will just do the
		 * multicast send and move the record to the hold queue */
		rc = kauditd_send_queue(sk, portid, &audit_queue, 1,
					kauditd_send_multicast_skb,
					(sk ?
					 kauditd_retry_skb : kauditd_hold_skb));
		if (ac && rc < 0)
			auditd_reset(ac);
		sk = NULL;

		/* drop our netns reference, no auditd sends past this line */
		if (net) {
			put_net(net);
			net = NULL;
		}

		/* we have processed all the queues so wake everyone */
		wake_up(&audit_backlog_wait);

		/* NOTE: we want to wake up if there is anything on the queue,
		 *       regardless of if an auditd is connected, as we need to
		 *       do the multicast send and rotate records from the
		 *       main queue to the retry/hold queues */
		wait_event_freezable(kauditd_wait,
				     (skb_queue_len(&audit_queue) ? 1 : 0));
	}

	return 0;
}
  • netlink 기반 logger κ΅¬ν˜„ ν•œλ‹€λ©΄ μ°Έκ³ ν•  수 μžˆλŠ” 쒋은 μ½”λ“œλ„€μš”!

2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€

  • kauditd_thread() λ‚΄λΆ€μ—μ„œ λ³΄μ•˜λ˜, μœ μ € 슀페이슀둜 netlink μ†ŒμΌ“μœΌλ‘œ νŒ¨ν‚·μ„ μ „λ‹¬ν•˜λŠ” λΆ€λΆ„μž…λ‹ˆλ‹€!
/**
 * kauditd_send_queue - Helper for kauditd_thread to flush skb queues
 * @sk: the sending sock
 * @portid: the netlink destination
 * @queue: the skb queue to process
 * @retry_limit: limit on number of netlink unicast failures
 * @skb_hook: per-skb hook for additional processing
 * @err_hook: hook called if the skb fails the netlink unicast send
 *
 * Description:
 * Run through the given queue and attempt to send the audit records to auditd,
 * returns zero on success, negative values on failure.  It is up to the caller
 * to ensure that the @sk is valid for the duration of this function.
 *
 */
static int kauditd_send_queue(struct sock *sk, u32 portid,
			      struct sk_buff_head *queue,
			      unsigned int retry_limit,
			      void (*skb_hook)(struct sk_buff *skb),
			      void (*err_hook)(struct sk_buff *skb, int error))
{
	int rc = 0;
	struct sk_buff *skb = NULL;
	struct sk_buff *skb_tail;
	unsigned int failed = 0;

	/* NOTE: kauditd_thread takes care of all our locking, we just use
	 *       the netlink info passed to us (e.g. sk and portid) */

	skb_tail = skb_peek_tail(queue);
	while ((skb != skb_tail) && (skb = skb_dequeue(queue))) {
		/* call the skb_hook for each skb we touch */
		if (skb_hook)
			(*skb_hook)(skb);

		/* can we send to anyone via unicast? */
		if (!sk) {
			if (err_hook)
				(*err_hook)(skb, -ECONNREFUSED);
			continue;
		}

retry:
		/* grab an extra skb reference in case of error */
		skb_get(skb);
		rc = netlink_unicast(sk, skb, portid, 0);
		if (rc < 0) {
			/* send failed - try a few times unless fatal error */
			if (++failed >= retry_limit ||
			    rc == -ECONNREFUSED || rc == -EPERM) {
				sk = NULL;
				if (err_hook)
					(*err_hook)(skb, rc);
				if (rc == -EAGAIN)
					rc = 0;
				/* continue to drain the queue */
				continue;
			} else
				goto retry;
		} else {
			/* skb sent - drop the extra reference and continue */
			consume_skb(skb);
			failed = 0;
		}
	}

	return (rc >= 0 ? 0 : rc);
}
  • νμž‰ν•œ audit_queue μ—μ„œ skb λ₯Ό get ν•˜κ³ , 이λ₯Ό netlink 둜 μ „λ‹¬ν•©λ‹ˆλ‹€.

2.2. audit.log λ‘œκ·Έμ— μ°νžˆκΈ°κΉŒμ§€

  • struct audit_context 멀버λ₯Ό 슬쩍 λ³ΌκΉŒμš”! μžμ„Έν•œ μ„€λͺ…은 μƒλž΅!
/* The per-task audit context. */
struct audit_context {
	int		    dummy;	/* must be the first element */
	enum {
		AUDIT_CTX_UNUSED,	/* audit_context is currently unused */
		AUDIT_CTX_SYSCALL,	/* in use by syscall */
		AUDIT_CTX_URING,	/* in use by io_uring */
	} context;
	enum audit_state    state, current_state;
	unsigned int	    serial;     /* serial number for record */
	int		    major;      /* syscall number */
	int		    uring_op;   /* uring operation */
	struct timespec64   ctime;      /* time of syscall entry */
	unsigned long	    argv[4];    /* syscall arguments */
	long		    return_code;/* syscall return code */
	u64		    prio;
	int		    return_valid; /* return code is valid */
	/*
	 * The names_list is the list of all audit_names collected during this
	 * syscall.  The first AUDIT_NAMES entries in the names_list will
	 * actually be from the preallocated_names array for performance
	 * reasons.  Except during allocation they should never be referenced
	 * through the preallocated_names array and should only be found/used
	 * by running the names_list.
	 */
	struct audit_names  preallocated_names[AUDIT_NAMES];
	int		    name_count; /* total records in names_list */
	struct list_head    names_list;	/* struct audit_names->list anchor */
	char		    *filterkey;	/* key for rule that triggered record */
	struct path	    pwd;
	struct audit_aux_data *aux;
	struct audit_aux_data *aux_pids;
	struct sockaddr_storage *sockaddr;
	size_t sockaddr_len;
				/* Save things to print about task_struct */
	pid_t		    pid, ppid;
	kuid_t		    uid, euid, suid, fsuid;
	kgid_t		    gid, egid, sgid, fsgid;
	unsigned long	    personality;
	int		    arch;

	pid_t		    target_pid;
	kuid_t		    target_auid;
	kuid_t		    target_uid;
	unsigned int	    target_sessionid;
	u32		    target_sid;
	char		    target_comm[TASK_COMM_LEN];

	struct audit_tree_refs *trees, *first_trees;
	struct list_head killed_trees;
	int tree_count;

	int type;
	union {
		struct {
			int nargs;
			long args[6];
		} socketcall;
		struct {
			kuid_t			uid;
			kgid_t			gid;
			umode_t			mode;
			u32			osid;
			int			has_perm;
			uid_t			perm_uid;
			gid_t			perm_gid;
			umode_t			perm_mode;
			unsigned long		qbytes;
		} ipc;
		struct {
			mqd_t			mqdes;
			struct mq_attr		mqstat;
		} mq_getsetattr;
		struct {
			mqd_t			mqdes;
			int			sigev_signo;
		} mq_notify;
		struct {
			mqd_t			mqdes;
			size_t			msg_len;
			unsigned int		msg_prio;
			struct timespec64	abs_timeout;
		} mq_sendrecv;
		struct {
			int			oflag;
			umode_t			mode;
			struct mq_attr		attr;
		} mq_open;
		struct {
			pid_t			pid;
			struct audit_cap_data	cap;
		} capset;
		struct {
			int			fd;
			int			flags;
		} mmap;
		struct open_how openat2;
		struct {
			int			argc;
		} execve;
		struct {
			char			*name;
		} module;
		struct {
			struct audit_ntp_data	ntp_data;
			struct timespec64	tk_injoffset;
		} time;
	};
	int fds[2];
	struct audit_proctitle proctitle;
};
  • The per-task audit context.
static inline void audit_set_context(struct task_struct *task, struct audit_context *ctx)
{
	task->audit_context = ctx;
}

static inline struct audit_context *audit_context(void)
{
	return current->audit_context;
}

– task_struct 에 audit_context 멀버가 μžˆμŠ΅λ‹ˆλ‹€.

2.3. audit rule 을 μ–΄λ–»κ²Œ λ‘œλ“œν• κΉŒ?

  • μœ μ € 슀페이슀 : auditd
int audit_add_rule_data(int fd, struct audit_rule_data *rule,
                        int flags, int action)
{
	int rc;

	rule->flags  = flags;
	rule->action = action;
	rc = audit_send(fd, AUDIT_ADD_RULE, rule,
			sizeof(struct audit_rule_data) + rule->buflen);

2.3. audit rule 을 μ–΄λ–»κ²Œ λ‘œλ“œν• κΉŒ?

  • 컀널 슀페이슀 : kaduditd
/**
 * audit_receive - receive messages from a netlink control socket
 * @skb: the message buffer
 *
 * Parse the provided skb and deal with any messages that may be present,
 * malformed skbs are discarded.
 */
static void audit_receive(struct sk_buff  *skb)
{
	struct nlmsghdr *nlh;
	/*
	 * len MUST be signed for nlmsg_next to be able to dec it below 0
	 * if the nlmsg_len was not aligned
	 */
	int len;
	int err;

	nlh = nlmsg_hdr(skb);
	len = skb->len;

	audit_ctl_lock();
	while (nlmsg_ok(nlh, len)) {
		err = audit_receive_msg(skb, nlh);
  • 룰은 μœ„μ˜ λ‘œμ§μ„ ν†΅ν•΄μ„œ μœ μ €μ—μ„œ μ»€λ„λ‘œ μ˜¬λΌμ˜΄μ„ ν™•μΈν•©λ‹ˆλ‹€!

2. μœ μ € 슀페이슀 auditd μ½€ν¬λ„ŒνŠΈ 뢄석!

  • auditd 의 μ€‘μš”ν•œ 뢀뢄을 콕 찍먹해볼 μ‹œκ°„μž…λ‹ˆλ‹€.

2.1. auditd μ–Έμ œ μ–΄λ–»κ²Œ μ΄ˆκΈ°ν™” ν• κΉŒμš”?


	/* Load the Configuration File */
	if (load_config(&config, TEST_AUDITD))

	/* Init netlink */
	if ((fd = audit_open())

	// Init complete, start event loop
	if (!stop)
		ev_loop (loop, 0);

int audit_open(void)
{
	int fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_AUDIT);

2.2. 감사 정책을 μ–΄λ–»κ²Œ λ‘œλ“œν• κΉŒμš”?

auditd 데λͺ¬μ„ 직접 λ§Œλ“€μ–΄λ³ΌκΉŒμš”? libaudit + auditd λ‚΄λΆ€μ—μ„œλ„ μ‚¬μš©ν•˜λŠ” libev 둜~

#include <stdio.h>
#include <unistd.h>

#include <libaudit.h>

#include <ev.h>

static int fd;

void monitoring(struct ev_loop *loop, struct ev_io *io, int revents) {
    struct audit_reply reply;

    audit_get_reply(fd, &reply, GET_REPLY_NONBLOCKING, 0);

    if (reply.type != AUDIT_EOE &&
            reply.type != AUDIT_PROCTITLE &&
            reply.type != AUDIT_PATH) {
        printf("Event: Type=%s Message=%.*s\n",
                     audit_msg_type_to_name(reply.type),
                     reply.len,
                     reply.message);
    }
}

int main() {
    fd = audit_open();
    struct audit_rule_data* rule = new audit_rule_data();

    // 디렉토리에 λŒ€ν•œ κ°μ‹œλŠ” λ‹€μŒκ³Ό 같은 API λ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€.
    //  audit_add_watch_dir(AUDIT_DIR, &rule, "bitcoin");

    audit_add_watch(&rule, "bitcoin/wallet.dat");

    // μ…‹μ—…ν•œ 룰을 auditd 에 λ„˜κ²¨μ€λ‹ˆλ‹€.
    audit_add_rule_data(fd, rule, AUDIT_FILTER_USER, AUDIT_ALWAYS);
    struct ev_io monitor;
    audit_set_pid(fd, getpid(), WAIT_YES);

    audit_set_enabled(fd, 1);
    struct ev_loop *loop = ev_default_loop(EVFLAG_NOENV);

    ev_io_init(&monitor, monitoring, fd, EV_READ);
    ev_io_start(loop, &monitor);

    // wallet.dat νŒŒμΌμ— μ΄λ²€νŠΈκ°€ μ˜€λŠ”μ§€ ν™•μΈν•˜λ©΄μ„œ κ°μ‹œν•©λ‹ˆλ‹€.
    ev_loop(loop, 0);

    audit_close(fd);
    return 0;
}

μ£Όμš” 릴리즈 λ³€κ²½

2020-12-17 audit 3.0 λ¦΄λ¦¬μ¦ˆλΆ€ν„°λŠ” κΈ°μ‘΄ audispd 이벀트 λ””μŠ€νŒ¨μ³ 데λͺ¬μ„ auditd 둜 ν†΅ν•©ν–ˆμŠ΅λ‹ˆλ‹€.

This is the long awaited 3.0 major feature release. Most notable item is that audispd is gone.

  • Merge auditd and audispd code
  • Move all audispd config files under /etc/audit/
  • Move audispd.conf settings into auditd.conf

TODO

Future roadmap (subject to change):
===================================
3.1
* Basic HIDS based on reactive audit component
* Multi-thread audisp-remote
* Add keywords for time: month-ago, this-hour, last-hour
* If searching user/group doesn't map to uid/gid, do translated string search
* In auditd, look into non-blocking handling of write to plugins
* Support multiple time streams when searching

3.2
* Container support
* Support TLS PSK as remote logging transport
* Add rule verify to detect mismatch between in-kernel and on-disk rules
* audisp-remote, add config to say what home network is so 
  laptops don't try if their not on a network that can reach the server.
* Fix audit.pc.in to use Requires.private
* Change ausearch to output name="" unless its a real null.
  (mount) ausearch-report.c, 523. FIXME
* Fix SIGHUP for auditd network settings
* Add ability to filter events in auditd

πŸ€—

μ΄μƒμž…λ‹ˆλ‹€. ^^7 κ³ μƒν•˜μ…¨μŠ΅λ‹ˆλ‹€!

μ°Έκ³ 

misc(audit package)

# rpm -ql audit
/etc/audit
/etc/audit/audit-stop.rules
/etc/audit/audit.rules
/etc/audit/auditd.conf
/etc/audit/plugins.d
/etc/audit/plugins.d/af_unix.conf
/etc/audit/rules.d
/etc/audit/rules.d/audit.rules
/usr/bin/aulast
/usr/bin/aulastlog
/usr/bin/ausyscall
/usr/bin/auvirt
/usr/lib/.build-id
/usr/lib/.build-id/0a
/usr/lib/.build-id/0a/54a2aeda2ce2f0cc9c789ab94afde974ea3ddf
/usr/lib/.build-id/15
/usr/lib/.build-id/15/be5ccbbd0ba37fea823d161d849a3d48671c64
/usr/lib/.build-id/2d
/usr/lib/.build-id/2d/733d5160c5a1ef08df0c709fb7436df2e3a548
/usr/lib/.build-id/3f
/usr/lib/.build-id/3f/bf084e6e5e599ac11ef7055de93519681e0d78
/usr/lib/.build-id/4a
/usr/lib/.build-id/4a/0842df3b270ee02070f848d05b8c6a456f7e64
/usr/lib/.build-id/4b
/usr/lib/.build-id/4b/f99725734e3834085ca9078cf97988a5d63ded
/usr/lib/.build-id/57
/usr/lib/.build-id/57/32c733d13c22aa5737b7ca085ec59191ef385e
/usr/lib/.build-id/cb
/usr/lib/.build-id/cb/4d2ae2ccacd7d5bcd9629242ab76b0e780988a
/usr/lib/.build-id/d7
/usr/lib/.build-id/d7/58719c24909e850832714a422496ddb894b08a
/usr/lib/systemd/system/auditd.service
/usr/libexec/audit-functions
/usr/libexec/initscripts/legacy-actions/auditd
/usr/libexec/initscripts/legacy-actions/auditd/condrestart
/usr/libexec/initscripts/legacy-actions/auditd/reload
/usr/libexec/initscripts/legacy-actions/auditd/restart
/usr/libexec/initscripts/legacy-actions/auditd/resume
/usr/libexec/initscripts/legacy-actions/auditd/rotate
/usr/libexec/initscripts/legacy-actions/auditd/state
/usr/libexec/initscripts/legacy-actions/auditd/stop
/usr/sbin/auditctl
/usr/sbin/auditd
/usr/sbin/augenrules
/usr/sbin/aureport
/usr/sbin/ausearch
/usr/sbin/autrace
/usr/share/audit
/usr/share/audit/sample-rules
/usr/share/audit/sample-rules/10-base-config.rules
/usr/share/audit/sample-rules/10-no-audit.rules
/usr/share/audit/sample-rules/11-loginuid.rules
/usr/share/audit/sample-rules/12-cont-fail.rules
/usr/share/audit/sample-rules/12-ignore-error.rules
/usr/share/audit/sample-rules/20-dont-audit.rules
/usr/share/audit/sample-rules/21-no32bit.rules
/usr/share/audit/sample-rules/22-ignore-chrony.rules
/usr/share/audit/sample-rules/23-ignore-filesystems.rules
/usr/share/audit/sample-rules/30-nispom.rules
/usr/share/audit/sample-rules/30-ospp-v42-1-create-failed.rules
/usr/share/audit/sample-rules/30-ospp-v42-1-create-success.rules
/usr/share/audit/sample-rules/30-ospp-v42-2-modify-failed.rules
/usr/share/audit/sample-rules/30-ospp-v42-2-modify-success.rules
/usr/share/audit/sample-rules/30-ospp-v42-3-access-failed.rules
/usr/share/audit/sample-rules/30-ospp-v42-3-access-success.rules
/usr/share/audit/sample-rules/30-ospp-v42-4-delete-failed.rules
/usr/share/audit/sample-rules/30-ospp-v42-4-delete-success.rules
/usr/share/audit/sample-rules/30-ospp-v42-5-perm-change-failed.rules
/usr/share/audit/sample-rules/30-ospp-v42-5-perm-change-success.rules
/usr/share/audit/sample-rules/30-ospp-v42-6-owner-change-failed.rules
/usr/share/audit/sample-rules/30-ospp-v42-6-owner-change-success.rules
/usr/share/audit/sample-rules/30-ospp-v42.rules
/usr/share/audit/sample-rules/30-pci-dss-v31.rules
/usr/share/audit/sample-rules/30-stig.rules
/usr/share/audit/sample-rules/31-privileged.rules
/usr/share/audit/sample-rules/32-power-abuse.rules
/usr/share/audit/sample-rules/40-local.rules
/usr/share/audit/sample-rules/41-containers.rules
/usr/share/audit/sample-rules/42-injection.rules
/usr/share/audit/sample-rules/43-module-load.rules
/usr/share/audit/sample-rules/44-installers.rules
/usr/share/audit/sample-rules/70-einval.rules
/usr/share/audit/sample-rules/71-networking.rules
/usr/share/audit/sample-rules/99-finalize.rules
/usr/share/audit/sample-rules/README-rules
/usr/share/doc/audit
/usr/share/doc/audit/ChangeLog
/usr/share/doc/audit/README
/usr/share/doc/audit/auditd.cron
/usr/share/licenses/audit
/usr/share/licenses/audit/COPYING
/usr/share/man/man5/auditd-plugins.5.gz
/usr/share/man/man5/auditd.conf.5.gz
/usr/share/man/man5/ausearch-expression.5.gz
/usr/share/man/man7/audit.rules.7.gz
/usr/share/man/man8/auditctl.8.gz
/usr/share/man/man8/auditd.8.gz
/usr/share/man/man8/augenrules.8.gz
/usr/share/man/man8/aulast.8.gz
/usr/share/man/man8/aulastlog.8.gz
/usr/share/man/man8/aureport.8.gz
/usr/share/man/man8/ausearch.8.gz
/usr/share/man/man8/ausyscall.8.gz
/usr/share/man/man8/autrace.8.gz
/usr/share/man/man8/auvirt.8.gz
/var/log/audit
/var/run/auditd.state

misc(audit package)

# dnf search audit
λ§ˆμ§€λ§‰ λ©”νƒ€μžλ£Œ λ§Œλ£Œν™•μΈ 0:04:14 이전인: 2022λ…„ 09μ›” 28일 (수) μ˜€μ „ 03μ‹œ 03λΆ„ 55초.
=========================== 이름 & μš”μ•½κ³Ό μΌμΉ˜ν•˜λŠ” ν•­λͺ©: audit ============================
audit.x86_64 : User space tools for kernel auditing
audit.src : User space tools for kernel auditing
audit-debuginfo.i686 : Debug information for package audit
audit-debuginfo.x86_64 : Debug information for package audit
audit-debugsource.i686 : Debug sources for package audit
audit-debugsource.x86_64 : Debug sources for package audit
audit-libs.x86_64 : Dynamic library for libaudit
audit-libs.i686 : Dynamic library for libaudit
audit-libs-debuginfo.i686 : Debug information for package audit-libs
audit-libs-debuginfo.x86_64 : Debug information for package audit-libs
audit-libs-devel.i686 : Header files for libaudit
audit-libs-devel.x86_64 : Header files for libaudit
pgaudit-debuginfo.x86_64 : Debug information for package pgaudit
pgaudit-debugsource.x86_64 : Debug sources for package pgaudit
python3-audit.x86_64 : Python3 bindings for libaudit
python3-audit-debuginfo.i686 : Debug information for package python3-audit
python3-audit-debuginfo.x86_64 : Debug information for package python3-audit
rsyslog-mmaudit.x86_64 : Message modification module supporting Linux audit format
rsyslog-mmaudit-debuginfo.x86_64 : Debug information for package rsyslog-mmaudit
sos-audit.noarch : Audit use of some commands for support purposes
=============================== μš”μ•½κ³Ό μΌμΉ˜ν•˜λŠ” ν•­λͺ©: audit ===============================

μœ μ € UID λ₯Ό ν†΅ν•œ 확인 방법

# ausearch -ui $UID --interpret
----
type=DAEMON_START msg=audit(2022λ…„ 09μ›” 28일 01:42:53.647:2054) : op=start ver=3.0.7 format=enriched kernel=4.18.0-394.el8.x86_64 auid=unset pid=1014 uid=root ses=unset subj=system_u:system_r:auditd_t:s0 res=success 
----
type=SERVICE_START msg=audit(2022λ…„ 09μ›” 28일 01:42:53.666:5) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='unit=rpcbind comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=PROCTITLE msg=audit(2022λ…„ 09μ›” 28일 01:42:53.714:6) : proctitle=/sbin/auditctl -R /etc/audit/audit.rules 
type=SYSCALL msg=audit(2022λ…„ 09μ›” 28일 01:42:53.714:6) : arch=x86_64 syscall=sendto success=yes exit=60 a0=0x3 a1=0x7ffde2d79a90 a2=0x3c a3=0x0 items=0 ppid=1019 pid=1033 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=auditctl exe=/usr/sbin/auditctl subj=system_u:system_r:unconfined_service_t:s0 key=(null) 
type=CONFIG_CHANGE msg=audit(2022λ…„ 09μ›” 28일 01:42:53.714:6) : op=set audit_backlog_limit=8192 old=64 auid=unset ses=unset subj=system_u:system_r:unconfined_service_t:s0 res=yes 
----
type=PROCTITLE msg=audit(2022λ…„ 09μ›” 28일 01:42:53.731:7) : proctitle=/sbin/auditctl -R /etc/audit/audit.rules 
type=SYSCALL msg=audit(2022λ…„ 09μ›” 28일 01:42:53.731:7) : arch=x86_64 syscall=sendto success=yes exit=60 a0=0x3 a1=0x7ffde2d79a90 a2=0x3c a3=0x0 items=0 ppid=1019 pid=1033 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=auditctl exe=/usr/sbin/auditctl subj=system_u:system_r:unconfined_service_t:s0 key=(null) 
type=CONFIG_CHANGE msg=audit(2022λ…„ 09μ›” 28일 01:42:53.731:7) : op=set audit_failure=1 old=1 auid=unset ses=unset subj=system_u:system_r:unconfined_service_t:s0 res=yes 
----
type=PROCTITLE msg=audit(2022λ…„ 09μ›” 28일 01:42:53.734:8) : proctitle=/sbin/auditctl -R /etc/audit/audit.rules 
type=SYSCALL msg=audit(2022λ…„ 09μ›” 28일 01:42:53.734:8) : arch=x86_64 syscall=sendto success=yes exit=60 a0=0x3 a1=0x7ffde2d79a90 a2=0x3c a3=0x0 items=0 ppid=1019 pid=1033 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=auditctl exe=/usr/sbin/auditctl subj=system_u:system_r:unconfined_service_t:s0 key=(null) 
type=CONFIG_CHANGE msg=audit(2022λ…„ 09μ›” 28일 01:42:53.734:8) : op=set audit_backlog_wait_time=60000 old=60000 auid=unset ses=unset subj=system_u:system_r:unconfined_service_t:s0 res=yes 
----
type=SERVICE_START msg=audit(2022λ…„ 09μ›” 28일 01:42:53.755:9) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='unit=auditd comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=SYSTEM_BOOT msg=audit(2022λ…„ 09μ›” 28일 01:42:53.767:10) : pid=1040 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg=' comm=systemd-update-utmp exe=/usr/lib/systemd/systemd-update-utmp hostname=? addr=? terminal=? res=success' 
----
type=SERVICE_START msg=audit(2022λ…„ 09μ›” 28일 01:42:53.771:11) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='unit=systemd-update-utmp comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=SERVICE_START msg=audit(2022λ…„ 09μ›” 28일 01:42:54.173:12) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='unit=ldconfig comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=SERVICE_START msg=audit(2022λ…„ 09μ›” 28일 01:42:54.205:13) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='unit=systemd-update-done comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=SERVICE_START msg=audit(2022λ…„ 09μ›” 28일 01:42:54.216:14) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='unit=irqbalance comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=PROCTITLE msg=audit(2022λ…„ 09μ›” 28일 01:42:56.750:76) : proctitle=/usr/sbin/ebtables-restore --noflush 
type=SYSCALL msg=audit(2022λ…„ 09μ›” 28일 01:42:56.750:76) : arch=x86_64 syscall=sendmsg success=yes exit=884 a0=0x3 a1=0x7ffec5f3a630 a2=0x0 a3=0x7ffec5f3a61c items=0 ppid=1157 pid=1518 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=ebtables-restor exe=/usr/sbin/xtables-nft-multi subj=system_u:system_r:iptables_t:s0 key=(null) 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 01:42:56.750:76) : table=nat:29 family=bridge entries=3 op=nft_register_chain pid=1518 subj=system_u:system_r:iptables_t:s0 comm=ebtables-restor 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 01:42:56.750:76) : table=filter:29 family=bridge entries=3 op=nft_register_chain pid=1518 subj=system_u:system_r:iptables_t:s0 comm=ebtables-restor 
----
type=PROCTITLE msg=audit(2022λ…„ 09μ›” 28일 01:42:56.755:77) : proctitle=/usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid 
type=SYSCALL msg=audit(2022λ…„ 09μ›” 28일 01:42:56.755:77) : arch=x86_64 syscall=sendmsg success=yes exit=172 a0=0x6 a1=0x7ffc55c4ce60 a2=0x0 a3=0x7ffc55c4bdac items=0 ppid=1 pid=1157 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=firewalld exe=/usr/libexec/platform-python3.6 subj=system_u:system_r:firewalld_t:s0 key=(null) 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 01:42:56.755:77) : table=firewalld:30 family=inet entries=1 op=nft_register_table pid=1157 subj=system_u:system_r:firewalld_t:s0 comm=firewalld 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 01:42:56.755:77) : table=firewalld:30 family=ipv4 entries=1 op=nft_register_table pid=1157 subj=system_u:system_r:firewalld_t:s0 comm=firewalld 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 01:42:56.755:77) : table=firewalld:30 family=ipv6 entries=1 op=nft_register_table pid=1157 subj=system_u:system_r:firewalld_t:s0 comm=firewalld 
----
type=PROCTITLE msg=audit(2022λ…„ 09μ›” 28일 01:42:56.798:79) : proctitle=/usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid 
type=SYSCALL msg=audit(2022λ…„ 09μ›” 28일 01:42:56.798:79) : arch=x86_64 syscall=sendmsg success=yes exit=32792 a0=0x6 a1=0x7ffc55c4ce60 a2=0x0 a3=0x7ffc55c4bdac items=0 ppid=1 pid=1157 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=firewalld exe=/usr/libexec/platform-python3.6 subj=system_u:system_r:firewalld_t:s0 key=(null) 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 01:42:56.798:79) : table=firewalld:31 family=inet entries=199 op=nft_register_chain pid=1157 subj=system_u:system_r:firewalld_t:s0 comm=firewalld 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 01:42:56.798:79) : table=firewalld:31 family=ipv4 entries=54 op=nft_register_chain pid=1157 subj=system_u:system_r:firewalld_t:s0 comm=firewalld 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 01:42:56.798:79) : table=firewalld:31 family=ipv6 entries=54 op=nft_register_chain pid=1157 subj=system_u:system_r:firewalld_t:s0 comm=firewalld 
----
type=SERVICE_START msg=audit(2022λ…„ 09μ›” 28일 01:42:56.871:78) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='unit=libvirtd comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=PROCTITLE msg=audit(2022λ…„ 09μ›” 28일 01:42:57.255:80) : proctitle=/usr/sbin/iptables -w --table filter --new-chain LIBVIRT_INP 
type=SYSCALL msg=audit(2022λ…„ 09μ›” 28일 01:42:57.255:80) : arch=x86_64 syscall=sendmsg success=yes exit=128 a0=0x3 a1=0x7fffa8301bc0 a2=0x0 a3=0x7fffa8301bac items=0 ppid=1376 pid=1806 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=iptables exe=/usr/sbin/xtables-nft-multi subj=system_u:system_r:iptables_t:s0-s0:c0.c1023 key=(null) 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 01:42:57.255:80) : table=filter:35 family=ipv4 entries=1 op=nft_register_chain pid=1806 subj=system_u:system_r:iptables_t:s0-s0:c0.c1023 comm=iptables 
----
type=PROCTITLE msg=audit(2022λ…„ 09μ›” 28일 02:01:28.674:193) : proctitle=/usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid 
type=SYSCALL msg=audit(2022λ…„ 09μ›” 28일 02:01:28.674:193) : arch=x86_64 syscall=sendmsg success=yes exit=1880 a0=0x6 a1=0x7ffc55c4c400 a2=0x0 a3=0x7ffc55c4b34c items=0 ppid=1 pid=1157 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=firewalld exe=/usr/libexec/platform-python3.6 subj=system_u:system_r:firewalld_t:s0 key=(null) 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 02:01:28.674:193) : table=firewalld:86 family=inet entries=4 op=nft_register_rule pid=1157 subj=system_u:system_r:firewalld_t:s0 comm=firewalld 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 02:01:28.674:193) : table=firewalld:86 family=ipv4 entries=2 op=nft_register_rule pid=1157 subj=system_u:system_r:firewalld_t:s0 comm=firewalld 
type=NETFILTER_CFG msg=audit(2022λ…„ 09μ›” 28일 02:01:28.674:193) : table=firewalld:86 family=ipv6 entries=2 op=nft_register_rule pid=1157 subj=system_u:system_r:firewalld_t:s0 comm=firewalld 
----
type=SYSTEM_RUNLEVEL msg=audit(2022λ…„ 09μ›” 28일 02:57:59.212:146) : pid=2373 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='old-level=N new-level=5 comm=systemd-update-utmp exe=/usr/lib/systemd/systemd-update-utmp hostname=? addr=? terminal=? res=success' 
----
type=SERVICE_START msg=audit(2022λ…„ 09μ›” 28일 02:57:59.214:147) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='unit=systemd-update-utmp-runlevel comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=SERVICE_STOP msg=audit(2022λ…„ 09μ›” 28일 02:57:59.214:148) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='unit=systemd-update-utmp-runlevel comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=USER_AUTH msg=audit(2022λ…„ 09μ›” 28일 02:58:04.001:149) : pid=2375 uid=root auid=unset ses=unset subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:authentication grantors=pam_usertype,pam_localuser,pam_unix,pam_gnome_keyring acct=ahnlab exe=/usr/libexec/gdm-session-worker hostname=localhost.localdomain addr=? terminal=/dev/tty1 res=success' 
----
type=USER_ACCT msg=audit(2022λ…„ 09μ›” 28일 02:58:04.006:150) : pid=2375 uid=root auid=unset ses=unset subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct=ahnlab exe=/usr/libexec/gdm-session-worker hostname=localhost.localdomain addr=? terminal=/dev/tty1 res=success' 
----
type=CRED_ACQ msg=audit(2022λ…„ 09μ›” 28일 02:58:04.011:151) : pid=2375 uid=root auid=unset ses=unset subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_localuser,pam_unix,pam_gnome_keyring acct=ahnlab exe=/usr/libexec/gdm-session-worker hostname=localhost.localdomain addr=? terminal=/dev/tty1 res=success' 
----
type=LOGIN msg=audit(2022λ…„ 09μ›” 28일 02:58:04.018:152) : pid=2375 uid=root subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 old-auid=unset auid=ahnlab tty=(none) old-ses=4294967295 ses=2 res=yes 
----
type=PROCTITLE msg=audit(2022λ…„ 09μ›” 28일 02:58:04.018:152) : proctitle=gdm-session-worker [pam/gdm-password] 
type=SYSCALL msg=audit(2022λ…„ 09μ›” 28일 02:58:04.018:152) : arch=x86_64 syscall=write success=yes exit=4 a0=0xa a1=0x7ffe1f2a26c0 a2=0x4 a3=0x0 items=0 ppid=1238 pid=2375 auid=ahnlab uid=root gid=ahnlab euid=root suid=root fsuid=root egid=ahnlab sgid=ahnlab fsgid=ahnlab tty=(none) ses=2 comm=gdm-session-wor exe=/usr/libexec/gdm-session-worker subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 key=(null) 
----
type=USER_ROLE_CHANGE msg=audit(2022λ…„ 09μ›” 28일 02:58:04.031:153) : pid=2375 uid=root auid=ahnlab ses=2 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='pam: default-context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 selected-context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 exe=/usr/libexec/gdm-session-worker hostname=localhost.localdomain addr=? terminal=/dev/tty2 res=success' 
----
type=SERVICE_START msg=audit(2022λ…„ 09μ›” 28일 02:58:04.063:154) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='unit=user-runtime-dir@1000 comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=USER_ACCT msg=audit(2022λ…„ 09μ›” 28일 02:58:04.084:155) : pid=2387 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='op=PAM:accounting grantors=pam_unix acct=ahnlab exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=USER_ROLE_CHANGE msg=audit(2022λ…„ 09μ›” 28일 02:58:04.084:156) : pid=2387 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='pam: default-context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 selected-context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success' 
----
type=USER_LOGIN msg=audit(2022λ…„ 09μ›” 28일 05:35:46.992:299) : pid=7789 uid=root auid=ahnlab ses=5 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=login id=ahnlab exe=/usr/sbin/sshd hostname=? addr=192.168.66.1 terminal=ssh res=success' 
----
type=USER_START msg=audit(2022λ…„ 09μ›” 28일 05:35:46.992:300) : pid=7789 uid=root auid=ahnlab ses=5 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=login id=ahnlab exe=/usr/sbin/sshd hostname=? addr=192.168.66.1 terminal=ssh res=success' 
----
type=CRYPTO_KEY_USER msg=audit(2022λ…„ 09μ›” 28일 05:35:47.006:301) : pid=7789 uid=root auid=ahnlab ses=5 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=destroy kind=server fp=SHA256:3b:04:1b:5b:09:fb:ec:42:8b:65:f7:08:59:1f:6d:40:16:2a:c1:71:2b:4d:e8:5f:c1:bf:4e:ae:6b:b3:af:a8 direction=? spid=7797 suid=ahnlab  exe=/usr/sbin/sshd hostname=? addr=? terminal=? res=success' 
----
type=CRYPTO_KEY_USER msg=audit(2022λ…„ 09μ›” 28일 05:35:47.334:302) : pid=7789 uid=root auid=ahnlab ses=5 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=destroy kind=session fp=? direction=both spid=7794 suid=ahnlab rport=54041 laddr=192.168.66.130 lport=22  exe=/usr/sbin/sshd hostname=? addr=192.168.66.1 terminal=? res=success' 
----
type=CRYPTO_KEY_USER msg=audit(2022λ…„ 09μ›” 28일 05:35:47.339:303) : pid=7789 uid=root auid=ahnlab ses=5 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=destroy kind=server fp=SHA256:3b:04:1b:5b:09:fb:ec:42:8b:65:f7:08:59:1f:6d:40:16:2a:c1:71:2b:4d:e8:5f:c1:bf:4e:ae:6b:b3:af:a8 direction=? spid=7794 suid=ahnlab  exe=/usr/sbin/sshd hostname=? addr=? terminal=? res=success' 
----
type=USER_END msg=audit(2022λ…„ 09μ›” 28일 05:35:47.351:304) : pid=7789 uid=root auid=ahnlab ses=5 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_selinux,pam_loginuid,pam_selinux,pam_namespace,pam_keyinit,pam_keyinit,pam_limits,pam_systemd,pam_unix,pam_umask,pam_lastlog acct=ahnlab exe=/usr/sbin/sshd hostname=192.168.66.1 addr=192.168.66.1 terminal=ssh res=success' 
----
type=CRED_DISP msg=audit(2022λ…„ 09μ›” 28일 05:35:47.352:305) : pid=7789 uid=root auid=ahnlab ses=5 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_localuser,pam_unix acct=ahnlab exe=/usr/sbin/sshd hostname=192.168.66.1 addr=192.168.66.1 terminal=ssh res=success' 
----
type=USER_END msg=audit(2022λ…„ 09μ›” 28일 05:35:47.358:306) : pid=7789 uid=root auid=ahnlab ses=5 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=login id=ahnlab exe=/usr/sbin/sshd hostname=? addr=192.168.66.1 terminal=ssh res=success' 
----
type=USER_LOGOUT msg=audit(2022λ…„ 09μ›” 28일 05:35:47.359:307) : pid=7789 uid=root auid=ahnlab ses=5 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=login id=ahnlab exe=/usr/sbin/sshd hostname=? addr=192.168.66.1 terminal=ssh res=success'