sudo apt-get install git
git clone
sudo apt-get install libgnutls28-dev libev-dev libwrap0-dev libpam0g-dev liblz4-dev libseccomp-dev libreadline-dev libnl-route-3-dev libkrb5-dev liboath-dev
sudo apt-get install autoconf libprotobuf-c0-dev libtalloc-dev libhttp-parser-dev libpcl1-dev libopts25-dev autogen protobuf-c-compiler gperf liblockfile-bin nuttcp lcov
sudo apt-get install gnutls-bin
cd ocserv
autoreconf -fvi
./configure && make
cd ..
mkdir certificates
ca.tmpl
cn = "haizhivpn"
organization = "haizhi"
serial = 1
expiration_days = 3650
ca
signing_key
cert_signing_key
crl_signing_key
server.tmpl
cn = "X.X.X.X"
organization = "haizhi"
serial = 2
expiration_days = 3650
signing_key
encryption_key
tls_www_server
certtool --generate-privkey --outfile ca-key.pem
certtool --generate-self-signed --load-privkey ca-key.pem --template ca.tmpl --outfile ca-cert.pem
certtool --generate-privkey --outfile server-key.pem
certtool --generate-certificate --load-privkey server-key.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem --template server.tmpl --outfile server-cert.pem
sudo mkdir -p /etc/ocserv/
sudo cp server-cert.pem server-key.pem ca-cert.pem /etc/ocserv/
cd ../ocserv
sudo cp doc/sample.config /etc/ocserv/ocserv.conf
sudo vi /etc/ocserv/ocserv.conf
auth = "plain[/etc/ocserv/ocpasswd]"
tcp-port = 9000
udp-port = 9001
server-cert = /etc/ocserv/server-cert.pem
server-key = /etc/ocserv/server-key.pem
ca-cert = /etc/ocserv/ca-cert.pem
max-clients = 32
try-mtu-discovery = true
ipv4-network = 192.168.5.254
ipv4-netmask = 255.255.255.0
dns = 8.8.8.8
#route = 10.10.10.0/255.255.255.0
#route = 192.168.0.0/255.255.0.0
cd /home/admin/ocserv/src/ocpasswd/
sudo ./ocpasswd -c /etc/ocserv/ocpasswd haizhivpn
...password
sudo iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
sudo iptables-save
cd ..
sudo ./ocserv -f -d 1
参考文章:
阅读(2702) | 评论(0) | 转发(0) |