2022年8月5日 星期五

Windows Server 2022 、 IIS 10、遠端桌面,停用TLS 1.0、TLS 1.1協定、停用3DES加密套件、停用Diffie Hellman KeyExchangeAlgorithms。

停用TLS 1.0、TLS 1.1協定、停用3DES加密套件、停用Diffie Hellman KeyExchangeAlgorithms。

環境:
Windows Server 2022

IIS 10
已啟用HTTPS或主機有啟用遠端桌面

修改方式:
透過修改機碼的方式,先執行regedit.exe,並至路徑[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL]。

停用TLS 1.0
1.在Protocols目錄下新增機碼,名稱輸入「TLS 1.0」。
2.在TLS 1.0目錄下新增機碼,名稱輸入「Client」及「Server」。
3.於Client目錄中新增DWORD(32位元值),名稱輸入「DisabledByDefault」,確認值為1。
4.於Server目錄中新增DWORD(32位元值),名稱輸入「DisabledByDefault」,確認值為1。
5.於Server目錄中新增DWORD(32位元值),名稱輸入「Enabled」,確認值為0。

停用TLS 1.1
1.在Protocols目錄下新增機碼,名稱輸入「TLS 1.1」。
2.在TLS 1.1目錄下新增機碼,名稱輸入「Client」及「Server」。
3.於Client目錄中新增DWORD(32位元值),名稱輸入「DisabledByDefault」,確認值為1。
4.於Server目錄中新增DWORD(32位元值),名稱輸入「DisabledByDefault」,確認值為1。
5.於Server目錄中新增DWORD(32位元值),名稱輸入「Enabled」,確認值為0。

停用3DES加密套件
1.在Ciphers目錄下新增機碼,名稱輸入「Triple DES 168」。
2.於Triple DES 168目錄中新增DWORD(32位元值),名稱輸入「Enabled」,確認值為0。

停用 Diffie Hellman KeyExchangeAlgorithms
1.在KeyExchangeAlgorithms目錄下新增機碼,名稱輸入「Diffie-Hellman」。
2.於Diffie-Hellman目錄中新增DWORD(32位元值),名稱輸入「Enabled」,確認值為0。

2022年5月10日 星期二

Ubuntu SFTP設定

環境:
OS:Ubuntu 22.04 Server

目的:
  • 使用加密連線
  • 使用 SFTP 協定登入 OpenSSH 伺服器時,預設使用者可以任意的在檔案系統間遊走,因安全的理由透過 chroot() 的方法將使用者限制在(chroot) 特定目錄下,讓他不能跑到其他目錄瀏覽資料。
  • 設定完成之帳號,僅可使用SFTP 協定登入,無法使用ssh登入。

步驟:
1.確認openssh版本>4.8
$ ssh -V

2.建立SFTP用群組
$ sudo groupadd sftp_group

3.將使用者加入SFTP用群組
$ sudo usermod -G sftp_group <使用者帳號>

4.查帳號是否正確加入群組
$ grep sftp_group /etc/group

5.確認home目錄與有者權限為root:root,755。
$ ls -ld /home
drwxr-xr-x   8 root root  4096 May 10 01:08 home

6.確認使用者home目錄與有者權限為root,755。
$ ls -ld /home/<使用者帳號>
drwxr-xr-x 6 root <使用者帳號> 4096 Apr 10 03:47 <使用者帳號>

$ sudo chown root /home/<使用者帳號>

7.禁止使用者以ssh登入shell
$ sudo vim /etc/shells
加入/bin/false

$ sudo usermod -s /bin/false <使用者帳號>

8.設定SSH Config檔案
$ sudo vim /etc/ssh/sshd_config

#Subsystem       sftp    /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       PermitTTY no
#       ForceCommand cvs server

Match Group sftp_group
        ChrootDirectory %h
        X11Forwarding no
        AllowTcpForwarding no
        PermitTTY no
        ForceCommand internal-sftp

9.測試config後重啟sshd
$ sudo sshd -t
$ sudo systemctl restart sshd


10使用FileZilla以22port連線測試