2026年4月29日 星期三

Windows關閉 SSL 2.0 與 SSL 3.0,並強制使用 TLS 1.2

Windows關閉 SSL 2.0 與 SSL 3.0,並強制使用 TLS 1.2
有一台windows server 2012 R2 主機, 被弱點掃描軟體Nessus,掃出

SSL Version 2 and 3 Protocol Detection "The remote service encrypts traffic using a protocol with known weaknesses." "The remote service accepts connections encrypted using SSL 2.0 and/or

SSL 3.0. These versions of SSL are affected by several cryptographic flaws, including:

  - An insecure padding scheme with CBC ciphers.
  - Insecure session renegotiation and resumption schemes.

An attacker can exploit these flaws to conduct man-in-the-middle attacks or to decrypt communications between the affected service and clients.


Although SSL/TLS has a secure means for choosing the highest supported version of the protocol (so that these versions will be used only if the client or server support nothing better), many web browsers

implement this in an unsafe way that allows an attacker to downgrade a connection (such as in POODLE). Therefore, it is recommended that these protocols be disabled entirely.

NIST has determined that SSL 3.0 is no longer acceptable for secure communications. As of the date of enforcement found in PCI DSS v3.1, any version of SSL will not meet the PCI SSC's definition of 'strong
cryptography'." "Consult the application's documentation to disable SSL 2.0 and 3.0.

Use TLS 1.2 (with approved cipher suites) or higher instead.


處理方式:

絕對應該關閉 SSL 2.0 與 SSL 3.0,並強制使用 TLS 1.2

這項弱點(主要是為了防範 POODLE 攻擊)在現代安全標準中是非常基礎且必要的修復。SSL 2.0/3.0 早已被證明存在嚴重的加密缺陷,攻擊者可以利用這些漏洞進行中間人攻擊 (MITM) 並解密通訊內容。

由於 Windows Server 2012 R2 的預設設定較舊,通常需要手動調整註冊表或使用工具來符合目前的 Nessus 掃描要求。


1. 修復步驟:停用舊協定並啟用 TLS 1.2

在 Windows Server 2012 R2 中,所有的協定控制都在以下註冊表路徑: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols

A. 停用 SSL 2.0 與 3.0

你需要針對 SSL 2.0SSL 3.0 分別建立 ClientServer 子機碼,並將其停用:

  1. 建立機碼:Protocols\SSL 3.0\Server

  2. 在右側建立 DWORD (32-bit) 值:

    • Enabled = 0

    • DisabledByDefault = 1

  3. SSL 3.0\ClientSSL 2.0\ServerSSL 2.0\Client 重複上述動作。

B. 啟用 TLS 1.2

雖然 2012 R2 支援 TLS 1.2,但有時並未預設開啟。請確保以下路徑已正確設定:

  1. 建立機碼:Protocols\TLS 1.2\Server

  2. 在右側建立 DWORD (32-bit) 值:

    • Enabled = 1

    • DisabledByDefault = 0









2. 重要補充:.NET Framework 的相容性 (隱藏陷阱)

在 Windows Server 2012 R2 上,即便你關閉了系統層級的 SSL 3.0,有些執行在 .NET Framework (3.5 或 4.x) 上的應用程式可能還是會嘗試使用舊協定。為了確保 .NET 應用程式也使用 TLS 1.2,建議增加以下註冊表項:

  • 路徑 1: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319

  • 路徑 2: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319

  • 新增項目:

    • SchUseStrongCrypto = 1 (DWORD)

    • SystemDefaultTlsVersions = 1 (DWORD)

Windows停用 3DES 與 DES 相關套件

Windows停用 3DES 與 DES 相關套件

有一台windows server 2022主機, 被弱點掃描軟體Nessus,掃出SSL Medium Strength Cipher Suites Supported (SWEET32),Reconfigure the affected application if possible to avoid use of medium strength ciphers.


SWEET32 (CVE-2016-2183) 弱點主要是針對 64 位元區塊加密演算法 (64-bit block ciphers) 的攻擊,而 3DES 與 DES 正是這類受影響的加密套件。


在 Windows Server 2022 中,要徹底修復這項弱點,核心動作就是停用 3DES 加密。

處理方式:

1. 核心修復動作:修改 Registry 註冊表
這是最直接且標準的做法,透過修改 Schannel(Windows 的安全通道)設定來停用 3DES。

開啟 Registry Editor (regedit)。

導覽至以下路徑:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers

在 Ciphers 下方建立一個名為 Triple DES 168/168 的子機碼(如果不存在)。

在 Triple DES 168/168 下,建立兩個 DWORD (32-bit) 值:

Enabled:數值資料設為 0

DisabledByDefault:數值資料設為 1

針對 DES(如果存在),也在 Ciphers 下建立名為 DES 56/56 的子機碼,並重複上述步驟。


提醒: 修改完成後,務必重新啟動伺服器,這項變更才會真正被載入系統記憶體中。
這樣處理後,Nessus 的 Medium Strength Cipher (SWEET32) 警示就會消失。



2026年4月22日 星期三

使用Commvault備份時,遇到VMware 磁碟整併鎖定問題排除

使用Commvault備份時,遇到VMware 磁碟整併鎖定問題排除:

我使用Commvault備份軟體,透過VMware Vcenter去備份ESX Server內的VM。

但備份時會產生快照,但備份已經跑完了,快照還在,VMware Vcenter提示訊息說虛擬機器磁碟需要整併。

但我執行整併,發現虛擬機器磁碟整併失敗,Vcenter提示訊息說 無法存取遭到鎖定的檔案。
===========

這種情況在備份環境中(特別是使用 Commvault 或 Veeam 等軟體)非常常見,通常是因為 HotAdd 傳輸模式 造成的。

當 Commvault 的 VSA (Virtual Server Agent) 透過 HotAdd 模式備份時,它會將受保護 VM 的磁碟「掛載」到 VSA Proxy 機器上。如果備份過程中斷或解除掛載失敗,磁碟鎖(Lock)就會殘留在 VSA 上,導致 vCenter 無法執行磁碟整併。

以下是處理此問題的標準 SOP:


第一步:找出「鎖定者」(檢查 Commvault VSA Proxy)

這是最常見的原因。請檢查負責該備份作業的 Commvault VSA (Proxy) 虛擬機

  1. 在 vCenter 中,找到該備份作業使用的 VSA 虛擬機

  2. 右鍵點擊 VSA 虛擬機 -> 編輯設定 (Edit Settings)

  3. 檢查硬體清單中,是否有多出來的硬碟(通常硬碟容量或名稱會與出問題的 VM 一致)。

  4. 解決方法: 如果發現不屬於 VSA 本身的硬碟,請點擊 「移除 (Remove)」

    • 注意: 務必選擇 「從虛擬機器移除 (Remove from virtual machine)」,千萬不要勾選「從資料存放區刪除檔案」。

  5. 移除後,回到出問題的 VM 再次執行「整併 (Consolidate)」。



2025年6月2日 星期一

如何查看主機跟NAS連線的指令?

windows的VM或主機可以下
net use 或是 Get-SmbConnection
看有沒有關於連線到NAS storage的資訊.
================================================
對於linux VM或主機可以下
netstat -an | grep 2049      # NFS
netstat -an | grep 445       # CIFS (SMB)


================================================

PS C:\>Get-SmbConnection ServerName ShareName UserName Credential Dialect NumOpens ---------- --------- -------- ---------- ------- -------- Contoso-FS1 VMS5 Contoso\Contoso-HV1$ Contoso\Contoso-HV1$ 3.00 1 Contoso-FS1 VMS5 NT VIRTUAL MACHI... Contoso\Contoso-HV1$ 3.00 3 Contoso-FS VMS1 Contoso\Contoso-HV1$ Contoso\Contoso-HV1$ 3.00 1 Contoso-FS VMS1 NT VIRTUAL MACHI... Contoso\Contoso-HV1$ 3.00 5 Contoso-SO VMS3 Contoso\Contoso-HV1$ Contoso\Contoso-HV1$ 3.00 1 Contoso-SO VMS3 NT VIRTUAL MACHI... Contoso\Contoso-HV1$ 3.00 1 Contoso-SO VMS3 NT VIRTUAL MACHI... Contoso\Contoso-HV1$ 3.00 2


資料來源:
https://learn.microsoft.com/en-us/powershell/module/smbshare/get-smbconnection?view=windowsserver2025-ps

==================
PS C:\>Get-SmbConnection -ServerName Contoso-FS | Select-Object -Property * ContinuouslyAvailable : True Credential : Contoso\Contoso-HV1$ Dialect : 3.00 Encrypted : False NumOpens : 1 ServerName : Contoso-FS ShareName : VMS1 UserName : Contoso\Contoso-HV1$ PSComputerName : CimClass : ROOT/Microsoft/Windows/SMB:MSFT_SmbConnection CimInstanceProperties : {ContinuouslyAvailable, Credential, Dialect, Encrypted...} CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties ContinuouslyAvailable : True Credential : Contoso\Contoso-HV1$ Dialect : 3.00 Encrypted : False NumOpens : 5 ServerName : Contoso-FS ShareName : VMS1 UserName : NT VIRTUAL MACHINE\F357A523-592B-4CA5-B61E-C06D5627E1C9 PSComputerName : CimClass : ROOT/Microsoft/Windows/SMB:MSFT_SmbConnection CimInstanceProperties : {ContinuouslyAvailable, Credential, Dialect, Encrypted...} CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties



2025年5月21日 星期三

VMware vSphere 內的VM固定解析度的問題。

在某些使用VMware vSphere的版本,內的VM,會因為使用者開啟Web視窗的大小,VM因此自動的變更解析度,這對於某些使用者,會感到困擾,甚至某些自動化的程式,也會受到影響,無法正常運作。

網路上查找的經驗,經過測試有效,列為紀錄分享。
以下做法,都需要經過開關機,使設定套用。

第一種方法:
一、修改 OS 內 C:\Program Files\VMware VMware Tools\VMwareResolutionSet.exe,
改名將VMwareResolutionSet.exe 變更為 VMwareResolutionSet.exe.bak,簡單說就是讓Vmware tools找不到這個程式,即可固定解析度,用意就是不要讓他自行變更解析度。

若想要復原這個功能,將檔名改回即可。
***但注意若更新vmware tools,有可能重新安裝VMware tools,需要重新設定。

第二種方法:
修改 vmx 設定。
至需變更主機所在datastore 內將 vmx 下載,並新增下列資訊
svga.maxWidth = "1024"     ##此為寬度
svga.maxHeight = "768"      ##此為高度
guestInfo.svga.wddm.modeset = "FALSE"     ##停止自動調整功能
變更完畢後將vmx 上傳回並覆蓋。
***提醒做任何變動,都建議要備份設定。凡是留一手。
Note: 第二種方式,測試時,我關機修改vmx,第一次開機,有發生一點異常現象。
開機後,windows登入時,輸入帳號資訊,輸入完成後登入進windows,VM畫面會呈現全黑的現象,但關機,再單純重開一次,它就可以正常開機並且顯示正常,暫且留意ˋ此狀況,不知道為什麼,是不是有什麼特例或是個案。

2025年3月23日 星期日

Ubuntu 24.04.2系統vi編輯器上下左右鍵變ABCD,按空白和Enter,編輯的很奇怪的解決方式

Ubuntu 24.04.2系統vi編輯器上下左右鍵變ABCD,按空白和Enter,編輯的很奇怪的解決方式。

編輯的時候,感到很困擾,就覺得怎麼怪怪,一度還懷疑自己的電腦環境,怎麼了。

經過網路爬文,聽聞這個問題是由ubuntu系統內建的 vi版本太老導致的,所以解決方案就是安裝新版的vi編輯器即可:
首先卸載舊版本的vi編輯器:

  $sudo apt-get remove vim-common

  然後安裝新版vi即可:

  $sudo apt-get install vim


昏倒很奇怪,我明明是安裝新的版本ubuntu-24.04.2-desktop。
這已經是很新的版本Linux,怎麼還是用 舊版vi呢?

2025年2月6日 星期四

掛載 CentOS 8 Linux ISO 來當作本地倉庫,以安裝SNMP來示範。

由於舊版的Linux,可能因為原廠停止維護支援,已經無法線上yum or dnf安裝相關套件。
我們可以改用掛載 CentOS 8 ISO 來當作本地倉庫,就可以進行yum or dnf安裝。但建議盡量優先安裝新版,比較沒有資安漏洞或程式老舊的問題。

第一部分: 掛載 CentOS 8 Linux ISO 來當作本地倉庫,安裝套件。
步驟一:掛載 CentOS 8 ISO
1.建立掛載目錄
#mkdir -p /mnt/centos8

2.掛載光碟機
#mount /dev/sr0 /mnt/centos8

或是掛載ISO(擇一)
#mount -o loop /path/to/CentOS-8.4.2105-x86_64-dvd1.iso /mnt/centos8

3.確認掛載成功
#ls /mnt/centos8

步驟二:建立本地倉庫
1.產生倉庫設定檔
#vi /etc/yum.repos.d/centos8-local.repo

加入以下內容:
-----------------------------------------------------------
[centos8-local]
name=CentOS 8 Local Repo
baseurl=file:///mnt/centos8/BaseOS/
enabled=1
gpgcheck=0

[centos8-appstream]
name=CentOS 8 AppStream Repo
baseurl=file:///mnt/centos8/AppStream/
enabled=1
gpgcheck=0
-----------------------------------------------------------

2.清除快取並更新倉庫

#dnf clean all
#dnf makecache
#dnf repolist

如果倉庫成功掛載,你應該會看到 centos8-local 和 centos8-appstream。


步驟三:安裝 net-snmp

#dnf install -y net-snmp  net-snmp-utils

這樣就會從 掛載的 CentOS 8 ISO 來安裝 net-snmp,而不需要透過網路下載。

=============
第二部分: SNMP安裝完後的設定和使用。
1.檢查 snmpd.conf 設定
vim /etc/snmp/snmpd.conf


snmpd.conf 原廠設定值僅供參考,請了解各設定值的意義,再行設定。


2. 檢查 SELinux (如果啟用了)
#getenforce
如果返回 Enforcing,可以先嘗試暫時關閉:

#setenforce 0
然後再測試 SNMP 是否能被監控主機訪問。如果這樣解決了問題,可能需要配置 SELinux 政策來允許 SNMP。


3.
 檢查防火牆設定

查看防火牆規則:
#firewall-cmd --list-all

如果防火牆開啟了 (firewalld 是 running),你需要允許 UDP 161 埠:
#firewall-cmd --add-port=161/udp --permanent
#firewall-cmd --reload


或者允許 SNMP 服務:
#firewall-cmd --add-service=snmp --permanent
#firewall-cmd --reload

4. 測試從監控主機連線

待補...







Windows關閉 SSL 2.0 與 SSL 3.0,並強制使用 TLS 1.2

Windows關閉 SSL 2.0 與 SSL 3.0,並強制使用 TLS 1.2 有一台windows server 2012 R2 主機, 被弱點掃描軟體Nessus,掃出 SSL Version 2 and 3 Protocol Detection "The re...