1. 程式人生 > >centos 阿里雲優化建議

centos 阿里雲優化建議

 

檢查專案 : 確保禁止資料包重定向傳送

加固建議: 在 /etc/sysctl.conf 檔案中設定以下引數: net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 執行以下命令來設定活動的核心引數: $ sysctl -w net.ipv4.conf.all.send_redirects=0 $ sysctl -w net.ipv4.conf.default.send_redirects=0 $ sysctl -w net.ipv4.route.flush=1

檢查專案 : 確保不接受ICMP重定向

加固建議: 在 /etc/sysctl.conf 檔案中設定以下引數: net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 執行以下命令來設定活動的核心引數: $ sysctl -w net.ipv4.conf.all.accept_redirects=0 $ sysctl -w net.ipv4.conf.default.accept_redirects=0 $ sysctl -w net.ipv4.route.flush=1

檢查專案 : 確保不接受安全的ICMP重定向

加固建議: 在 /etc/sysctl.conf 檔案中設定以下引數: net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 執行以下命令來設定活動的核心引數: $ sysctl -w net.ipv4.conf.all.secure_redirects=0 $ sysctl -w net.ipv4.conf.default.secure_redirects=0 $ sysctl -w net.ipv4.route.flush=1

 

檢查專案 : 確保已配置rsyslog預設檔案許可權

加固建議: 編輯/etc/rsyslog.conf並將 $FileCreateMode 設定為 0640 或更具限制性: $FileCreateMode 0640

檢查專案 : 確保配置/etc/crontab上的許可權

加固建議: 執行以下命令以在49304381??005478634026上設定所有權和許可權: $ chown root:root /etc/crontab $ chmod og-rwx /etc/crontab

檢查專案 : 確保配置/etc/cron.hourly上的許可權

加固建議: 執行以下命令以設定 /etc/cron.hourly 的所有權和許可權: $ chown root:root /etc/cron.hourly $ chmod og-rwx /etc/cron.hourly

檢查專案 : 確保配置/etc/cron.weekly上的許可權

加固建議: 執行以下命令以設定 /etc/cron.weekly 上的所有權和許可權: $ chown root:root /etc/cron.weekly $ chmod og-rwx /etc/cron.weekly

檢查專案 : 確保配置/etc/cron.daily上的許可權

加固建議: 執行以下命令以設定 /etc/cron.daily 上的所有權和許可權: $ chown root:root /etc/cron.daily $ chmod og-rwx /etc/cron.daily

檢查專案 : 確保配置/etc/cron.monthly上的許可權

加固建議: 執行以下命令以設定所有權和許可權 /etc/cron.monthly : $ chown root:root /etc/cron.monthly $ chmod og-rwx /etc/cron.monthly

檢查專案 : 確保配置/etc/cron.d上的許可權

加固建議: 執行以下命令以在 /etc/cron.d 上設定所有權和許可權: $ chown root:root /etc/cron.d $ chmod og-rwx /etc/cron.d

檢查專案 : 確保SSH LogLevel設定為INFO

加固建議: 編輯 /etc/ssh/sshd_config 檔案以按如下方式設定引數: LogLevel INFO

檢查專案 : 確保禁用SSH X11轉發

加固建議: 編輯 /etc/ssh/sshd_config 檔案以設定引數,如下所示: X11Forwarding no

檢查專案 : 確保SSH MaxAuthTries設定為4或更少

加固建議: 編輯 /etc/ssh/sshd_config 檔案以設定引數,如下所示: MaxAuthTries 4

檢查專案 : 確保禁用SSH根登入

加固建議: 編輯 /etc/ssh/sshd_config 檔案以按如下方式設定引數: PermitRootLogin no

檢查專案 : 確保配置了SSH警告標語

加固建議: 編輯 /etc/ssh/sshd_config 檔案以設定引數,如下所示: Banner /etc/issue.net 5.3配置PAM PAM(可插入認證模組)是一種在UNIX系統上實現模組化認證模組的服務。 PAM被實現為一組共享物件,當程式需要對使用者進行身份驗證時,該物件被載入並執行。 PAM的檔案通常位於 /etc/pam.d 目錄中。必須仔細配置PAM以確保系統身份驗證。雖然本節介紹了一些PAM,但請參閱其他PAM資源以充分了解配置功能。

檢查專案 : 確保預設使用者umask是027或更多的限制

加固建議: 編輯 /etc/bashrc 和 /etc/profile 檔案(以及系統支援的任何其他shell的相應檔案),並新增或編輯任何umask引數,如下所示: umask 027

檢查專案 : 確保對su命令的訪問受到限制

加固建議: 將以下行新增到 /etc/pam.d/su 檔案中: auth required pam_wheel.so use_uid 在 /etc/group 檔案的wheel語句中建立逗號分隔的使用者列表: wheel:x:10:root,<user list>

檢查專案 : 確保配置/ etc / shadow上的許可權

加固建議: 執行以下命令以在 /etc/shadow 上設定許可權: $ chown root:root /etc/shadow $ chmod 000 /etc/shadow

檢查專案 : 確保配置/ etc / gshadow上的許可權

加固建議: 執行以下chown在 /etc/gshadow 上設定許可權: $ chown root:root /etc/gshadow $ chmod 000 /etc/gshadow

檢查專案 : 確保密碼重用是有限的

加固建議: 編輯 /etc/pam.d/password-auth 和 /etc/pam.d/system-auth 檔案以包含 remember 選項並符合站點策略,如圖所示: password sufficient pam_unix.so remember=5

檢查專案 : 確保密碼到期時間為90天或更短

加固建議: 在 /etc/login.defs 中將 PASS_MAX_DAYS 引數設定為 90 : PASS_MAX_DAYS 90 修改所有使用者密碼設定為匹配的使用者引數: $ chage --maxdays 90 <user>

檢查專案 : 確保密碼更改之間的最短天數為7或更多

加固建議: 在 /etc/login.defs 中將 PASS_MIN_DAYS 引數設定為7: PASS_MIN_DAYS 7 修改密碼設定為匹配的所有使用者的使用者引數: $ chage --mindays 7 <user>

檢查專案 : 確保密碼到期警告天數為7或更多

加固建議: 在 /etc/login.defs 中將 PASS_WARN_AGE 引數設定為7: PASS_WARN_AGE 7 修改密碼設定為匹配的所有使用者的使用者引數: $ chage --warndays 7 <user>

檢查專案 : 確保無效的密碼鎖定時間為30天或更短

加固建議: 執行以下命令將預設密碼非活動期設定為30天: $ useradd -D -f 30 修改密碼設定為匹配的所有使用者的使用者引數: $ chage --inactive 30 <user>