Giter Site home page Giter Site logo

docker-ocserv's Introduction

docker-ocserv

docker-ocserv is an OpenConnect VPN Server boxed in a Docker image built by Tommy Lau.

Update on Aug 31, 2017

Update to version 0.11.8 and use Alpine 3.6 as base image

Update on July 20,2016

You can login with two group (Route/ALL) from now on. Route group means you can access China Mainland website directly and other connection will be protected by OpenConnect VPN All group means all of connection will be protected by OpenConnect VPN

Update on July 16, 2016

Thanks for @sempr's contribution and suggestion, from now on, the Alpine Linux will be used as the base image. The docker image size has been dramatically reduced from around 150MB to only 20MB.

NOTICE: You have to use Docker version 1.9.0 or later to support Alpine, DO NOT UPDATE the image if your Docker version is older than 1.9.0

What is OpenConnect Server?

OpenConnect server (ocserv) is an SSL VPN server. It implements the OpenConnect SSL VPN protocol, and has also (currently experimental) compatibility with clients using the AnyConnect SSL VPN protocol.

How to use this image

Get the docker image by running the following commands:

docker pull tommylau/ocserv

Start an ocserv instance:

docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -d tommylau/ocserv

This will start an instance with the a test user named test and password is also test.

Environment Variables

All the variables to this image is optional, which means you don't have to type in any environment variables, and you can have a OpenConnect Server out of the box! However, if you like to config the ocserv the way you like it, here's what you wanna know.

CA_CN, this is the common name used to generate the CA(Certificate Authority).

CA_ORG, this is the organization name used to generate the CA.

CA_DAYS, this is the expiration days used to generate the CA.

SRV_CN, this is the common name used to generate the server certification.

SRV_ORG, this is the organization name used to generate the server certification.

SRV_DAYS, this is the expiration days used to generate the server certification.

NO_TEST_USER, while this variable is set to not empty, the test user will not be created. You have to create your own user with password. The default value is to create test user with password test.

The default values of the above environment variables:

Variable Default
CA_CN VPN CA
CA_ORG Big Corp
CA_DAYS 9999
SRV_CN www.example.com
SRV_ORG My Company
SRV_DAYS 9999

Running examples

Start an instance out of the box with username test and password test

docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -d tommylau/ocserv

Start an instance with server name my.test.com, My Test and 365 days

docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -e SRV_CN=my.test.com -e SRV_ORG="My Test" -e SRV_DAYS=365 -d tommylau/ocserv

Start an instance with CA name My CA, My Corp and 3650 days

docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -e CA_CN="My CA" -e CA_ORG="My Corp" -e CA_DAYS=3650 -d tommylau/ocserv

A totally customized instance with both CA and server certification

docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -e CA_CN="My CA" -e CA_ORG="My Corp" -e CA_DAYS=3650 -e SRV_CN=my.test.com -e SRV_ORG="My Test" -e SRV_DAYS=365 -d tommylau/ocserv

Start an instance as above but without test user

docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -e CA_CN="My CA" -e CA_ORG="My Corp" -e CA_DAYS=3650 -e SRV_CN=my.test.com -e SRV_ORG="My Test" -e SRV_DAYS=365 -e NO_TEST_USER=1 -v /some/path/to/ocpasswd:/etc/ocserv/ocpasswd -d tommylau/ocserv

WARNING: The ocserv requires the ocpasswd file to start, if NO_TEST_USER=1 is provided, there will be no ocpasswd created, which will stop the container immediately after start it. You must specific a ocpasswd file pointed to /etc/ocserv/ocpasswd by using the volume argument -v by docker as demonstrated above.

User operations

All the users opertaions happened while the container is running. If you used a different container name other than ocserv, then you have to change the container name accordingly.

Add user

If say, you want to create a user named tommy, type the following command

docker exec -ti ocserv ocpasswd -c /etc/ocserv/ocpasswd -g "Route,All" tommy
Enter password:
Re-enter password:

When prompt for password, type the password twice, then you will have the user with the password you want.

-g "Route,ALL" means add user tommy to group Route and group All

Delete user

Delete user is similar to add user, just add another argument -d to the command line

docker exec -ti ocserv ocpasswd -c /etc/ocserv/ocpasswd -d test

The above command will delete the default user test, if you start the instance without using environment variable NO_TEST_USER.

Change password

Change password is exactly the same command as add user, please refer to the command mentioned above.

docker-ocserv's People

Contributors

ara4sh avatar crudalex avatar czbix avatar kolahzary avatar s7lx avatar tommylau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-ocserv's Issues

Server certificate verify failed: signer not found

Hello @TommyLau.

I pulled this image on a fresh ubuntu 16.04 server and just initialized it with the test username, but when I try to connect to the server through the openconnect on Ubuntu 16.04, it shows this log:

POST https://206.*.*.*/
Attempting to connect to server 206.*.*.*:443
SSL negotiation with 206.*.*.*
Server certificate verify failed: signer not found
SSL connection failure: The operation timed out
Failed to open HTTPS connection to 206.*.*.*

What's wrong?

Change Port

Hello Sir,

Thanks for your outstanding work. could you please guide me, how to change the port? Unfortunately my port 443 is used for something else.

Thanks

不能登录 返回 HTTP 401

Got inappropriate HTTP CONNECT response: HTTP/1.1 401 Cookie is not acceptable
Creating SSL connection failed

Locking error in OpenConnect account creation

#ubuntu
#ocserv
Hello, I used to create an account with this method
ocpasswd -c /etc/ocserv/ocpasswd myusername
But now
It gives this error
file '/etc/ocserv/ocpasswd' is locked.
It wasn't a problem before

Running with docker user-namespace

I want to securely run this docker on a server with userns enabled.

Therefore --privileged cannot be executed, but I've successfully add --cap-add=NET_ADMIN, so iptables can be runned.

Unfortunately these cannot be executed:

sysctl: error setting key 'net.ipv4.ip_forward': Read-only file system
mknod: /dev/net/tun: Operation not permitted
chmod: /dev/net/tun: No such file or directory

I've set net.ipv4.ip_forward to 1 as root on host, but I have no idea how can I give privilege to ocserv if it needs to make special blocks by mknod on host.

I know this is more of a linux issue, but any help would be appreciated.

k8s yaml for the vpn server

Came across the image here and wonder whether you have the example yaml file to deploy it to k8s?

I noticed it needs two port 443 and 443/udp i find it impossible to expose the service on k8s?

Any help?

DTLS handshake failed

Openconnect client print this error periodically:

DTLS handshake failed: Resource temporarily unavailable, try again. DTLS handshake failed: Resource temporarily unavailable, try again. SSL read error: The TLS connection was non-properly terminated.; reconnecting. SSL negotiation with hosseintorabi.ir Server certificate verify failed: signer not found Connected to HTTPS on **********.com Got CONNECT response: HTTP/1.1 200 CONNECTED Reconnect gave different Legacy IP address (*.*.*.* != *.*.*.*) sleep 10s, remaining timeout 300s SSL negotiation with **********.com Server certificate verify failed: signer not found Connected to HTTPS on **********.com Got CONNECT response: HTTP/1.1 200 CONNECTED CSTP connected. DPD 90, Keepalive 32400 DTLS handshake failed: Resource temporarily unavailable, try again. DTLS handshake failed: Resource temporarily unavailable, try again

`All Proxy` is unable to connect.

logs

     18:07:13    Ready to connect.
     18:07:16    Contacting xxx.xxx.xxx:xxxxx.
     18:07:28    User credentials entered.
     18:07:32    User credentials entered.
     18:07:33    Ready to connect.

ocserv fails to startup

ocserv fails to startup when it tries to read "server-cert-secp521.pem" for example vhost.

Please merge pull request #33.

Question: how can I add valid certificate?

how can I add a valid certificate in order to get rid of 'untrusted server' errors?

what are Route and All proxy groups mean? does it mean you can exclude .cn domains from VPN?

manage bandwidth?

when more than one user connected as more as users low band width appeared.
how can I manage each user data transfer rate?
also this error appeared with more than one user connected:

CSTP connected. DPD 90, Keepalive 32400
Established DTLS connection (using GnuTLS). Ciphersuite (DTLS1.2)-(RSA)-(AES-256-GCM).
SSL read error: The TLS connection was non-properly terminated.; reconnecting.
SSL negotiation with ******
Server certificate verify failed: signer not found
Connected to HTTPS on ****

my vps has 512MB RAM

not working on AWS EC2

i was testing it with a fresh created EC2 instance on aws, but somehow after i connected to server, i lost all internet access as well as no DNS address are resolved.

tried to ping domain (google.com) ---> address not resolved
tried to ping server ip ---> timeout error

I have configured EC2 to open all inbound and outbound traffic.

Any idea why this is happening?

openconnect disconnect every 5 min

Hi everyone
I recently installed opnconnect with docker on ubuntu 20.04, i create a user and everything works fine, but my connection disconnects every 5 minutes! i tested on laptop , iPhone , andoird phone & ... on all device connection disconnect every 5 minutes! does anyone have solution ?

请问这个Docker能够支持IPV6么?

我家的环境是Openwrt通过HE的6in4隧道接入IPV6网络并作为默认翻墙方案的,最近联通的手机网络劫持严重于是想通过这个docker直接连到家里顺带翻墙,但是连接上之后似乎并不能通过IPV6直接翻墙

Multi IP for containers

Hi, I have multiple IP address on my server . I need a configuration that assign each one of them to a containers based on your image. When I connect to each IP address with this vpn , I will have that ip

Cannot ping hostname

Hi @TommyLau,

I deployed ocserver in a container inside a user-defined network. Then I connected my laptop to the ocserver by anyconnect. From my laptop, I can ping all containers of ocserver network by their ips, but about hostnames, it seems they are not solved . Am I missing any additional configuration?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.