linux redhat7.6 audit審計服務產生文件解壓、複製等速度慢的問題

linux audit 審計服務

以下內容參考此鏈接:http://note.tc.edu.tw/601.html
auditd是linux的一個審計服務。
這是man下的解釋:audit is the userspace component to the Linux Auditing System. It’s responsible for writing audit records to the disk. Viewing the logs is done with the ausearch or aureport utilities. Configuring the audit rules is done with the auditctl utility. During startup, the rules in /etc/audit/audit.rules are read by auditctl. The audit daemon itself has some configuration options that the admin may wish to customize.They are found in the auditd.conf file.
安全審計包含了兩個部分,其一是:audit審計服務,其二是:syslog日誌系統。
他們的關係如下:
audit服務專門用來記錄安全信息,用於對系統安全事件的追溯;
syslog日誌系統用來記錄系統中的各種信息,如安全、調試、運行信息等;
如果audit服務沒有運行,linux內核就會將安全審計信息傳遞給syslog日誌系統。
syslog會記錄系統狀態、如硬件的警告和應用軟件的記錄等。但是syslog屬於應用層,且僅止於此一應用而已,沒辦法記錄太多的資訊。因此,audit誕生以取代syslog的責任,來記錄核心層的時間:檔案的讀寫,系統呼叫,權限的狀態等。
audit daemon運作和一般的deamon一樣,運行後會引入selinux的系統。

audit的三個操作工具

audit可用的三個指令:

  1. auditctl 控制kernel audit system,能取得狀態,增加或者刪除rules、設定某個檔案的[檢視]watch.
  2. ausearch 用來查詢audit logs 的工具。
  3. aureport 產生audit系統簡報的工具。
    配置文件
    audit的配置文件爲/etc/audit/audit.rules主要分爲三種類別:
    ·basic audit system parameters
    ·file and directory watches
    ·system call audits
    #basic audit system parameters:這個是一些audit的整體全局參數設置
    #file and directory watches:這個是目錄權限的設置以及是否可以查看某個目錄或者文件
    #system call audits:這個是用來系統調用的規則配置
    對於配置文件有幾點要說明一下:
    1.目錄觀察的詳細度要比文件觀察低。
    2.無法使用任何的pathname globbing,如?或者*
    3.只能配置已經存在的文件,若配置觀察目錄而又新增了文件,則新文件只會在下次audit重啓後纔會加入。
    利用-k產生key string 以供ausearch直接索引
-w /etc/var/log/audit/ -k LOG_audit

audit相關操作命令

重啓audit
#service auditd restart
更新auditd
#yum update audit
檢查文件和系統的更改狀態
#aureport --start today --event --summary -i
查詢單一文件
#ausearch -f filename
利用-ts指定日期-k指定key string,其中password-file使用auditctl -k來產生。
#ausearch -ts today -k password-file
#ausearch -ts 3/12/07 -k password-file
-ui來指定user name(UID),例如找出(uid 516)的操作
#ausearch -ts today -k password-file -x rm -ui 516
#ausearch -k passwork-file -ui 516

在較新的設備上安裝RHEL7.6出現的問題

文件解壓、複製等速度慢的問題
原因在於,audit審計服務自動定義了許多規則,導致每條文件讀寫都被記錄在audit的日誌裏,由此引起讀寫多個文件很慢的問題
解決辦法:
1.sudo setup,進入系統設置,關閉audit.service,重啓
2. 進入/etc/audit/audit.rules,將相關規則刪除,但是重啓會重新生成,需要刪除自動生成規則的配置文件
在不同機器上安裝redhat7.6發現有些較老的機器上並不會自動產生這麼多審計規則,新機器上產生這麼多審計規則的原因暫時不太明確。有知道原因的朋友歡迎留言交流,謝謝

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章