sshd服務安全部署

2021-09-28 00:10:05 字數 3157 閱讀 3600

systemd 系統初始化程序

pstree 顯示系統樹程序

1,程序控制命令

ssh------>sshd

systemctl status sshd 檢視服務狀態,inactive(不可用),active(可用)

systemctl start sshd 開啟服務

systemctl stop sshd 關閉服務

systemctl restart sshd 重啟服務

systemctl enable sshd 設定服務開機啟動

systemctl disable sshd 設定服務開機不啟動

systemctl list-units 列出已開啟服務當前狀態

systemctl list-unit-files 列出所有服務開機啟動的狀態

systemctl list-dependencies 列出服務的依賴

systemctl set-default multi-user.target 設定啟動級別為多使用者模式(無圖形)

systemctl set-default graphical.target 設定系統啟動級別為圖形模式

2,新增sshd登陸的資訊

vim /etc/motd 檔案內容就是登陸後顯示的資訊

3,使用者登入的審計

```bash

1, w 檢視正在使用當前系統使用者

-f 檢視使用**

-i 顯示ip

/var/run/utmp

2,last 檢視使用過並推出的使用者資訊

/var/log/wtmp

3,lasttb 試圖登陸但是沒有成功的使用者

/var/log/btmp

1,輸入ssh-keygen新增金鑰(/root/.ssh/id_rsa)

2,設定密碼確認密碼

3,新增公鑰到服務機 ssh-copy-id -i /root/.ssh/id_rsa.pub @172.25.254.104

4,把私鑰複製到終端機 scp /root/.ssh/id_rsa [email protected]:/root/.ssh/

5,進入vim /etc/ssh/sshd——config 禁用原始密碼登陸25行

6.systemctl restart sshd.service

7,測試:從終端機進入伺服器不需要密碼

1,修改vim /etc/ssh/sshd_config 預設埠為22 修改為23

2,修改完成後必須重啟服務 systemctl restart sshd.service

3,進入伺服器必須新增-p 23

passwordauthentication yes|no 是否開啟密碼認證

listenaddress 172.25.254.215 指定ip登入

permitrootlogin yes|no 是否開啟root

pukeyauthentication yes|no 是否開啟金鑰登入

denyusers 除了黑名單的使用者都可以用

allowuser 只有白名單的人可以用

引數:	-r		複製目錄

-l 不忽略連線

-p 不忽略許可權

-t 不忽略時間戳

-g 不忽略組

-o 不忽略使用者

-d 不忽略塊裝置

引數:	-c		建立乙個壓縮檔案的引數命令 (ceate的意思)

-x 解開乙個壓縮檔案的引數指令

-t 檢視tarfile裡面的檔案

-z 是否同時具有gzip的屬性?亦即是否需要用gzip壓縮?

-j 是否同時具有bzip2的屬性?亦即是否需要用bzip2解壓

-v 壓縮的過程中顯示檔案

-f 指定打包的檔名

-p 使用原檔案的屬性

-p 可以使用絕對路徑來壓縮

1,	zip   		壓縮檔案名  打包的檔案

unzip 解壓檔案 (原始檔存在)

2, gzip 打包的檔案

gunzip 解壓檔案

3, bzip2 打包檔案

bunzip2 解壓檔案

4, xz 打包的檔案

unxz 解壓檔案

1,tar zcf   壓縮包.gz  要壓縮的檔案

tar zxf 壓縮檔案

tar zxf 壓縮包 -c 要解壓的路徑 (指定解壓路徑)

2,tar jcf 壓縮包.bz2 要壓縮的檔案

tar jxf 壓縮包

3,tar jcf 壓縮包.xz 要壓縮的檔案

tar jxf 壓縮包

webservices安全部署

問題提出 為了構建乙個安全的web服務,需要對呼叫方進行身份驗證,只讓通過審核的使用者呼叫web服務。軟體環境 web服務程式部署在分布於各地的工廠伺服器,這些伺服器位於內網之中,沒有固定外網ip,且不能通過外網進行訪問。呼叫這些web服務的是一台連線至internet的web伺服器,該web伺服器...

安全部署與優化

安全部署與優化 safe mode 簡單例子 設定指令碼訪問目錄 open basedir d www 設定禁用函式 disable functions system shell exec exec popen phpinfo passthru 設定register globals 設定magic ...

DNS安全部署解析

status clienttransferprohibited 使用者限制轉移 由使用者自行設定的限制轉移,使用者可自行取消,網域名稱處於此狀態時不可以轉移 可以正常使用 正常管理 正常續費,此狀態也可以由註冊商取消。clienttransferprohibited解釋為 使用者限制轉移 由使用者自...