Skip to contentSkip to conversation

FreeBSD+cryptodev testers wanted

Openvpn-devel Steffan Karger 4 participants 8 messages Mar 30, 2015 – Apr 7, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

See https://community.openvpn.net/openvpn/ticket/480

A bug was reported when using openvpn in daemon mode (--daemon), in combination with the OpenSSL cryptodev engine on FreeBSD. The originally proposed patch is reported to fix the problem, but caused a change in the interpretation of config files, so was NAK'ed. I proposed an alternative patch, which I believe will fix the issue without changing config file interpretation, but I do not have a set up to verify this.

So, is there anyone with a FreeBSD machine with cryptodev engine available who is willing to test the patch?

Thanks,
-Steffan

#1 lore raw

Hi,

Quoted 2 lines · Steffan Karger

So, is there anyone with a FreeBSD machine with cryptodev engine available who is willing to test the patch?

Actually, testing on other platforms using any sort of OpenSSL "engine" (usually hardware crypto accelerators etc.) is welcome - the patch will not affect anyone else, so it's not easy to test.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#2 lore raw
Quoted 9 lines · Gert Doering

Hi,

Quoted 2 lines · Steffan Karger

So, is there anyone with a FreeBSD machine with cryptodev engine available who is willing to test the patch?

Actually, testing on other platforms using any sort of OpenSSL "engine" (usually hardware crypto accelerators etc.) is welcome - the patch will not affect anyone else, so it's not easy to test.

I am not able to reproduce this. The server

# kldstat | grep aes
 2    1 0xffffffff80fbf000 5a28     aesni.ko
# sysctl -A dev.aesni
dev.aesni.%parent:
dev.aesni.0.%desc: AES-CBC,AES-XTS
dev.aesni.0.%driver: aesni
dev.aesni.0.%location:
dev.aesni.0.%pnpinfo:
dev.aesni.0.%parent: nexus0

tls-server
mode server
daemon openvpn-hq
user root
group wheel
local 1.1.1.2
proto udp
dev tun102
engine cryptodev
cipher AES-128-CBC # AES

FreeBSD 10.1-STABLE #6 r280386: Mon Mar 23 13:53:00 EDT 2015

# openvpn  --version
OpenVPN 2.3.6 amd64-portbld-freebsd10.1 [SSL (OpenSSL)] [LZO] [MH] [IPv6] built on Feb  9 2015
library versions: OpenSSL 1.0.1m-freebsd 19 Mar 2015, LZO 2.09
Originally developed by James Yonan
Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <[email protected]...>
Compile time defines: enable_crypto=yes enable_crypto_ofb_cfb=yes enable_debug=yes enable_def_auth=yes enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown enable_fast_install=needless enable_fragment=yes enable_http_proxy=yes enable_iproute2=no enable_libtool_lock=yes enable_lzo=yes enable_lzo_stub=no enable_management=yes enable_multi=yes enable_multihome=yes enable_pam_dlopen=no enable_password_save=yes enable_pedantic=no enable_pf=yes enable_pkcs11=no enable_plugin_auth_pam=yes enable_plugin_down_root=yes enable_plugins=yes enable_port_share=yes enable_selinux=no enable_server=yes enable_shared=yes enable_shared_with_static_runtimes=no enable_small=no enable_socks=yes enable_ssl=yes enable_static=yes enable_strict=no enable_strict_options=no enable_systemd=no enable_win32_dll=yes enable_x509_alt_username=no with_crypto_library=openssl with_gnu_ld=yes with_mem_check=no with_plugindir='$(libdir)/openvpn/plugins' with_sysroot=no

I have in the kernel of this server

device crypto
device cryptodev
options IPSEC
device pf
device pflog

Are there any special configs that need to be done to openssl ?

# openssl engine
(cryptodev) BSD cryptodev engine
(rsax) RSAX engine support
(rdrand) Intel RDRAND engine
(dynamic) Dynamic engine loading support

I had a client connect and disconnect and was able to pass traffic across the tunnel

	---Mike
Signature · 5 lines
-------------------
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, [email protected]...
Providing Internet services since 1994 www.sentex.net
Cambridge, Ontario Canada   http://www.tancsa.com/
#3 lore raw

Hi,

Quoted 1 line · Mike Tancsa

I am not able to reproduce this.

You need to use --daemon to make openvpn fork(). Otherwise, it will "just work", but after forking, the cryptodev file descriptor is no longer valid -> boom. Steffan's patch should fix that.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#4 lore raw
Quoted 8 lines · Gert Doering

Hi,

Quoted 1 line · Mike Tancsa

I am not able to reproduce this.

You need to use --daemon to make openvpn fork(). Otherwise, it will "just work", but after forking, the cryptodev file descriptor is no longer valid -> boom. Steffan's patch should fix that.

Hi,
Is having in the config

daemon openvpn-hq

not the same as --daemon from the arguments ?

	---Mike
Signature · 5 lines
-------------------
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, [email protected]...
Providing Internet services since 1994 www.sentex.net
Cambridge, Ontario Canada   http://www.tancsa.com/
#5 lore raw
Quoted 10 lines · Mike Tancsa
Quoted 8 lines · Gert Doering

Hi,

Quoted 1 line · Mike Tancsa

I am not able to reproduce this.

You need to use --daemon to make openvpn fork(). Otherwise, it will "just work", but after forking, the cryptodev file descriptor is no longer valid -> boom. Steffan's patch should fix that.

Quoted 6 lines

Hi,
Is having in the config

daemon openvpn-hq

not the same as --daemon from the arguments ?

commenting out daemon in the config, and starting it up with

openvpn --daemon --config /usr/local/etc/openvpn/openvpn.conf

also works for me. Perhaps its the way the engine is loaded with this version of openssl in the base of FreeBSD ?

# openssl engine -t -c
(cryptodev) BSD cryptodev engine
 [RSA, DSA, DH, AES-128-CBC, AES-192-CBC, AES-256-CBC]
     [ available ]
(rsax) RSAX engine support
 [RSA]
     [ available ]
(rdrand) Intel RDRAND engine
 [RAND]
     [ available ]
(dynamic) Dynamic engine loading support
     [ unavailable ]
	---Mike
Signature · 5 lines
-------------------
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, [email protected]...
Providing Internet services since 1994 www.sentex.net
Cambridge, Ontario Canada   http://www.tancsa.com/
#6 lore raw
In reply to Mike Tancsa

Hi,

Quoted 8 lines · Mike Tancsa
Quoted 6 lines · Gert Doering
Quoted 1 line · Mike Tancsa

I am not able to reproduce this.

You need to use --daemon to make openvpn fork(). Otherwise, it will "just work", but after forking, the cryptodev file descriptor is no longer valid -> boom. Steffan's patch should fix that.

Quoted 6 lines

Hi,
Is having in the config

daemon openvpn-hq

not the same as --daemon from the arguments ?

It is, sorry, did not look closely enough.

The fact that this just works for you is... surprising. So maybe it's a different FreeBSD version, or different openssl, or whatnot... unfortunately, the original bug report

https://redmine.pfsense.org/issues/3966

does not list FreeBSD version or OpenSSL version, only pfsense version (2.2) - which does seem to be FreeBSD 10.1-p4, though...

Mmmh.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#7 lore raw

Am 31.03.2015 um 19:19 schrieb Gert Doering:

Quoted 20 lines

Hi,

Quoted 8 lines · Mike Tancsa
Quoted 6 lines · Gert Doering
Quoted 1 line · Mike Tancsa

I am not able to reproduce this.

You need to use --daemon to make openvpn fork(). Otherwise, it will "just work", but after forking, the cryptodev file descriptor is no longer valid -> boom. Steffan's patch should fix that.

Quoted 6 lines

Hi,
Is having in the config

daemon openvpn-hq

not the same as --daemon from the arguments ?

It is, sorry, did not look closely enough.

Quoted 8 lines

The fact that this just works for you is... surprising. So maybe it's a different FreeBSD version, or different openssl, or whatnot... unfortunately, the original bug report

https://redmine.pfsense.org/issues/3966

does not list FreeBSD version or OpenSSL version, only pfsense version (2.2) - which does seem to be FreeBSD 10.1-p4, though...

So the feedback of the original reporter arrived,
<https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195004#c7>

and Steffan Karger also chimed in there, and there's a new patch for testing up on
<https://community.openvpn.net/openvpn/raw-attachment/ticket/480/150406-Reload-OpenSSL-engines-after-forking-v2.patch>
in OpenVPN's ticket #480.