问题背景:项目安全加固后,只能通过堡垒机上的浏览器或者SSH命令行操作,怎么不开防火墙策略,也不用Windows客户端,通过Linux命令行直接上传文件,更新主题呢?
HCL提供一个DXSync 1.3,基于Node.js开发的(2022年停更),但是要求Node JS版本在12以上,NPM版本在6以上。
我的测试环境Ubuntu 20.04,Node JS更新到了16,还是跑不起来,放弃了。
还好有Davfs2!
配置步骤:
1)安装davfs2
root@host:~# apt install davfs2
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
libneon27
The following NEW packages will be installed:
davfs2 libneon27
0 upgraded, 2 newly installed, 0 to remove and 64 not upgraded.
Need to get 230 kB of archives.
After this operation, 658 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://172.2.2.1/ubuntu focal/universe amd64 libneon27 amd64 0.30.2-4 [94.8 kB]
Get:2 http://172.2.2.1/ubuntu focal-updates/universe amd64 davfs2 amd64 1.5.5-1ubuntu0.1 [135 kB]
Fetched 230 kB in 0s (6,636 kB/s)
Preconfiguring packages …
Selecting previously unselected package libneon27:amd64.
(Reading database … 148284 files and directories currently installed.)
Preparing to unpack …/libneon27_0.30.2-4_amd64.deb …
Progress: [ 0%] [………………………………………………………………………………………………………………………………………………………….]
Unpacking libneon27:amd64 (0.30.2-4) …………………………………………………………………………………………………………………………………………]
Selecting previously unselected package davfs2.#########………………………………………………………………………………………………………………………..]
Preparing to unpack …/davfs2_1.5.5-1ubuntu0.1_amd64.deb …
Unpacking davfs2 (1.5.5-1ubuntu0.1) …#####################################………………………………………………………………………………………………………]
Setting up libneon27:amd64 (0.30.2-4) …######################################################……………………………………………………………………………………..]
Progress: [ 56%] [#################################################################################################……………………………………………………………………]
Setting up davfs2 (1.5.5-1ubuntu0.1) …##############################################################################################…………………………………………………..]
Progress: [ 78%] [########################################################################################################################################…………………………………]
Processing triggers for man-db (2.9.1-1) …#################################################################################################################################………………..]
Processing triggers for libc-bin (2.31-0ubuntu9.16) …
2)配置davfs2的配置,将use_locks从1改为0,避免写入文件时锁定
root@host:~# sed -i ‘s/# use_locks 1/use_locks 0/g’ /etc/davfs2/davfs2.conf
3)将HCL DX的WebDAV地址和管理账号密码配到davfs2的密钥文件里
root@host:~# echo “https://172.2.1.3:10039/wps/mycontenthandler/dav/fs-type1 wpsadmin password” >> /etc/davfs2/secrets
4)添加root用户到davfs2组里
root@host:~# usermod -a -G davfs2 root
5)创建/dav目录
root@host:~# mkdir /dav
6)以DAVFS协议挂载/dav目录
root@host:~# mount -t davfs http://172.2.1.3:10039/wps/mycontenthandler/dav/fs-type1 /dav
Please enter the username to authenticate with server
http://172.2.1.3:10039/wps/mycontenthandler/dav/fs-type1 or hit enter for none.
输入账号
Username: wpsadmin
输入密码
Please enter the password to authenticate user wpsadmin with server
http://172.2.1.3:10039/wps/mycontenthandler/dav/fs-type1 or hit enter for none.
Password:
7)查看一下目录内容
root@host:~# cd /dav
root@host:/dav# ll
total 1
drwxr-xr-x 11 root root 344 Aug 9 03:23 ./
drwxr-xr-x 3 root root 0 Jul 29 04:02 common-resources/
drwxr-xr-x 2 root root 0 Jun 26 2009 iwidgets/
drwxr-xr-x 2 root root 0 Jun 26 2009 layout-templates/
drwx—— 2 root root 0 Aug 9 03:23 lost+found/
drwxr-xr-x 2 root root 0 Jun 26 2009 public/
drwxr-xr-x 2 root root 0 Jun 26 2009 skins/
drwxr-xr-x 2 root root 0 Jun 26 2009 system/
drwxr-xr-x 22 root root 0 Aug 5 05:58 themes/
drwxr-xr-x 3 root root 0 Jun 26 2009 users/
都能跟AnyClient看到的对应了