openfortivpn: add user, key, CA PEM support
authorMatthew Hagan <redacted>
Thu, 14 Oct 2021 18:53:53 +0000 (19:53 +0100)
committerRosen Penev <redacted>
Sat, 30 Oct 2021 08:07:49 +0000 (01:07 -0700)
Allow authentication inputs by key/cert PEM.

Signed-off-by: Matthew Hagan <redacted>
net/openfortivpn/Makefile
net/openfortivpn/files/openfortivpn.sh
net/openfortivpn/files/openfortivpn.upgrade [new file with mode: 0644]

index 41068180cde6c326d8729c8e396f96527fcbad93..c5b0d8ac31fc66bbbc66165e0f497e319b3fd1bc 100644 (file)
@@ -54,12 +54,15 @@ define Package/openfortivpn/install
        $(INSTALL_DIR) \
          $(1)/usr/sbin \
           $(1)/lib/netifd/proto \
-         $(1)/etc/hotplug.d/iface
+         $(1)/etc/hotplug.d/iface \
+         $(1)/etc/openfortivpn \
+         $(1)/lib/upgrade/keep.d
 
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openfortivpn $(1)/usr/sbin/
        $(INSTALL_BIN) ./files/openfortivpn-wrapper $(1)/usr/sbin/
        $(INSTALL_BIN) ./files/openfortivpn.sh $(1)/lib/netifd/proto/
        $(INSTALL_BIN) ./files/openfortivpn-ppp-up $(1)/lib/netifd/openfortivpn-ppp-up
+       $(INSTALL_DATA) ./files/openfortivpn.upgrade $(1)/lib/upgrade/keep.d/openfortivpn
 endef
 
 $(eval $(call BuildPackage,openfortivpn))
index 098d7546b769a2e5d1eb97d9b876510647cea806..929a0772ad5ce588b43ebd19ef1a74fa8508e6a8 100755 (executable)
@@ -132,6 +132,10 @@ proto_openfortivpn_setup() {
                mkdir -p '/var/etc/openfortivpn/peers'
        }
 
+       [ -f /etc/openfortivpn/user-cert-$config.pem ] && append_args "--user-cert=/etc/openfortivpn/user-cert-$config.pem"
+       [ -f /etc/openfortivpn/user-key-$config.pem ] && append_args "--user-key=/etc/openfortivpn/user-key-$config.pem"
+       [ -f /etc/openfortivpn/ca-$config.pem ] && append_args "--ca-file=/etc/openfortivpn/ca-$config.pem"
+
        callfile="/var/etc/openfortivpn/peers/$config"
        echo "115200
 :$local_ip
diff --git a/net/openfortivpn/files/openfortivpn.upgrade b/net/openfortivpn/files/openfortivpn.upgrade
new file mode 100644 (file)
index 0000000..77f4402
--- /dev/null
@@ -0,0 +1,3 @@
+/etc/openfortivpn/user-cert-*.pem
+/etc/openfortivpn/user-key-*.pem
+/etc/openfortivpn/ca-*.pem
git clone https://git.99rst.org/PROJECT