-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
committed
Jan 25, 2021
0 parents
commit 9f81f68
Showing
5 changed files
with
994 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
From alpine:latest | ||
MAINTAINER Pezhvak | ||
|
||
ARG ORGANIZATION="My Corp" | ||
ARG DOMAIN="example.com" | ||
ARG PORT=1243 | ||
|
||
RUN apk update && apk add musl-dev iptables gnutls-dev readline-dev libnl3-dev lz4-dev libseccomp-dev@testing | ||
|
||
RUN buildDeps="xz openssl gcc autoconf make linux-headers libev-dev"; \ | ||
set -x \ | ||
&& apk add $buildDeps \ | ||
&& cd \ | ||
&& wget http://ocserv.gitlab.io/www/download.html -O download.html \ | ||
&& OC_VERSION=`sed -n 's/^.*version is <b>\(.*\)$/\1/p' download.html` \ | ||
&& OC_FILE="ocserv-$OC_VERSION" \ | ||
&& rm -fr download.html \ | ||
&& wget ftp://ftp.infradead.org/pub/ocserv/$OC_FILE.tar.xz \ | ||
&& tar xJf $OC_FILE.tar.xz \ | ||
&& rm -fr $OC_FILE.tar.xz \ | ||
&& cd $OC_FILE \ | ||
&& sed -i '/#define DEFAULT_CONFIG_ENTRIES /{s/96/200/}' src/vpn.h \ | ||
&& ./configure \ | ||
&& make -j"$(nproc)" \ | ||
&& make install \ | ||
&& mkdir -p /etc/ocserv \ | ||
&& cd \ | ||
&& rm -rf ./$OC_FILE \ | ||
&& apk del --purge $buildDeps | ||
|
||
COPY cn-no-route.txt /tmp/ | ||
RUN set -x \ | ||
&& sed -i "s/tcp-port = 443/tcp-port = ${PORT}/" /etc/ocserv/ocserv.conf \ | ||
&& sed -i "s/udp-port = 443/udp-port = ${PORT}/" /etc/ocserv/ocserv.conf \ | ||
&& sed -i 's/^no-route/#no-route/' /etc/ocserv/ocserv.conf \ | ||
&& cat /tmp/cn-no-route.txt >> /etc/ocserv/ocserv.conf \ | ||
&& rm -fr /tmp/cn-no-route.txt | ||
&& touch /etc/ocserv/ocpaswd | ||
|
||
WORKDIR /etc/ocserv | ||
|
||
COPY docker-entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
EXPOSE $PORT | ||
CMD ["ocserv", "-c", "/etc/ocserv/ocserv.conf", "-f"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
no-route = 1.0.0.0/255.192.0.0 | ||
no-route = 1.64.0.0/255.224.0.0 | ||
no-route = 1.112.0.0/255.248.0.0 | ||
no-route = 1.176.0.0/255.240.0.0 | ||
no-route = 1.192.0.0/255.240.0.0 | ||
no-route = 14.0.0.0/255.224.0.0 | ||
no-route = 14.96.0.0/255.224.0.0 | ||
no-route = 14.128.0.0/255.224.0.0 | ||
no-route = 14.192.0.0/255.224.0.0 | ||
no-route = 27.0.0.0/255.192.0.0 | ||
no-route = 27.96.0.0/255.224.0.0 | ||
no-route = 27.128.0.0/255.224.0.0 | ||
no-route = 27.176.0.0/255.240.0.0 | ||
no-route = 27.192.0.0/255.224.0.0 | ||
no-route = 27.224.0.0/255.252.0.0 | ||
no-route = 36.0.0.0/255.192.0.0 | ||
no-route = 36.96.0.0/255.224.0.0 | ||
no-route = 36.128.0.0/255.192.0.0 | ||
no-route = 36.192.0.0/255.224.0.0 | ||
no-route = 36.240.0.0/255.240.0.0 | ||
no-route = 39.0.0.0/255.255.0.0 | ||
no-route = 39.64.0.0/255.224.0.0 | ||
no-route = 39.96.0.0/255.240.0.0 | ||
no-route = 39.128.0.0/255.192.0.0 | ||
no-route = 40.72.0.0/255.254.0.0 | ||
no-route = 40.125.128.0/255.255.128.0 | ||
no-route = 40.126.64.0/255.255.192.0 | ||
no-route = 42.0.0.0/255.248.0.0 | ||
no-route = 42.48.0.0/255.240.0.0 | ||
no-route = 42.80.0.0/255.240.0.0 | ||
no-route = 42.96.0.0/255.224.0.0 | ||
no-route = 42.128.0.0/255.128.0.0 | ||
no-route = 43.224.0.0/255.224.0.0 | ||
no-route = 45.64.0.0/255.255.128.0 | ||
no-route = 45.112.0.0/255.240.0.0 | ||
no-route = 47.92.0.0/255.252.0.0 | ||
no-route = 47.96.0.0/255.224.0.0 | ||
no-route = 49.0.0.0/255.248.0.0 | ||
no-route = 49.48.0.0/255.248.0.0 | ||
no-route = 49.64.0.0/255.224.0.0 | ||
no-route = 49.112.0.0/255.240.0.0 | ||
no-route = 49.128.0.0/255.224.0.0 | ||
no-route = 49.208.0.0/255.240.0.0 | ||
no-route = 49.224.0.0/255.224.0.0 | ||
no-route = 52.80.0.0/255.252.0.0 | ||
no-route = 54.222.0.0/255.254.0.0 | ||
no-route = 58.0.0.0/255.128.0.0 | ||
no-route = 58.128.0.0/255.224.0.0 | ||
no-route = 58.192.0.0/255.224.0.0 | ||
no-route = 58.240.0.0/255.240.0.0 | ||
no-route = 59.32.0.0/255.224.0.0 | ||
no-route = 59.64.0.0/255.224.0.0 | ||
no-route = 59.96.0.0/255.240.0.0 | ||
no-route = 59.144.0.0/255.240.0.0 | ||
no-route = 59.160.0.0/255.224.0.0 | ||
no-route = 59.192.0.0/255.192.0.0 | ||
no-route = 60.0.0.0/255.224.0.0 | ||
no-route = 60.48.0.0/255.240.0.0 | ||
no-route = 60.160.0.0/255.224.0.0 | ||
no-route = 60.192.0.0/255.192.0.0 | ||
no-route = 61.0.0.0/255.192.0.0 | ||
no-route = 61.80.0.0/255.248.0.0 | ||
no-route = 61.128.0.0/255.192.0.0 | ||
no-route = 61.224.0.0/255.224.0.0 | ||
no-route = 91.234.36.0/255.255.255.0 | ||
no-route = 101.0.0.0/255.128.0.0 | ||
no-route = 101.128.0.0/255.224.0.0 | ||
no-route = 101.192.0.0/255.240.0.0 | ||
no-route = 101.224.0.0/255.224.0.0 | ||
no-route = 103.0.0.0/255.192.0.0 | ||
no-route = 103.192.0.0/255.240.0.0 | ||
no-route = 103.224.0.0/255.224.0.0 | ||
no-route = 106.0.0.0/255.128.0.0 | ||
no-route = 106.224.0.0/255.240.0.0 | ||
no-route = 110.0.0.0/255.128.0.0 | ||
no-route = 110.144.0.0/255.240.0.0 | ||
no-route = 110.160.0.0/255.224.0.0 | ||
no-route = 110.192.0.0/255.192.0.0 | ||
no-route = 111.0.0.0/255.192.0.0 | ||
no-route = 111.64.0.0/255.224.0.0 | ||
no-route = 111.112.0.0/255.240.0.0 | ||
no-route = 111.128.0.0/255.192.0.0 | ||
no-route = 111.192.0.0/255.224.0.0 | ||
no-route = 111.224.0.0/255.240.0.0 | ||
no-route = 112.0.0.0/255.128.0.0 | ||
no-route = 112.128.0.0/255.240.0.0 | ||
no-route = 112.192.0.0/255.252.0.0 | ||
no-route = 112.224.0.0/255.224.0.0 | ||
no-route = 113.0.0.0/255.128.0.0 | ||
no-route = 113.128.0.0/255.240.0.0 | ||
no-route = 113.192.0.0/255.192.0.0 | ||
no-route = 114.16.0.0/255.240.0.0 | ||
no-route = 114.48.0.0/255.240.0.0 | ||
no-route = 114.64.0.0/255.192.0.0 | ||
no-route = 114.128.0.0/255.240.0.0 | ||
no-route = 114.192.0.0/255.192.0.0 | ||
no-route = 115.0.0.0/255.0.0.0 | ||
no-route = 116.0.0.0/255.0.0.0 | ||
no-route = 117.0.0.0/255.128.0.0 | ||
no-route = 117.128.0.0/255.192.0.0 | ||
no-route = 118.16.0.0/255.240.0.0 | ||
no-route = 118.64.0.0/255.192.0.0 | ||
no-route = 118.128.0.0/255.128.0.0 | ||
no-route = 119.0.0.0/255.128.0.0 | ||
no-route = 119.128.0.0/255.192.0.0 | ||
no-route = 119.224.0.0/255.224.0.0 | ||
no-route = 120.0.0.0/255.192.0.0 | ||
no-route = 120.64.0.0/255.224.0.0 | ||
no-route = 120.128.0.0/255.240.0.0 | ||
no-route = 120.192.0.0/255.192.0.0 | ||
no-route = 121.0.0.0/255.128.0.0 | ||
no-route = 121.192.0.0/255.192.0.0 | ||
no-route = 122.0.0.0/254.0.0.0 | ||
no-route = 124.0.0.0/255.0.0.0 | ||
no-route = 125.0.0.0/255.128.0.0 | ||
no-route = 125.160.0.0/255.224.0.0 | ||
no-route = 125.192.0.0/255.192.0.0 | ||
no-route = 137.59.88.0/255.255.252.0 | ||
no-route = 139.0.0.0/255.224.0.0 | ||
no-route = 139.128.0.0/255.128.0.0 | ||
no-route = 140.64.0.0/255.240.0.0 | ||
no-route = 140.128.0.0/255.240.0.0 | ||
no-route = 140.192.0.0/255.192.0.0 | ||
no-route = 144.0.0.0/255.255.0.0 | ||
no-route = 144.7.0.0/255.255.0.0 | ||
no-route = 144.12.0.0/255.255.0.0 | ||
no-route = 144.52.0.0/255.255.0.0 | ||
no-route = 144.123.0.0/255.255.0.0 | ||
no-route = 144.255.0.0/255.255.0.0 | ||
no-route = 150.0.0.0/255.255.0.0 | ||
no-route = 150.96.0.0/255.224.0.0 | ||
no-route = 150.128.0.0/255.240.0.0 | ||
no-route = 150.192.0.0/255.192.0.0 | ||
no-route = 152.104.128.0/255.255.128.0 | ||
no-route = 153.0.0.0/255.192.0.0 | ||
no-route = 153.96.0.0/255.224.0.0 | ||
no-route = 157.0.0.0/255.255.0.0 | ||
no-route = 157.18.0.0/255.255.0.0 | ||
no-route = 157.61.0.0/255.255.0.0 | ||
no-route = 157.122.0.0/255.255.0.0 | ||
no-route = 157.148.0.0/255.255.0.0 | ||
no-route = 157.156.0.0/255.255.0.0 | ||
no-route = 157.255.0.0/255.255.0.0 | ||
no-route = 159.226.0.0/255.255.0.0 | ||
no-route = 161.207.0.0/255.255.0.0 | ||
no-route = 162.105.0.0/255.255.0.0 | ||
no-route = 163.0.0.0/255.192.0.0 | ||
no-route = 163.96.0.0/255.224.0.0 | ||
no-route = 163.128.0.0/255.192.0.0 | ||
no-route = 163.192.0.0/255.224.0.0 | ||
no-route = 166.111.0.0/255.255.0.0 | ||
no-route = 167.139.0.0/255.255.0.0 | ||
no-route = 167.189.0.0/255.255.0.0 | ||
no-route = 167.220.244.0/255.255.252.0 | ||
no-route = 168.160.0.0/255.255.0.0 | ||
no-route = 171.0.0.0/255.128.0.0 | ||
no-route = 171.192.0.0/255.224.0.0 | ||
no-route = 175.0.0.0/255.128.0.0 | ||
no-route = 175.128.0.0/255.192.0.0 | ||
no-route = 180.64.0.0/255.192.0.0 | ||
no-route = 180.128.0.0/255.128.0.0 | ||
no-route = 182.0.0.0/255.0.0.0 | ||
no-route = 183.0.0.0/255.192.0.0 | ||
no-route = 183.64.0.0/255.224.0.0 | ||
no-route = 183.128.0.0/255.128.0.0 | ||
no-route = 192.124.154.0/255.255.255.0 | ||
no-route = 192.188.170.0/255.255.255.0 | ||
no-route = 202.0.0.0/255.128.0.0 | ||
no-route = 202.128.0.0/255.192.0.0 | ||
no-route = 202.192.0.0/255.224.0.0 | ||
no-route = 203.0.0.0/255.128.0.0 | ||
no-route = 203.128.0.0/255.192.0.0 | ||
no-route = 203.192.0.0/255.224.0.0 | ||
no-route = 210.0.0.0/255.192.0.0 | ||
no-route = 210.64.0.0/255.224.0.0 | ||
no-route = 210.160.0.0/255.224.0.0 | ||
no-route = 210.192.0.0/255.224.0.0 | ||
no-route = 211.64.0.0/255.248.0.0 | ||
no-route = 211.80.0.0/255.240.0.0 | ||
no-route = 211.96.0.0/255.248.0.0 | ||
no-route = 211.136.0.0/255.248.0.0 | ||
no-route = 211.144.0.0/255.240.0.0 | ||
no-route = 211.160.0.0/255.248.0.0 | ||
no-route = 218.0.0.0/255.128.0.0 | ||
no-route = 218.160.0.0/255.224.0.0 | ||
no-route = 218.192.0.0/255.192.0.0 | ||
no-route = 219.64.0.0/255.224.0.0 | ||
no-route = 219.128.0.0/255.224.0.0 | ||
no-route = 219.192.0.0/255.192.0.0 | ||
no-route = 220.96.0.0/255.224.0.0 | ||
no-route = 220.128.0.0/255.128.0.0 | ||
no-route = 221.0.0.0/255.224.0.0 | ||
no-route = 221.96.0.0/255.224.0.0 | ||
no-route = 221.128.0.0/255.128.0.0 | ||
no-route = 222.0.0.0/255.0.0.0 | ||
no-route = 223.0.0.0/255.224.0.0 | ||
no-route = 223.64.0.0/255.192.0.0 | ||
no-route = 223.128.0.0/255.128.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '3.0' | ||
services: | ||
ocserv: | ||
image: your_repo/ocserv | ||
restart: always | ||
container_name: ocserv | ||
privileged: true | ||
hostname: www.example.com | ||
ports: | ||
- 1342:443/udp | ||
- 1342:443 | ||
volumes: | ||
- "./data/ocserv:/etc/ocserv" | ||
environment: | ||
- VIRTUAL_HOST=www.example.com | ||
- LETSENCRYPT_HOST=www.example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
# Open ipv4 ip forward | ||
sysctl -w net.ipv4.ip_forward=1 | ||
|
||
# Enable NAT forwarding | ||
iptables -t nat -A POSTROUTING -j MASQUERADE | ||
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu | ||
|
||
# Enable TUN device | ||
mkdir -p /dev/net | ||
mknod /dev/net/tun c 10 200 | ||
chmod 600 /dev/net/tun | ||
|
||
# Run OpennConnect Server | ||
exec "$@" |
Oops, something went wrong.