OpenConnect 编译笔记
准备工作
解决依赖
服务器环境 CentOS release 6.7 (Final)
$sudo yum install gmp gmp-devel libnl libnl3 readline liboath
下载软件
nettle
$wget https://ftp.gnu.org/gnu/nettle/nettle-3.2.tar.gz
$wget https://ftp.gnu.org/gnu/nettle/nettle-3.2.tar.gz.sig
$gpg --keyserver pgp.mit.edu --search-keys 0x28C67298
按提示导入开发者 Niels Möller 的 GPG 公钥
$gpg --verify nettle-3.2.tar.gz.sig
签名正确才能继续。
Unbound
$wget https://unbound.net/downloads/unbound-latest.tar.gz
$wget https://unbound.net/downloads/unbound-1.5.8.tar.gz.asc
$gpg --keyserver pgp.mit.edu --search-keys 0x7E045F8D
按提示导入开发者 W.C.A. Wijngaards 的 GPG 公钥
$gpg --verify unbound-1.5.8.tar.gz.asc
签名正确才能继续。
Libtasn1
GnuTLS
$wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.4/gnutls-3.4.9.tar.xz
$wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.4/gnutls-3.4.9.tar.xz.sig
仍然用 Nikos Mavrogiannopoulos 的 GPG 公钥来验证签名
$gpg --verify gnutls-3.4.9.tar.xz.sig
签名正确才能继续。
libev4
OpenConnect VPN Server (ocserv)
$wget ftp://ftp.infradead.org/pub/ocserv/ocserv-0.11.0rc1.tar.xz
$wget ftp://ftp.infradead.org/pub/ocserv/ocserv-0.11.0rc1.tar.xz.sig
仍然用 Nikos Mavrogiannopoulos 的 GPG 公钥来验证签名
$gpg --verify ocserv-0.11.0rc1.tar.xz.sig
签名正确才能继续。
注意,早期的包用的不是这个 GPG 公钥签的,所以这里下载的是 ocserv-0.11.0rc1.tar.xz 。
编译 nettle
$tar xzvf nettle-3.2.tar.gz && cd nettle-3.2
$sudo ./configure --prefix=/usr && make && sudo make install
$sudo chmod -v 755 /usr/lib64/libhogweed.so.4.2 /usr/lib64/libnettle.so.6.2 /usr/lib64/libnettle.a
$cd -
编译 Unbound
$tar xzvf unbound-1.5.8.tar.gz && cd unbound
$./configure && make && sudo make install
$sudo mkdir -p /etc/unbound && sudo /usr/local/sbin/unbound-anchor -a "/etc/unbound/root.key"
$cd -
编译 Libtasn1
$tar xzvf libtasn1-4.7.tar.gz && cd libtasn1-4.7
$./configure && make && sudo make install
$cd -
编译 GnuTLS
$tar xvf gnutls-3.4.9.tar.xz && cd gnutls-3.4.9
$./configure --with-included-libtasn1 --without-p11-kit && make && sudo make install
$cd -
编译 libev4
$tar xzvf libev-4.22.tar.gz && cd libev-4.22
$.configure && make && sudo make install
$cd -
编译 ocserv
修改环境变量
$export LD_LIBRARY_PATH=/usr/lib/:/usr/lib64/ NETTLE_CFLAGS="-I /usr/include/" NETTLE_LIBS="-L /usr/lib64/ -l nettle" HOGWEED_CFLAGS="-I /usr/include" HOGWEED_LIBS="-L /usr/lib64/ -l hogweed"
$export LD_LIBRARY_PATH=/usr/lib/:/usr/lib64/ LIBGNUTLS_CFLAGS="-I /usr/include/" LIBGNUTLS_LIBS="-L /usr/lib/ -l gnutls" LIBNL3_CFLAGS="-I /usr/include" LIBNL3_LIBS="-L /usr/lib/ -l nl-3 -lnl-route-3"
$tar xvf ocserv-0.11.0rc1.tar.xz && cd ocserv-0.11.0rc1
$cp -R libopts/ src/
$cp -R src/protobuf/protobuf-c/ src/protobuf-c/
上面这两个文件夹要改一下位置,不然 make 不过
$./configure --without-protobuf && make && sudo make install
$cd -
配置
签证书
配置 ocserv.conf
编译的是最新版,所以直接用 ocserv-cn-no-route 路由表,绕过中国大陆地址。
评论(0)