使用 Mount Helper 來掛載具備傳輸中加密功能的區域性與地區性檔案共用。 此工具可自動完成區域共用資料夾的 IPsec 設定,以及區域性共用資料夾的 stunnel 設定。
掛載區域性檔案共用
請使用以下命令語法來掛載區域性檔案共用。 請將掛載路徑替換為您所使用的檔案共用所對應的具體資訊。
mount -t ibmshare -o secure=true 10.0.0.1:/MOUNT_PATH /mnt/MOUNT_POINT
當指令發出時,此公用程式會建立憑證簽署請求 (CSR),並呼叫元資料服務以取得中間憑證及對端憑證。 它會解析 mount 指令的命令列參數,並建立 /etc/swanctl/conf.d/type_ibmshare_.conf`` 檔案。 strongSwan 服務會使用此設定檔來建立 IPsec 連線。 接著,該腳本會載入 IPsec 連線,並執行 NFS mount 指令。 成功的回應如下例所示。
[root@my-eit-instance ~]
Info - IpSec using StrongSwan(5.7.2)
Debug - RunCmd: /usr/sbin/swanctl --list-conns
Debug - Config data unchanged:/etc/strongswan/swanctl/conf.d/type_ibmshare_10.240.64.5.conf
Debug - StrongSwan cleanup config files Total(1) Mounted(0) Deleted(0) Recent(1)
Debug - RunCmd: ReloadConfig (/usr/sbin/swanctl --load-all)
Debug - File unlocked:/var/lock/ibm_mount_helper.lck
Debug - RunCmd: MountCmd (mount -t nfs4 -o sec=sys,nfsvers=4.2,rw 10.240.64.5:/0c937ac3_814e_4a7c_99b8_719ec3cad7fd /mnt/share-test)
Debug - RunCmd: LoadCert (openssl x509 -in /etc/strongswan/swanctl/x509ca/type_ibmshare_int.crt -noout -dates -subject -issuer)
Debug - RunCmd: LoadCert (openssl x509 -in /etc/strongswan/swanctl/x509ca/type_ibmshare_root_dal.crt -noout -dates -subject -issuer)
Share successfully mounted:
建議您不要將掛載詳細資訊新增至 /etc/fstab 檔案,因為這可能會導致運算主機在開機時當機。
掛載區域性檔案共用
請使用以下命令語法來掛載區域性檔案共用。 請將掛載路徑替換為您所使用的檔案共用所對應的具體資訊。
mount -t ibmshare -o stunnel 10.0.0.1:/MOUNT_PATH /mnt/MOUNT_POINT
當指令發出時,該工具會建立 stunnel 連線,並執行 NFS mount 指令。 成功的回應如下例所示。
在掛載指令中加入 -v 選項,即可產生除錯輸出,這有助於找出掛載過程中的任何問題。
[root@my-eit-instance ~]
Debug - Locked ok:/var/lock/ibm_mount_helper.lck
Debug - File unlocked:/var/lock/ibm_mount_helper.lck
Debug - Locked ok:/var/lock/ibm_mount_helper.lck
Debug - RunCmd: ListNfsMounts (mount -t nfs,nfs4)
Debug - Existing nfs/nfs4 mounts found:0
Debug - RunCmd: ListNfsMounts (mount -t nfs,nfs4)
Debug - Existing nfs/nfs4 mounts found:0
Debug - Local port 10001 will be used for setting up next stunnel
Debug - Starting stunnel for mounting /EAD9B8582BC84FDAB57B7A315BCA1210
Debug - Stunnel conf file created /etc/stunnel/ibmshare_EAD9B8582BC84FDAB57B7A315BCA1210.conf
Debug - Attempting to start stunnel using /etc/stunnel/ibmshare_EAD9B8582BC84FDAB57B7A315BCA1210.conf
Debug - Attempting mount of /EAD9B8582BC84FDAB57B7A315BCA1210 on the local host
Debug - RunCmd: Mount using stunnel (mount -t nfs4 -o sec=sys,nfsvers=4.2,rw,port=10001 127.0.0.1:/EAD9B8582BC84FDAB57B7A315BCA1210 /mnt/EAD9B8582BC84FDAB57B7A315BCA1210 -v)
Debug - Stunnel mount was successful
Debug - File unlocked:/var/lock/ibm_mount_helper.lck
建議您不要將掛載詳細資訊新增至 /etc/fstab 檔案,因為這可能會導致運算主機在開機時當機。
若需將掛載詳細資訊新增至 /etc/fstab``,請務必使用 _netdev 及 nofail 選項。 以下範例展示了正確的格式:
55.38.12.137:/9A81XXXXXX367497 /mnt/rfs ibmshare stunnel,rw,sec=sys,_netdev 0 0
55.38.12.141:/380BXXXXXXDCA870 /mnt/rfs2 ibmshare stunnel,rw,sec=sys,_netdev 0 0
將項目新增至 /etc/fstab 後,請執行以下指令:
mount -a
systemctl daemon-reload
這些檔案共用資料夾已掛載,並會在系統重新啟動時自動掛載。