使用自定义OpenSSL构建OpenVPN

时间:2014-06-05 14:49:44

标签: ubuntu gcc openssl openvpn

我尝试使用最新的openssl-1.0.1h构建openvpn-2.3.4。我使用--prefix=/opt/custom-openssl从源/usr/openssl-1.0.1h编译了openssl。然后我用下一行配置了openvpn源:

./configure --prefix=/opt/custom-openvpn OPENSSL_SSL_LIBS="-L/usr/openssl-1.0.1h/" OPENSSL_SSL_CFLAGS="-I/usr/openssl-1.0.1h/include/openssl/" OPENSSL_CRYPTO_LIBS="-L/usr/openssl-1.0.1h/" OPENSSL_CRYPTO_CFLAGS="-I/usr/openssl-1.0.1h/include/openssl/"

makemake install都没有错误通过但是当我检查版本时我得到了

openssl version
OpenSSL 1.0.1h Jun 5 2014 // <-------
openvpn --version
OpenVPN 2.3.4 Jun 4 2014
OpenSSL version 1.0.1f Jan 6 2014 // <------

我做错了什么?

2 个答案:

答案 0 :(得分:3)

错误是编译器使用了Ubuntu的共享对象版本。原因是上面的命令有些错误。所以,我的配置的最终版本:

./configure --prefix=/opt/custom-openvpn OPENSSL_SSL_LIBS="-L/usr/openssl-1.0.1h/ -lssl" OPENSSL_SSL_CFLAGS="-I/usr/openssl-1.0.1h/include/" OPENSSL_CRYPTO_LIBS="-L/usr/openssl-1.0.1h/ -lcrypto" OPENSSL_CRYPTO_CFLAGS="-I/usr/openssl-1.0.1h/include/"

感谢jww和http://comments.gmane.org/gmane.network.openvpn.user/34824

答案 1 :(得分:0)

我用过这个:

./configure --prefix=/opt/openvpn-2.3.6 PKG_CONFIG_LIBDIR="/opt/openssl-1.0.2/lib/pkgconfig/"

- 制作输出摘录

gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../src/compat    -I/opt/openssl-1.0.2/include   -I/opt/openssl-1.0.2/include      -g -O2 -MT base64.o -MD -MP -MF .deps/base64.Tpo -c -o base64.o base64.c
mv -f .deps/base64.Tpo .deps/base64.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../src/compat    -I/opt/openssl-1.0.2/include   -I/opt/openssl-1.0.2/include      -g -O2 -MT buffer.o -MD -MP -MF .deps/buffer.Tpo -c -o buffer.o buffer.c
mv -f .deps/buffer.Tpo .deps/buffer.Po
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../src/compat    -I/opt/openssl-1.0.2/include   -I/opt/openssl-1.0.2/include      -g -O2 -MT clinat.o -MD -MP -MF .deps/clinat.Tpo -c -o clinat.o clinat.c

OpenVPN开始输出:

$ sudo /opt/openvpn-2.3.6/sbin/openvpn --config server-no-auth.conf 
Wed Feb  4 09:40:23 2015 OpenVPN 2.3.6 x86_64-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [MH] [IPv6] built on Feb  4 2015
Wed Feb  4 09:40:23 2015 library versions: OpenSSL 1.0.2 22 Jan 2015, LZO 2.08
Wed Feb  4 09:40:23 2015 ******* WARNING *******: all encryption and authentication features disabled -- all data will be tunnelled as cleartext
Wed Feb  4 09:40:23 2015 TUN/TAP device tun0 opened
Wed Feb  4 09:40:23 2015 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Wed Feb  4 09:40:23 2015 /sbin/ifconfig tun0 172.16.1.1 pointopoint 172.16.1.2 mtu 1500
Wed Feb  4 09:40:23 2015 UDPv4 link local (bound): [undef]
Wed Feb  4 09:40:23 2015 UDPv4 link remote: [undef]