常用安全檢查指令碼

2021-06-29 16:24:30 字數 4697 閱讀 9807

hp-ux

cat  /etc/shadow

cat  /etc/passwd

quota username   磁碟配額

linux

hostname

ifconfig

uname -a

who -r

ifconfig -a 

netstat -nr

netstat -a

netstat -lnpt

ps -ef

ps -ef|grep telnet 

ps -ef|grep ssh

ps -ef|grep syslog

ps -ef|grep audit

ls -l /etc

ls -l /etc/security

#find / -perm -4000 -ls 

#find / -perm -2000 -ls 

# find / -perm -0004 -ls >> ./find0004.log

df -h

df -k

df -g

cat /etc/inittab

cat /etc/rc.d/rc.sysinit   init 處理系統初始化流程 ,設定系統環境

cat /etc/rc.d/rc.local  自動開啟某些服務

ls -l /etc/rc.d/rc0.d

ls -l /etc/rc.d/rc1.d

ls -l /etc/rc.d/rc2.d

ls -l /etc/rc.d/rc3.d

ls -l /etc/rc.d/rc4.d

ls -l /etc/rc.d/rc5.d

ls -l /etc/rc.d/rc6.d

cat /etc/fstab

cat /etc/profile  這個檔案是每個使用者登入時都會執行的環境變數設定

cat /etc/environment  設定整個系統的環境

printenv   顯示環境變數的值

cat /etc/syslog.conf  對syslogd程式的主要配置檔案

ls -l /var/log

crontab -l  列出使用者目前的crontab

at -l

cat /etc/passwd

cat /etc/shadow

cat /etc/group

cat /etc/pam.d/system-auth  密碼複雜度限制

cat /etc/login.defs  設定密碼複雜度

cat /etc/ssh/sshd_config

cat /etc/logrotate.conf  日誌檔案總管,自動對日誌進行截斷(或輪循)、壓縮以及刪除舊的日誌檔案

service --status-all

service --status-all|grep running

chkconfig --list

cat /etc/security/limits.conf  限制使用者對系統資源的使用

cat /etc/hosts.allow

cat /etc/hosts.deny

cat /et/hosts.equiv

關於/etc/hosts.equiv和$home/.rhosts,這兩個檔案都是和主機間的信任關係相關的,也就是允許另外一台機器上的使用者不用輸密碼就可以rlogin到本機。

cat /etc/snmp/snmpd.conf

history

lastlog   lastlog 列出使用者最後登入的時間和登入終端的位址,如果此使用者從來沒有登入,則顯示:**never logged in**

last 列出使用者所有的登入時間和登入終端的位址

more /var/log/messages 

more /var/log/secure  安全資訊和系統登入與網路連線的資訊

more /var/log/audit/audit.log

vmstat 5  是virtual meomory statistics(虛擬記憶體統計)的縮寫, 是實時系統監控工具。該命令通過使用knlist子程式和/dev/kmen偽裝置驅動器訪問這些資料,輸出資訊直接列印在螢幕。

oracle 

su - oracle 

cat $oracle_home/rdbms/admin/utlpwdmg.sql

cat $oracle_home/network/admin/sqlnet.ora

cat $oracle_home/network/admin/listener.ora

set linesize 512;

set pagesize 1024;

select * from global_name;

archive log list;

select username,profile from dba_users;

select username,account_status from dba_users;

select * from dba_profiles where profile='default';

select name,status from v$controlfile;

select group#,status,member from v$logfile;

select name from v$archived_log;

select name,password from user$;

select tablespace_name,sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;

select tablespace_name,sum(bytes)/1024/1024 from dba_free_space group by tablespace_name;

show parameter;

show parameter audit;

show parameter os_auth;

show parameter remote_login_passwordfile;

show parameter 07_dictionary_accessibility;

select granted_role from dba_role_privs where grantee='public';

select grantee,privilege,admin_option from dba_sys_privs;

select grantee,granted_role,default_role from dba_role_privs;

select grantee||' '||owner||'.'table_name from dba_tab_privs where grantee='public' and table_name like 'utl_%';

select grantee||' '||owner||'.'table_name from dba_tab_privs where grantee='public' and table_name like 'dbms_%';

select username,account_status,default_tablespace,temporary_tablespace,profile from dba_users order by username;

select profile,resource_name,resource_type,limit from dba_profiles order by profile;

select tablespace_name,sum(bytes)/1024/1024 as freesize from dba_free_space group by tablespace_name order by tablespace_name;

select tablespace_name,status,contents,logging from dba_tablespaces order by tablespace_name;

select status||' '||name from v$controlfile;

select group#,status from v$log;

select group#||' '||status||' '||member from v$logfile order by group by group#;

select name||' '|| value from v$parameter where name like '%archive%';

select stamp ||' '||name from v$archived_log order by stamp;

select sid||':'||serial#||':'||username||':'||command||':'||status||':'||program from v$session;

select event||' '||sum(seconds_in_wait) from v$session_wait group by event order by sum(seconds_in_wait) desc;

select wait_class||' '||sum(total_waits) ||' '||sum(time_waited) as timewaited from v$system_wait_class group by wait_class order by wait_class;

Shell Scripts 指令碼檢查

shell script指令碼檢查 sh nvx scripts.sh 選項與引數 n 不執行script,僅查詢語法的問題 v 在執行script前,先將scripts的內容輸出到螢幕上 x 將使用到的script內容顯示到螢幕上,這是很有用的引數 shell 裡面條件控制語句 case結構條件句...

Linux安全檢查

檢查裝置密碼複雜度策略 1.檢查密碼複雜度策略中設定的大寫字母個數 2.檢查密碼複雜度策略中設定的數字個數 3.檢查密碼複雜度策略中設定的特殊字元個數 4.檢查密碼複雜度策略中設定的小寫字母個數 redhat系統 修改 etc pam.d system auth檔案,suse9 修改 etc pam...

bash指令碼錯誤檢查

在bash shell 指令碼中總是需要對已經執行命令作錯誤檢查,以便進行下一步處理.bin bash error e 31 47m error eend e 0m n function die eend will uncomment below without test exit 1 like p...