レポジトリから取得したソースの自前ビルドだとsoftetherのサーバは大丈夫だったのですが、クライアントのほうがうまく動作していなかったので、調査も兼ねてdeb パッケージを作成してみました。(5.02.5187+git20241024)調べたところsystemdサービスファイルのパッチが正常に当たらないことが原因のようでした。またvpnclietの挙動が変わったのかもしれませんが、vpncmdをローカルで起動しRemoteEnableとPasswordSetしておかないと管理端末からは接続できませんでした。
パッケージの作成は以下のようにしましたが、いわゆる野良ビルドでとりあえずパッケージにしているだけなので注意してください。
https://drive.google.com/drive/folders/1A8Vb2RaFrPsUP7CMHYGg94hlLmoSY1Vb?usp=drive_link
また当方の環境ではGUIツールをつかって、"高度な通信設定" -> "UDP 高速化機能を無効にする"にチェックを入れないとDebianクライアントはサーバへの接続が正常にできませんでしたが、これはDebian純正パッケージと同様でした。
何かの参考になれば幸いです。今回は以上です。それでは。
パッケージの作成は以下のようにしましたが、いわゆる野良ビルドでとりあえずパッケージにしているだけなので注意してください。
sudp apt-get install git build-essential devscripts dpkg-dev pkg-config libsodium-dev
sudo mkdir /usr/src/softether-vpn.deb.orig
sudo chown buildUser:buildUser /usr/src/softether-vpn.deb.orig
sudo mkdir /usr/src/softether-vpn
sudo chown buildUser:buildUser /usr/src/softether-vpn
cd /usr/src/softether-vpn.deb.orig
su buildUser
apt-get source softehter-vpn
apt-get build-dep softether-vpn
cd /usr/src/softether-vpn
git clone https://github.com/SoftEtherVPN/SoftEtherVPN
cd SoftEtherVPN
git submodule init && git submodule update
#サブモジュールを含めたソースコードの抽出
git ls-files --recurse-submodules | tar caf ../softether-vpn-5.02.5187+git20241024.orig.tar.gz --xform s:^:softether-vpn-5.02.5187+git20241024/: --verbatim-files-from -T-
pwd
cd /usr/src/software-vpn
tar xzf softether-vpn-5.02.5187+git20241024.orig.tar.gz
tar xJf ../softether-vpn.deb.orig/softether-vpn_5.01.9674+git20200806+8181039+dfsg2-2.debian.tar.xz
# debian/rulesを以下のように変更(makefileなので行頭の空白はタブです。)
================================
#!/usr/bin/make -f
include /usr/share/dpkg/architecture.mk
export DH_VERBOSE=1
%:
dh $@ --buildsystem=cmake --builddirectory=$(CURDIR)/build
override_dh_auto_configure:
mkdir -p src/Mayaqua/3rdparty/cpu_features/
touch src/Mayaqua/3rdparty/cpu_features/CMakeLists.txt
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH=/usr -DSE_PIDDIR=/run/softether \
-DSE_LOGDIR=/var/log/softether -DSE_DBDIR=/var/lib/softether" ./configure
================================
# debian/patches/fix-systemd-units.patch を以下のように変更
===============================
diff -urN a/systemd/softether-vpnbridge.service b/systemd/softether-vpnbridge.service
--- a/systemd/softether-vpnbridge.service 2024-10-24 02:03:51.000000000 +0900
+++ b/systemd/softether-vpnbridge.service 2024-10-24 02:18:01.046014372 +0900
@@ -1,19 +1,22 @@
[Unit]
Description=SoftEther VPN Bridge
After=network.target auditd.service
-ConditionPathExists=!@DIR@/softether/vpnbridge/do_not_run
[Service]
-Type=exec
-ExecStart=@DIR@/softether/vpnbridge/vpnbridge execsvc
+Type=forking
+EnvironmentFile=-/etc/defaults/softether-vpnbridge
+ExecStart=/usr/libexec/softether/vpnbridge/vpnbridge start
+ExecStop=/usr/libexec/softether/vpnbridge/vpnbridge stop
+KillMode=process
Restart=on-failure
# Hardening
PrivateTmp=yes
ProtectHome=yes
-ProtectSystem=full
-ReadOnlyDirectories=/
-ReadWriteDirectories=-@DIR@/softether/vpnbridge
+ProtectSystem=strict
+RuntimeDirectory=softether
+StateDirectory=softether
+LogsDirectory=softether
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYSLOG CAP_SETUID
[Install]
diff -urN a/systemd/softether-vpnclient.service b/systemd/softether-vpnclient.service
--- a/systemd/softether-vpnclient.service 2024-10-24 02:03:51.000000000 +0900
+++ b/systemd/softether-vpnclient.service 2024-10-24 02:18:01.030014310 +0900
@@ -1,19 +1,22 @@
[Unit]
Description=SoftEther VPN Client
After=network.target auditd.service
-ConditionPathExists=!@DIR@/softether/vpnclient/do_not_run
[Service]
-Type=exec
-ExecStart=@DIR@/softether/vpnclient/vpnclient execsvc
+Type=forking
+EnvironmentFile=-/etc/defaults/softether-vpnclient
+ExecStart=/usr/libexec/softether/vpnclient/vpnclient start
+ExecStop=/usr/libexec/softether/vpnclient/vpnclient stop
+KillMode=process
Restart=on-failure
# Hardening
PrivateTmp=yes
ProtectHome=yes
-ProtectSystem=full
-ReadOnlyDirectories=/
-ReadWriteDirectories=-@DIR@/softether/vpnclient
+ProtectSystem=strict
+RuntimeDirectory=softether
+StateDirectory=softether
+LogsDirectory=softether
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYSLOG CAP_SETUID
[Install]
diff -urN a/systemd/softether-vpnserver.service b/systemd/softether-vpnserver.service
--- a/systemd/softether-vpnserver.service 2024-10-24 02:03:51.000000000 +0900
+++ b/systemd/softether-vpnserver.service 2024-10-24 02:18:01.014014247 +0900
@@ -1,20 +1,23 @@
[Unit]
Description=SoftEther VPN Server
After=network.target auditd.service
-ConditionPathExists=!@DIR@/softether/vpnserver/do_not_run
[Service]
-Type=exec
-TasksMax=infinity
-ExecStart=@DIR@/softether/vpnserver/vpnserver execsvc
+Type=forking
+TasksMax=16777216
+EnvironmentFile=-/etc/defaults/softether-vpnserver
+ExecStart=/usr/libexec/softether/vpnserver/vpnserver start
+ExecStop=/usr/libexec/softether/vpnserver/vpnserver stop
+KillMode=process
Restart=on-failure
# Hardening
PrivateTmp=yes
ProtectHome=yes
-ProtectSystem=full
-ReadOnlyDirectories=/
-ReadWriteDirectories=-@DIR@/softether/vpnserver
+ProtectSystem=strict
+RuntimeDirectory=softether
+StateDirectory=softether
+LogsDirectory=softether
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYSLOG CAP_SETUID
[Install]
===============================
# debian/*.installを以下のようにそれぞれ変更
========
# debian/softether-common.install
#/usr/lib/*/*/lib*.so
build/hamcore.se2 /usr/share/softether-common/
========
# debian/softether-vpnbridge.install
build/vpnbridge /usr/libexec/softether/vpnbridge/
/usr/bin/vpnbridge
/lib/systemd/system/*vpnbridge.service
========
# debian/softether-vpnclient.install
build/vpnclient /usr/libexec/softether/vpnclient/
/usr/bin/vpnclient
/lib/systemd/system/*vpnclient.service
========
# debian/softether-vpncmd.install
build/vpncmd /usr/libexec/softether/vpncmd/
/usr/bin/vpncmd
========
# debian/softether-vpnserver.install
build/vpnserver /usr/libexec/softether/vpnserver/
/usr/bin/vpnserver
/lib/systemd/system/*vpnserver.service
========
cd debian
#dchコマンドにて適当にリリース理由などを書く
dch
cd ..
===============================
cp -a debian softether-vpn-5.02.5187+git20241024
cd softether-vpn-5.02.5187+git20241024
# ビルド
dpkg-buildpackage -nc -b
#手元の12C24Tマシンで約2分
cd ..
ls *.deb
softether-common_5.02.5187+git20241024_amd64.deb
softether-vpnbridge-dbgsym_5.02.5187+git20241024_amd64.deb
softether-vpnbridge_5.02.5187+git20241024_amd64.deb
softether-vpnclient-dbgsym_5.02.5187+git20241024_amd64.deb
softether-vpnclient_5.02.5187+git20241024_amd64.deb
softether-vpncmd-dbgsym_5.02.5187+git20241024_amd64.deb
softether-vpncmd_5.02.5187+git20241024_amd64.deb
softether-vpnserver-dbgsym_5.02.5187+git20241024_amd64.deb
softether-vpnserver_5.02.5187+git20241024_amd64.deb
パッケージ作成の詳細は以上です。ソースも公開しているので参考にしてみてください。https://drive.google.com/drive/folders/1A8Vb2RaFrPsUP7CMHYGg94hlLmoSY1Vb?usp=drive_link
また当方の環境ではGUIツールをつかって、"高度な通信設定" -> "UDP 高速化機能を無効にする"にチェックを入れないとDebianクライアントはサーバへの接続が正常にできませんでしたが、これはDebian純正パッケージと同様でした。
何かの参考になれば幸いです。今回は以上です。それでは。
コメント
コメントを投稿