Skip to contentSkip to conversation

package/openvpn: add systemd support

PATCH Superseded aduskett at gmail.com 2 participants 9 messages Oct 28, 2019 – Oct 29, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 package/openvpn: add systemd support

From: Adam Duskett <[email protected]>

If the systemd package is selected, add the package to the dependency list and explicitly set --enable-systemd.

---
 package/openvpn/openvpn.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/openvpn/openvpn.mk +7 -0
index 4c6956fe12..75dde04493 100644
@@ -38,6 +38,13 @@ else
 OPENVPN_CONF_OPTS += --disable-lzo
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+OPENVPN_DEPENDENCIES += systemd
+OPENVPN_CONF_OPTS += --enable-systemd
+else
+OPENVPN_CONF_OPTS += --disable-systemd
+endif
+
 define OPENVPN_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 755 $(@D)/src/openvpn/openvpn \
 		$(TARGET_DIR)/usr/sbin/openvpn
Signature · 1 line
2.21.0
#1 lore raw

PATCH 2/5 package/openvpn: add libselinux support

From: Adam Duskett <[email protected]>

If the libselinux package is selected, add the package to the dependency list and explicitly set --enable-selinux.

---
 package/openvpn/openvpn.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/openvpn/openvpn.mk +7 -0
index 75dde04493..277b072deb 100644
@@ -38,6 +38,13 @@ else
 OPENVPN_CONF_OPTS += --disable-lzo
 endif
 
+ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
+OPENVPN_DEPENDENCIES += libselinux
+OPENVPN_CONF_OPTS += --enable-selinux
+else
+OPENVPN_CONF_OPTS += --disable-selinux
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD),y)
 OPENVPN_DEPENDENCIES += systemd
 OPENVPN_CONF_OPTS += --enable-systemd
Signature · 1 line
2.21.0
#2 lore raw

PATCH 2/5 package/openvpn: add libselinux support

Quoted 6 lines · aduskett at gmail.com

From: Adam Duskett <[email protected]>

If the libselinux package is selected, add the package to the dependency list and explicitly set --enable-selinux.

Applied to master, thanks.

Regards,
Arnout

Quoted 23 lines
---
 package/openvpn/openvpn.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/openvpn/openvpn.mk +7 -0
index 75dde04493..277b072deb 100644
@@ -38,6 +38,13 @@ else
 OPENVPN_CONF_OPTS += --disable-lzo
 endif
 
+ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
+OPENVPN_DEPENDENCIES += libselinux
+OPENVPN_CONF_OPTS += --enable-selinux
+else
+OPENVPN_CONF_OPTS += --disable-selinux
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD),y)
 OPENVPN_DEPENDENCIES += systemd
 OPENVPN_CONF_OPTS += --enable-systemd
#3 lore raw

PATCH 3/5 package/openvpn: enable pam plugin support

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

Add a configuration option to enable the auth-pam plugin. Explicitly set the --enable-plugin-auth-pam and depend on linux-pam if the pam-plugin option is selected.

---
 package/openvpn/openvpn.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
package/openvpn/openvpn.mk +7 -1
index 277b072deb..202f9a94af 100644
@@ -11,7 +11,6 @@ OPENVPN_DEPENDENCIES = host-pkgconf openssl
 OPENVPN_LICENSE = GPL-2.0
 OPENVPN_LICENSE_FILES = COPYRIGHT.GPL
 OPENVPN_CONF_OPTS = \
-	--disable-plugin-auth-pam \
 	--enable-iproute2 \
 	--with-crypto-library=openssl \
 	$(if $(BR2_STATIC_LIBS),--disable-plugins)
@@ -45,6 +44,13 @@ else
 OPENVPN_CONF_OPTS += --disable-selinux
 endif
 
+ifeq ($(BR2_PACKAGE_OPENVPN_PAM_PLUGIN),y)
+OPENVPN_DEPENDENCIES += linux-pam
+OPENVPN_CONF_OPTS += 	--enable-plugin-auth-pam
+else
+OPENVPN_CONF_OPTS += 	--disable-plugin-auth-pam
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD),y)
 OPENVPN_DEPENDENCIES += systemd
 OPENVPN_CONF_OPTS += --enable-systemd
Signature · 1 line
2.21.0
#4 lore raw

PATCH 3/5 package/openvpn: enable pam plugin support

Quoted 24 lines · aduskett at gmail.com

From: Adam Duskett <[email protected]>

Add a configuration option to enable the auth-pam plugin. Explicitly set the --enable-plugin-auth-pam and depend on linux-pam if the pam-plugin option is selected.

---
 package/openvpn/openvpn.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
package/openvpn/openvpn.mk +0 -1
index 277b072deb..202f9a94af 100644
@@ -11,7 +11,6 @@ OPENVPN_DEPENDENCIES = host-pkgconf openssl
 OPENVPN_LICENSE = GPL-2.0
 OPENVPN_LICENSE_FILES = COPYRIGHT.GPL
 OPENVPN_CONF_OPTS = \
-	--disable-plugin-auth-pam \
 	--enable-iproute2 \
 	--with-crypto-library=openssl \
 	$(if $(BR2_STATIC_LIBS),--disable-plugins)

package/openvpn/openvpn.mk else · line 47

Quoted 4 lines
package/openvpn/openvpn.mk +1 -0
@@ -45,6 +44,13 @@ else
 OPENVPN_CONF_OPTS += --disable-selinux
 endif
 
+ifeq ($(BR2_PACKAGE_OPENVPN_PAM_PLUGIN),y)

This symbol doesn't exist, I guess you forgot to git add your Config.in changes.

Also, can you explain (in the commit message) why you want an explicit option
for this instead of an automatic one?

package/openvpn/openvpn.mk else · line 49

Quoted 2 lines
package/openvpn/openvpn.mk +2 -0
+OPENVPN_DEPENDENCIES += linux-pam
+OPENVPN_CONF_OPTS += 	--enable-plugin-auth-pam

We normally don't use tabs to align.

Regards,
Arnout

Quoted 8 lines
package/openvpn/openvpn.mk +4 -0
+else
+OPENVPN_CONF_OPTS += 	--disable-plugin-auth-pam
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD),y)
 OPENVPN_DEPENDENCIES += systemd
 OPENVPN_CONF_OPTS += --enable-systemd
#5 lore raw

PATCH 4/5 pkcs11-helper: new package

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

pkcs11-helper is a library that simplifies the interaction with PKCS#11 providers for end-user applications. Pkcs11-helper allows using multiple PKCS#11 providers at the same time, enumerating available token certificates, or selecting a certificate directly by serialized id, handling card removal and card insert events, handling card re-insert to a different slot, supporting session expiration and much more all using a simple API.

---
 DEVELOPERS                               |  1 +
 package/Config.in                        |  1 +
 package/pkcs11-helper/Config.in          | 51 ++++++++++++++++++++++++
 package/pkcs11-helper/pkcs11-helper.hash |  3 ++
 package/pkcs11-helper/pkcs11-helper.mk   | 51 ++++++++++++++++++++++++
 5 files changed, 107 insertions(+)
 create mode 100644 package/pkcs11-helper/Config.in
 create mode 100644 package/pkcs11-helper/pkcs11-helper.hash
 create mode 100644 package/pkcs11-helper/pkcs11-helper.mk
DEVELOPERS +1 -0
index f41ac5f096..bb8ccfc916 100644
@@ -52,6 +52,7 @@ F:	package/nginx-naxsi/
 F:	package/openjdk/
 F:	package/openjdk-bin/
 F:	package/php/
+F:	package/pkcs11-helper/
 F:	package/policycoreutils/
 F:	package/python3/
 F:	package/python-aioredis/
package/Config.in +1 -0
index a1ac5069aa..91e8f02cb4 100644
@@ -1259,6 +1259,7 @@ menu "Crypto"
 	source "package/mbedtls/Config.in"
 	source "package/nettle/Config.in"
 	source "package/openssl/Config.in"
+	source "package/pkcs11-helper/Config.in"
 	source "package/rhash/Config.in"
 	source "package/tinydtls/Config.in"
 	source "package/tpm2-tss/Config.in"
package/pkcs11-helper/Config.in new file +51 -0

51 lines not on this page · raw message

package/pkcs11-helper/pkcs11-helper.hash new file +3 -0
new file mode 100644
index 0000000000..28ef74b410
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  fbcec9dd15a71d6ef22b09f63934c66d7d0292fefbaf3a60703ee4a9a73bf6a5  pkcs11-helper-pkcs11-helper-1.25.1.tar.gz
+sha256  b8a2f73f743dc1a51aff23f1aacbca4b868564db52496fa3c0caba755bfd1eaf  COPYING
package/pkcs11-helper/pkcs11-helper.mk new file +51 -0

51 lines not on this page · raw message

Signature · 1 line
2.21.0
#6 lore raw

PATCH 4/5 pkcs11-helper: new package

Quoted 10 lines · aduskett at gmail.com

From: Adam Duskett <[email protected]>

pkcs11-helper is a library that simplifies the interaction with PKCS#11 providers for end-user applications. Pkcs11-helper allows using multiple PKCS#11 providers at the same time, enumerating available token certificates, or selecting a certificate directly by serialized id, handling card removal and card insert events, handling card re-insert to a different slot, supporting session expiration and much more all using a simple API.

[snip]

Quoted 17 lines
package/pkcs11-helper/Config.in new file +17 -0
+config BR2_PACKAGE_PKCS11_HELPER
+	bool "pkcs11-helper"
+	help
+	  pkcs11-helper is a library that simplifies the interaction
+	  with PKCS#11 providers for end-user applications.
+
+	  pkcs11-helper allows using multiple PKCS#11 providers at the
+	  same time, enumerating available token certificates, or
+	  selecting a certificate directly by serialized id, handling
+	  card removal and card insert events, handling card re-insert
+	  to a different slot, supporting session expiration and much
+	  more all using a simple API.
+
+	  pkcs11-helper is not designed to manage card content, since
+	  object attributes are usually vendor specific, and 99% of
+	  application need to access existing objects in order to
+	  perform signature and decryption.

package/pkcs11-helper/Config.in line 27

Quoted 10 lines
package/pkcs11-helper/Config.in new file +10 -0
+
+	  https://github.com/OpenSC/pkcs11-helper
+
+if BR2_PACKAGE_PKCS11_HELPER
+
+config BR2_PACKAGE_PKCS11_HELPER_GNUTLS_ENGINE
+	bool "gnutls engine support"
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_USE_WCHAR
+	select BR2_PACKAGE_GNUTLS

As usual, bikeshedding over the Config.in options :-)

AFAIU, pkcs11-helper can be of limited use on its own (dumping info about
tokens, presumably it automatically connects to pcscd if available). So a crypto engine is not strictly needed. But, again AFAIU, it's real use is to serve as a plugin for the various crypto libraries so they can use the token. Is that correct?

So, I would think that the logic is that you first select your crypto
provider(s) (possibly implicitly through a package that uses a crypto provider), and then you add the pkcs11 "plugin" to it. So to me it seems more logical to use depends on gnutls than select.

But then, I wonder if it even makes sense to make it optional. Does it cost a
lot of code size to add an engine if that particular crypto library is anyway built?

I may be all wrong about this though.

I've not marked this as Changes Requested since it may be OK as is.

Quoted 39 lines
package/pkcs11-helper/Config.in new file +24 -0
+
+comment "gnutls support needs a toolchain w/ wchar, dynamic library"
+	depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS
+
+config BR2_PACKAGE_PKCS11_HELPER_MBEDTLS_ENGINE
+	bool "mbedtls engine support"
+	select BR2_PACKAGE_MBEDTLS
+
+config BR2_PACKAGE_PKCS11_HELPER_NSS_ENGINE
+	bool "nss engine support"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libnspr
+	depends on BR2_PACKAGE_LIBNSPR_ARCH_SUPPORT # libnspr
+	depends on !BR2_STATIC_LIBS
+	select BR2_PACKAGE_LIBNSS
+
+comment "nss support needs a toolchain w/ threads, dynamic library"
+	depends on BR2_PACKAGE_LIBNSPR_ARCH_SUPPORT
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
+
+config BR2_PACKAGE_PKCS11_HELPER_OPENSSL_ENGINE
+	bool "openssl engine support"
+	select BR2_PACKAGE_OPENSSL
+
+endif
package/pkcs11-helper/pkcs11-helper.hash new file +3 -0
new file mode 100644
index 0000000000..28ef74b410
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  fbcec9dd15a71d6ef22b09f63934c66d7d0292fefbaf3a60703ee4a9a73bf6a5  pkcs11-helper-pkcs11-helper-1.25.1.tar.gz
+sha256  b8a2f73f743dc1a51aff23f1aacbca4b868564db52496fa3c0caba755bfd1eaf  COPYING
package/pkcs11-helper/pkcs11-helper.mk new file +0 -0
new file mode 100644
index 0000000000..07a0c046ad

package/pkcs11-helper/pkcs11-helper.mk line 7

Quoted 7 lines
package/pkcs11-helper/pkcs11-helper.mk new file +7 -0
@@ -0,0 +1,51 @@
+################################################################################
+#
+# pkcs11-helper
+#
+################################################################################
+
+PKCS11_HELPER_VERSION = pkcs11-helper-1.25.1

This is like the v prefix: we want version as 1.25.1 and the pkcs11-helper-
prefix in the _SITE variable.

package/pkcs11-helper/pkcs11-helper.mk line 9

Quoted 2 lines
package/pkcs11-helper/pkcs11-helper.mk new file +2 -0
+PKCS11_HELPER_SITE = $(call github,OpenSC,pkcs11-helper,$(PKCS11_HELPER_VERSION))
+PKCS11_HELPER_LICENSE = GPL-2.0

COPYING says that it is GPL-2.0 OR BSD-3-Clause.

It also mentions the OpenSSL and gnutls etc. licenses, but I don't think those
sources are included so that's just wrong.

package/pkcs11-helper/pkcs11-helper.mk line 10

Quoted 1 line
package/pkcs11-helper/pkcs11-helper.mk new file +1 -0
+PKCS11_HELPER_LICENSE_FILES = COPYING

You also need to include COPYING.BSD and COPYING.GPL.

package/pkcs11-helper/pkcs11-helper.mk line 15

Quoted 5 lines
package/pkcs11-helper/pkcs11-helper.mk new file +5 -0
+PKCS11_HELPER_AUTORECONF = YES
+PKCS11_HELPER_INSTALL_STAGING = YES
+
+PKCS11_HELPER_CONF_OPTS = \
+	--disable-crypto-engine-polarssl \

Weird... polarssl is just mbedtls...

package/pkcs11-helper/pkcs11-helper.mk line 16

Quoted 1 line
package/pkcs11-helper/pkcs11-helper.mk new file +1 -0
+	--disable-crypto-engine-cryptoapi \

cryptoapi... Is that the kernel AF_CRYPTO interface? That should always be
supported then...

package/pkcs11-helper/pkcs11-helper.mk line 17

Quoted 1 line
package/pkcs11-helper/pkcs11-helper.mk new file +1 -0
+	--disable-dependency-tracking

We don't usually specify that.

Regards,
Arnout

Quoted 35 lines
package/pkcs11-helper/pkcs11-helper.mk new file +34 -0
+
+ifeq ($(BR2_PACKAGE_PKCS11_HELPER_GNUTLS_ENGINE),y)
+PKCS11_HELPER_DEPENDENCIES += gnutls
+PKCS11_HELPER_CONF_OPTS += --enable-crypto-engine-gnutls
+else
+PKCS11_HELPER_CONF_OPTS += --disable-crypto-engine-gnutls
+endif
+
+ifeq ($(BR2_PACKAGE_PKCS11_HELPER_NSS_ENGINE),y)
+PKCS11_HELPER_DEPENDENCIES += libnss
+PKCS11_HELPER_CONF_OPTS += --enable-crypto-engine-nss
+else
+PKCS11_HELPER_CONF_OPTS += --disable-crypto-engine-nss
+endif
+
+ifeq ($(BR2_PACKAGE_PKCS11_HELPER_MBEDTLS_ENGINE),y)
+PKCS11_HELPER_DEPENDENCIES += mbedtls
+PKCS11_HELPER_CONF_OPTS += --enable-crypto-engine-mbedtls
+else
+PKCS11_HELPER_CONF_OPTS += --disable-crypto-engine-mbedtls
+endif
+
+ifeq ($(BR2_PACKAGE_PKCS11_HELPER_OPENSSL_ENGINE),y)
+PKCS11_HELPER_DEPENDENCIES += openssl
+PKCS11_HELPER_CONF_OPTS += \
+	--enable-openssl \
+	--enable-crypto-engine-openssl
+else
+PKCS11_HELPER_CONF_OPTS += \
+	--disable-openssl \
+	--disable-crypto-engine-openssl
+endif
+
+$(eval $(autotools-package))
#7 lore raw

PATCH 5/5 package/openvpn: add pkcs11 support

In reply to aduskett at gmail.com

From: Adam Duskett <[email protected]>

If the pkcs11-helper package is selected, add the package to the dependency list and explicitly set --enable-pkcs11.

---
 package/openvpn/openvpn.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/openvpn/openvpn.mk +7 -0
index 202f9a94af..a01edfa8ba 100644
@@ -51,6 +51,13 @@ else
 OPENVPN_CONF_OPTS += 	--disable-plugin-auth-pam
 endif
 
+ifeq ($(BR2_PACKAGE_PKCS11_HELPER),y)
+OPENVPN_DEPENDENCIES += pkcs11-helper
+OPENVPN_CONF_OPTS += --enable-pkcs11
+else
+OPENVPN_CONF_OPTS += --disable-pkcs11
+endif
+
 ifeq ($(BR2_PACKAGE_SYSTEMD),y)
 OPENVPN_DEPENDENCIES += systemd
 OPENVPN_CONF_OPTS += --enable-systemd
Signature · 1 line
2.21.0
#8 lore raw

PATCH 1/5 package/openvpn: add systemd support

In reply to aduskett at gmail.com
Quoted 6 lines · aduskett at gmail.com

From: Adam Duskett <[email protected]>

If the systemd package is selected, add the package to the dependency list and explicitly set --enable-systemd.

Applied to master, thanks.

Regards,
Arnout

Quoted 23 lines
---
 package/openvpn/openvpn.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/openvpn/openvpn.mk +7 -0
index 4c6956fe12..75dde04493 100644
@@ -38,6 +38,13 @@ else
 OPENVPN_CONF_OPTS += --disable-lzo
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+OPENVPN_DEPENDENCIES += systemd
+OPENVPN_CONF_OPTS += --enable-systemd
+else
+OPENVPN_CONF_OPTS += --disable-systemd
+endif
+
 define OPENVPN_INSTALL_TARGET_CMDS
 	$(INSTALL) -m 755 $(@D)/src/openvpn/openvpn \
 		$(TARGET_DIR)/usr/sbin/openvpn