標籤:
lynis check System Tools
檢查系統可執行程式環境變數路徑
Boot and services
GRUB2 功能表項目進入單一使用者模式已經設定密碼
其他是檢查開始啟動並執行服務,目前是運行24項服務,開機啟動是21項服務
* 服務指令碼目錄: /lib/systemd/system/
* service檔案許可權: 0644
Kernel
運行層級、已裝入模組、核心配置和核心轉儲
- 檢查運行層級 RUNLEVEL 5
- 檢查核心版本類型,以及載入模組數量
- 檢查核心config檔案,default I/O kernel scheduler,
- core dumps 配置,預設沒有開啟,
- setuid core dumps 配置為預設
- 檢查是否需要重啟
Kernel Hardening
- Comparing sysctl key pairs with scan profile ,每一項後面是lynis給出的建議值,例如 (exp: 1)
- kernel.core_uses_pid (exp: 1) 每個訊息佇列的大小(單位:位元組)限制 - kernel.ctrl-alt-del (exp: 0) 是否捕獲ctrl+alt+delete按鍵組合時的訊號, 0,捕獲,1,不捕獲 - kernel.sysrq (exp: 0) 是否開啟SysRq功能,0,禁用,1,啟用 - net.ipv4.conf.all.accept_redirects (exp: 0) ICMP接收重新導向報文(全域設定) 0,忽略, 1 ,轉寄 - net.ipv4.conf.all.accept_source_route (exp: 0) 接受所有源地址資訊包(全域設定) 0,丟棄, 1 ,轉寄 - net.ipv4.conf.all.bootp_relay (exp: 0) - net.ipv4.conf.all.forwarding (exp: 0) 配置主機網路介面的行為, 0 禁止轉寄,1,允許轉寄 - net.ipv4.conf.all.log_martians (exp: 1) 將包含非法地址資訊的ip包記錄到核心日誌(全域設定) 0 關閉, 1 開啟 - net.ipv4.conf.all.mc_forwarding (exp: 0) 多播路由 0 關閉, 1 開啟 - net.ipv4.conf.all.proxy_arp (exp: 0) ARP代理 0 關閉, 1 開啟 - net.ipv4.conf.all.rp_filter (exp: 1) 逆向路徑過濾 (Reverse Path Filtering)0 關閉, 1 Strict mode, 2 Loose mode - net.ipv4.conf.all.send_redirects (exp: 0) ICMP發送重新導向報文 0 關閉, 1 開啟 - net.ipv4.conf.default.accept_redirects (exp: 0) ICMP接收重新導向報文(預設設定) 0 忽略, 1 轉寄 - net.ipv4.conf.default.accept_source_route (exp: 0) 接受所有源地址資訊包(預設設定) 0 丟棄, 1 轉寄 - net.ipv4.conf.default.log_martians (exp: 1) 將包含非法地址資訊的ip包記錄到核心日誌(預設設定) 0 關閉, 1 開啟 - net.ipv4.icmp_echo_ignore_broadcasts (exp: 1) 設定是否響應icmp echo請求廣播, 0 響應, 1 忽略 - net.ipv4.icmp_ignore_bogus_error_responses (exp: 1) 忽略由網路中的那些聲稱回應地址是廣播位址的主機產生的ICMP錯誤 0 響應, 1 忽略 - net.ipv4.tcp_syncookies (exp: 1) 表示開啟SYN Cookies,當出現SYN等待隊列溢出時,啟用cookies來處理,可防範少量SYN攻擊, 0 關閉, 1 啟用 - net.ipv4.tcp_timestamps (exp: 0) 開啟時間戳記,防範那些偽造的 sequence 號碼 0 關閉, 1 開啟以下是針對ipv6的,和ipv4 的同參數功能相同 - net.ipv6.conf.all.accept_redirects (exp: 0) - net.ipv6.conf.all.accept_source_route (exp: 0) - net.ipv6.conf.default.accept_redirects (exp: 0) - net.ipv6.conf.default.accept_source_route (exp: 0)
- man proc
- 網路部分 https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
Memory and processes
檢查殭屍進程和輸入輸出等待進程,ps -aux
- /proc/memento
- dead/zombie processes
- IO waiting processes
Users, Groups and Authentication
使用者組編號、sudoers檔案、可插拔驗證模組(PAM)配置、密碼老化和預設掩碼
- 檢查 UID ID groupname 的唯一性
- 檢查 group files 和 password file 檔案的一致性 (TODO)
- 檢查命名服務:
- 網路資訊服務 (Network Information Service, NIS)
- 輕量型目錄存取通訊協定(Lightweight Directory Access Protocol,LDAP)
- 檢查sudo配置及其許可權, /etc/sudoers 預設許可權 0440
- PAM認證設定檔檢查,密碼強度配置檢查
- 檢查 LDAP module in PAM 是否配置,及其 LDAP authentication Support
- 檢查賬戶的到期日,密碼為空白的配置情況
- default umask (todo)
/etc/profile 755
/etc/login.defs 644
/etc/init.d/rc 644
Shells
- /etc/shells 查看當前系統存在的shell數量
- 測試是否存在 Shellshock 漏洞
File systems
掛載點、臨時檔案和根檔案系統
- 檢查 /home /tmp 掛載點
- 檢查 是否存在UNIX檔案系統 FFS/UFS (BSD體系)
- 檢查 swap分區,測試swap分區狀態
- 檢查 /tmp old files 和 sticky bit,正確的許可權 (1777)
- 檢查 根分區是否開啟 ACL 支援 已經開啟 (todo)
- 檢查 Locate database (todo)
- 檢查是否存在加密檔案系統 否
Storage
檢查 USB儲存(usb-storage)和火線開放式主機控制器介面(firewire ohci) NOT DISABLED
相關設定檔
- /lib/modprobe.d/aliases.conf
- /etc/modprobe.d/*
NFS
- 查詢 是否存在 rpc 程式 (Remote Procedure Call,遠端程序呼叫)
- 查詢 NFS 版本,協議,服務
Software: name services
- 檢查預設的 DNS search domain
- 檢查 search domains
- 檢查 /etc/resolv.conf 是否存在 options 配置項
- 檢查 DNS domain name
- 檢查 nscd,bind,PowerDNS,ypbind 運行狀態
- 檢查 /etc/hosts
- duplicates
- hostname
- localhost
Ports and packages
- 包管理套件: dpkg apt-get
- 檢查設定檔,以及是否存在安裝更新倉庫: 相關配置 /etc/apt/sources.list.d/*
- 包管理套件對應的資料庫完整性和一致性檢查,是針對包依賴關係,而不是包的檔案內容,相關命令
dpkg -C
- 檢查 vulnerable packages (還沒太理解含義)
Networking
名稱伺服器、混雜介面和串連狀態
Printers and Spools
列印服務預設不安裝
Software: e-mail and messaging
檢查系統中 Exim Postfix Qmail Sendmail 的運行狀態
Software: firewalls
- 檢查 iptables 運行狀態
- 檢查 PF firewall (UNIX BSD 體系防火牆)
- 檢查 host based firewall 配置是否開啟
SSH Support
- PermitRootLogin 設定root遠程登入策略,預設是 without-password
- StrictModes 設定ssh在接收登入請求之前是否檢查使用者家目錄和rhosts檔案的許可權和所有權
- AllowUsers 使用者白名單
- AllowGroups 使用者組白名單
- Protocol 支援的協議版本
Logging and files
- 檢查Log Service運行狀態,當前系統是rsyslog,
- 其他同類軟體Syslog-NG,RFC 3195,minilogd
- logrotate進程是否運行,記錄檔管理工具,用於截斷(或輪循)、壓縮,刪除舊記錄檔,備份曆史記錄檔等
- 檢查是否在使用已經刪除的檔案(deleted files in use)
- log directories (static list) (todo)
- open log files (todo)
Insecure services
Banners and identification
- 檢查 /etc/motd /etc/issue /etc/issue.net
Scheduled tasks
- 檢查 crontab atd 服務運行狀態
- 檢查 計劃任務運行狀態
Accounting
- 檢查 賬戶資訊
- sysstat accounting data 預設沒有開啟
- auditd 檢查規則,設定檔,記錄檔
Time and Synchronization
- 檢查 ntp 服務或者用戶端是否存在
- 檢查 NTP client是否在/etc/anacrontab,/etc/crontab 或 cron.d files 中
Cryptography
- 檢查SSL認證是否到期
Virtualization Security frameworks
- 檢查 AppArmor,SELinux,Grsecurity 是否開啟或支援
Software: file integrity
檢查以下檔案完整性檢查工具是否存在
AFICK,AIDE,Osiris,Samhain,Tripwire,syscheck,mtree
Software: System tooling
saltstack,puppet,cfengine,chef,func,fabric
File Permissions
- 檢查 /etc/lilo.conf 和 $HOME/.ssh
Home directories
Hardening
- 檢查是否存在編譯器
- 檢查是否存在惡意軟體掃描工具
檢查是否存在以下軟體或服務
- apache
- nginx
- PHP
- MySQL
- PostgreSQL
- Oracle
- Squid
- OpenLDAP 運行執行個體
- SNMP 服務
lynis check log