Code Monkey home page Code Monkey logo

docker-ipsec-vpn-server's Introduction

English | 中文

IPsec VPN Server on Docker

Build Status GitHub Stars Docker Stars Docker Pulls

Docker image to run an IPsec VPN server, with IPsec/L2TP, Cisco IPsec and IKEv2.

Based on Alpine 3.19 or Debian 12 with Libreswan (IPsec VPN software) and xl2tpd (L2TP daemon).

An IPsec VPN encrypts your network traffic, so that nobody between you and the VPN server can eavesdrop on your data as it travels via the Internet. This is especially useful when using unsecured networks, e.g. at coffee shops, airports or hotel rooms.

» 📖 Book: Build Your Own VPN Server: A Step by Step Guide

Quick start

Use this command to set up an IPsec VPN server on Docker:

docker run \
    --name ipsec-vpn-server \
    --restart=always \
    -v ikev2-vpn-data:/etc/ipsec.d \
    -v /lib/modules:/lib/modules:ro \
    -p 500:500/udp \
    -p 4500:4500/udp \
    -d --privileged \
    hwdsl2/ipsec-vpn-server

Your VPN login details will be randomly generated. See Retrieve VPN login details.

Alternatively, you may set up IPsec VPN without Docker. To learn more about how to use this image, read the sections below.

Features

  • Supports IKEv2 with strong and fast ciphers (e.g. AES-GCM)
  • Generates VPN profiles to auto-configure iOS, macOS and Android devices
  • Supports Windows, macOS, iOS, Android, Chrome OS and Linux as VPN clients
  • Includes a helper script to manage IKEv2 users and certificates

Install Docker

First, install Docker on your Linux server. You may also use Podman to run this image, after creating an alias for docker.

Advanced users can use this image on macOS with Docker for Mac. Before using IPsec/L2TP mode, you may need to restart the Docker container once with docker restart ipsec-vpn-server. This image does not support Docker for Windows.

Download

Get the trusted build from the Docker Hub registry:

docker pull hwdsl2/ipsec-vpn-server

Alternatively, you may download from Quay.io:

docker pull quay.io/hwdsl2/ipsec-vpn-server
docker image tag quay.io/hwdsl2/ipsec-vpn-server hwdsl2/ipsec-vpn-server

Supported platforms: linux/amd64, linux/arm64 and linux/arm/v7.

Advanced users can build from source code on GitHub.

Image comparison

Two pre-built images are available. The default Alpine-based image is only ~17MB.

Alpine-based Debian-based
Image name hwdsl2/ipsec-vpn-server hwdsl2/ipsec-vpn-server:debian
Compressed size ~ 17 MB ~ 63 MB
Base image Alpine Linux 3.19 Debian Linux 12
Platforms amd64, arm64, arm/v7 amd64, arm64, arm/v7
Libreswan version 4.15 4.15
IPsec/L2TP
Cisco IPsec
IKEv2

Note: To use the Debian-based image, replace every hwdsl2/ipsec-vpn-server with hwdsl2/ipsec-vpn-server:debian in this README. These images are not currently compatible with Synology NAS systems.

How to use this image

Environment variables

Note: All the variables to this image are optional, which means you don't have to type in any variable, and you can have an IPsec VPN server out of the box! To do that, create an empty env file using touch vpn.env, and skip to the next section.

This Docker image uses the following variables, that can be declared in an env file (see example):

VPN_IPSEC_PSK=your_ipsec_pre_shared_key
VPN_USER=your_vpn_username
VPN_PASSWORD=your_vpn_password

This will create a user account for VPN login, which can be used by your multiple devices*. The IPsec PSK (pre-shared key) is specified by the VPN_IPSEC_PSK environment variable. The VPN username is defined in VPN_USER, and VPN password is specified by VPN_PASSWORD.

Additional VPN users are supported, and can be optionally declared in your env file like this. Usernames and passwords must be separated by spaces, and usernames cannot contain duplicates. All VPN users will share the same IPsec PSK.

VPN_ADDL_USERS=additional_username_1 additional_username_2
VPN_ADDL_PASSWORDS=additional_password_1 additional_password_2

Note: In your env file, DO NOT put "" or '' around values, or add space around =. DO NOT use these special characters within values: \ " '. A secure IPsec PSK should consist of at least 20 random characters.

Note: If you modify the env file after the Docker container is already created, you must remove and re-create the container for the changes to take effect. Refer to Update Docker image.

Additional environment variables

Advanced users can optionally specify a DNS name, client name and/or custom DNS servers.

Learn how to specify a DNS name, client name and/or custom DNS servers.

Advanced users can optionally specify a DNS name for the IKEv2 server address. The DNS name must be a fully qualified domain name (FQDN). Example:

VPN_DNS_NAME=vpn.example.com

You may specify a name for the first IKEv2 client. Use one word only, no special characters except - and _. The default is vpnclient if not specified.

VPN_CLIENT_NAME=your_client_name

By default, clients are set to use Google Public DNS when the VPN is active. You may specify custom DNS server(s) for all VPN modes. Example:

VPN_DNS_SRV1=1.1.1.1
VPN_DNS_SRV2=1.0.0.1

For more details and a list of some popular public DNS providers, see Use alternative DNS servers.

By default, no password is required when importing IKEv2 client configuration. You can choose to protect client config files using a random password.

VPN_PROTECT_CONFIG=yes

Note: The variables above have no effect for IKEv2 mode, if IKEv2 is already set up in the Docker container. In this case, you may remove IKEv2 and set it up again using custom options. Refer to Configure and use IKEv2 VPN.

Start the IPsec VPN server

Create a new Docker container from this image (replace ./vpn.env with your own env file):

docker run \
    --name ipsec-vpn-server \
    --env-file ./vpn.env \
    --restart=always \
    -v ikev2-vpn-data:/etc/ipsec.d \
    -v /lib/modules:/lib/modules:ro \
    -p 500:500/udp \
    -p 4500:4500/udp \
    -d --privileged \
    hwdsl2/ipsec-vpn-server

In this command, we use the -v option of docker run to create a new Docker volume named ikev2-vpn-data, and mount it into /etc/ipsec.d in the container. IKEv2 related data such as certificates and keys will persist in the volume, and later when you need to re-create the Docker container, just specify the same volume again.

It is recommended to enable IKEv2 when using this image. However, if you prefer not to enable IKEv2 and use only the IPsec/L2TP and IPsec/XAuth ("Cisco IPsec") modes to connect to the VPN, remove the first -v option from the docker run command above.

Note: Advanced users can also run without privileged mode.

Retrieve VPN login details

If you did not specify an env file in the docker run command above, VPN_USER will default to vpnuser and both VPN_IPSEC_PSK and VPN_PASSWORD will be randomly generated. To retrieve them, view the container logs:

docker logs ipsec-vpn-server

Search for these lines in the output:

Connect to your new VPN with these details:

Server IP: your_vpn_server_ip
IPsec PSK: your_ipsec_pre_shared_key
Username: your_vpn_username
Password: your_vpn_password

The output will also include details for IKEv2 mode, if enabled.

(Optional) Backup the generated VPN login details (if any) to the current directory:

docker cp ipsec-vpn-server:/etc/ipsec.d/vpn-gen.env ./

Next steps

Read this in other languages: English, 中文.

Get your computer or device to use the VPN. Please refer to:

Configure and use IKEv2 VPN (recommended)

Configure IPsec/L2TP VPN Clients

Configure IPsec/XAuth ("Cisco IPsec") VPN Clients

Read 📖 VPN book to access extra content.

Enjoy your very own VPN! ✨🎉🚀✨

Important notes

Windows users: For IPsec/L2TP mode, a one-time registry change is required if the VPN server or client is behind NAT (e.g. home router).

The same VPN account can be used by your multiple devices. However, due to an IPsec/L2TP limitation, if you wish to connect multiple devices from behind the same NAT (e.g. home router), you must use IKEv2 or IPsec/XAuth mode.

If you wish to add, edit or remove VPN user accounts, first update your env file, then you must remove and re-create the Docker container using instructions from the next section. Advanced users can bind mount the env file.

For servers with an external firewall (e.g. EC2/GCE), open UDP ports 500 and 4500 for the VPN. Aliyun users, see #433.

Clients are set to use Google Public DNS when the VPN is active. If another DNS provider is preferred, read this section.

Update Docker image

To update the Docker image and container, first download the latest version:

docker pull hwdsl2/ipsec-vpn-server

If the Docker image is already up to date, you should see:

Status: Image is up to date for hwdsl2/ipsec-vpn-server:latest

Otherwise, it will download the latest version. To update your Docker container, first write down all your VPN login details. Then remove the Docker container with docker rm -f ipsec-vpn-server. Finally, re-create it using instructions from How to use this image.

Configure and use IKEv2 VPN

IKEv2 mode has improvements over IPsec/L2TP and IPsec/XAuth ("Cisco IPsec"), and does not require an IPsec PSK, username or password. Read more here.

First, check container logs to view details for IKEv2:

docker logs ipsec-vpn-server

Note: If you cannot find IKEv2 details, IKEv2 may not be enabled in the container. Try updating the Docker image and container using instructions from the Update Docker image section.

During IKEv2 setup, an IKEv2 client (with default name vpnclient) is created, with its configuration exported to /etc/ipsec.d inside the container. To copy config file(s) to the Docker host:

# Check contents of /etc/ipsec.d in the container
docker exec -it ipsec-vpn-server ls -l /etc/ipsec.d
# Example: Copy a client config file from the container
# to the current directory on the Docker host
docker cp ipsec-vpn-server:/etc/ipsec.d/vpnclient.p12 ./

Next steps: Configure your devices to use the IKEv2 VPN.

Learn how to manage IKEv2 clients.

You can manage IKEv2 clients using the helper script. See examples below. To customize client options, run the script without arguments.

# Add a new client (using default options)
docker exec -it ipsec-vpn-server ikev2.sh --addclient [client name]
# Export configuration for an existing client
docker exec -it ipsec-vpn-server ikev2.sh --exportclient [client name]
# List existing clients
docker exec -it ipsec-vpn-server ikev2.sh --listclients
# Show usage
docker exec -it ipsec-vpn-server ikev2.sh -h

Note: If you encounter error "executable file not found", replace ikev2.sh above with /opt/src/ikev2.sh.

Learn how to change the IKEv2 server address.

In certain circumstances, you may need to change the IKEv2 server address. For example, to switch to use a DNS name, or after server IP changes. To change the IKEv2 server address, first open a bash shell inside the container, then follow these instructions. Note that the container logs will not show the new IKEv2 server address until you restart the Docker container.

Remove IKEv2 and set it up again using custom options.

In certain circumstances, you may need to remove IKEv2 and set it up again using custom options.

Warning: All IKEv2 configuration including certificates and keys will be permanently deleted. This cannot be undone!

Option 1: Remove IKEv2 and set it up again using the helper script.

Note that this will override variables you specified in the env file, such as VPN_DNS_NAME and VPN_CLIENT_NAME, and the container logs will no longer show up-to-date information for IKEv2.

# Remove IKEv2 and delete all IKEv2 configuration
docker exec -it ipsec-vpn-server ikev2.sh --removeikev2
# Set up IKEv2 again using custom options
docker exec -it ipsec-vpn-server ikev2.sh

Option 2: Remove ikev2-vpn-data and re-create the container.

  1. Write down all your VPN login details.
  2. Remove the Docker container: docker rm -f ipsec-vpn-server.
  3. Remove the ikev2-vpn-data volume: docker volume rm ikev2-vpn-data.
  4. Update your env file and add custom IKEv2 options such as VPN_DNS_NAME and VPN_CLIENT_NAME, then re-create the container. Refer to How to use this image.

Advanced usage

See Advanced usage.

Technical details

There are two services running: Libreswan (pluto) for the IPsec VPN, and xl2tpd for L2TP support.

The default IPsec configuration supports:

  • IPsec/L2TP with PSK
  • IKEv1 with PSK and XAuth ("Cisco IPsec")
  • IKEv2

The ports that are exposed for this container to work are:

  • 4500/udp and 500/udp for IPsec

License

Note: The software components inside the pre-built image (such as Libreswan and xl2tpd) are under the respective licenses chosen by their respective copyright holders. As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

Copyright (C) 2016-2024 Lin Song View my profile on LinkedIn
Based on the work of Thomas Sarlandie (Copyright 2012)

Creative Commons License
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License
Attribution required: please include my name in any derivative and let me know how you have improved it!

docker-ipsec-vpn-server's People

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  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

docker-ipsec-vpn-server's Issues

local HTTPS sites not working from VPN

After connecting to the VPN (xauth) I am not able to load my local https websites. I am able to connect to regular http websites located by the docker host but not https. While connected to the VPN I am able to ping the docker host with no problems. I have also added exceptions to the firewall on the host for the website port as well as 443 for SSL, with no luck.

I receive the following error: ERR_ADDRESS_UNREACHABLE

I also attempted to use the --net=host but receive error:
xl2tpd[1]: setsockopt recvref[30]: Protocol not available
xl2tpd[1]: This binary does not support kernel L2TP.

Is this something that I should change in the Dockerfile or is this a host error?

Monitor VPN tunnel

Hi,
is there a way to monitor the status of several L2TP channels programmatically?
When several VPN clients are connected to the server, I need to detect in real-time when a client lost the VPN connection.
Thanks

手机和电脑在同一个局域网下连接 VPN 后,先连接的无法使用网络

  • 手机系统:iOS
  • 电脑系统:MacOS

分别使用不同的 vpn 账号,使用cisco ipsec模式。

问题:两个设备同时连接 VPN 后,第一个连接的设备无法访问网络。

查看 ipsec 连接信息如下:

006 #23: "xauth-psk"[7] 223.89.65.191, username=user2, type=ESP, add_time=0, inBytes=124148, outBytes=212711, lease=192.168.43.10/32
006 #25: "xauth-psk"[7] 223.89.65.191, username=user, type=ESP, add_time=0, inBytes=664727, outBytes=1446150, lease=192.168.43.10/32

是不是由于分配了重复的 IP 地址导致的?应该如何解决?

谢谢!

TCP is broken

Hi guys. I've installed vpn with a docker container behind a NAT. I'm trying to connect to my network and I get some problems with tcp connections from shrew. Ping works fine but if I connect through TCP after a while tcp is broken. From my client I see that packets a going out through vpn server but not coming back. At the destination host I see a lot of retransmission packets. Can you help me to solve this issue? p.s. from MacOS everything works well but not from shrew.

exec user process caused "exec format error"

Raspbian Stretch

docker -v

capture d ecran 2017-11-28 a 10 33 43

capture d ecran 2017-11-28 a 10 32 55

docker run --name ipsec-vpn-server --restart=always -p 500:500/udp -p 4500:4500/udp -v /lib/modules:/lib/modules:ro -d --privileged hwdsl2/ipsec-vpn-server

capture d ecran 2017-11-28 a 10 34 10

capture d ecran 2017-11-28 a 10 34 34

Can you please help ?

Can't modprobe af_key in OVH gaming server

Server info

  • OVH model name: MC-64-OC
  • CPU: i7-7700K overclock
  • RAM: 64GB
  • OS: Ubuntu Server 16.04 "Xenial Xerus" LTS

Log

birkhoff@bhs01:~$ sudo modprobe af_key
modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/4.9.13-mod-std-ipv6-64/modules.builtin.bin'
modprobe: FATAL: Module af_key not found in directory /lib/modules/4.9.13-mod-std-ipv6-64

Additional Info

I didn't check "Install original kernel" while installing the system. Will that be a problem?

Why not write `sha2-truncbug=yes` in run.sh?

Originally posted by @cncolder:

/opt/src/run.sh will rewrite /etc/ipsec.conf after restart docker. I must edit every time.
I think it's good to move it from troubleshoot into /opt/src/run.sh

I setup -v ./ipsec.conf:/etc/ipsec.conf now. But I found there are some dynamic ip addresses in gen script.

Can't connect to VPN Server

I run the docker same as the tutorial but it did't work!

My System info:

# uname -a && lsb_release -a
Linux Ubuntu-Server 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04 LTS
Release:        16.04
Codename:       denial

After docker logs ipsec-vpn-server I got this error message:

xl2tpd[1]: setsockopt recvref[30]: Protocol not available
xl2tpd[1]: This binary does not support kernel L2TP.
xl2tpd[1]: xl2tpd version xl2tpd-1.3.6 started on 1f3b55fa2a26 PID:1
xl2tpd[1]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
xl2tpd[1]: Forked by Scott Balmos and David Stipp, (C) 2001
xl2tpd[1]: Inherited by Jeff McAdams, (C) 2002
xl2tpd[1]: Forked again by Xelerance (www.xelerance.com) (C) 2006
xl2tpd[1]: Listening on IP address 0.0.0.0, port 1701

And there seems no af_key in Ubuntu 16.04?
I can't tab modprobe af_key on my server.

Cannot connect from macos 10.13.1

Jan 27 02:52:29 06b48c2bd353 pluto[2257]: loading secrets from "/etc/ipsec.secrets"
Jan 27 02:53:11 06b48c2bd353 pluto[2257]: "xauth-psk"[1] 220.211.132.209 #1: responding to Main Mode from unknown peer 220.211.132.209 on port 500
Jan 27 02:53:11 06b48c2bd353 pluto[2257]: "xauth-psk"[1] 220.211.132.209 #1: STATE_MAIN_R1: sent MR1, expecting MI2
Jan 27 02:53:14 06b48c2bd353 pluto[2257]: "xauth-psk"[1] 220.211.132.209 #2: responding to Main Mode from unknown peer 220.211.132.209 on port 500
Jan 27 02:53:14 06b48c2bd353 pluto[2257]: "xauth-psk"[1] 220.211.132.209 #2: STATE_MAIN_R1: sent MR1, expecting MI2
Jan 27 02:53:18 06b48c2bd353 pluto[2257]: "xauth-psk"[1] 220.211.132.209 #3: responding to Main Mode from unknown peer 220.211.132.209 on port 500
Jan 27 02:53:18 06b48c2bd353 pluto[2257]: "xauth-psk"[1] 220.211.132.209 #3: STATE_MAIN_R1: sent MR1, expecting MI2
Jan 27 02:53:21 06b48c2bd353 pluto[2257]: "xauth-psk"[1] 220.211.132.209 #4: responding to Main Mode from unknown peer 220.211.132.209 on port 500
Jan 27 02:53:21 06b48c2bd353 pluto[2257]: "xauth-psk"[1] 220.211.132.209 #4: STATE_MAIN_R1: sent MR1, expecting MI2

I tried to setup with the script on digitalocean VPS, got the same error log in auth.log

CentOS Linux release 7.2.1511 (Core) error

docker run
--name ipsec-vpn-server
--env-file ./vpn.env
-p 500:500/udp
-p 4500:4500/udp
-v /lib/modules:/lib/modules:ro
-d --privileged
hwdsl2/ipsec-vpn-server

modprobe: ERROR: ../libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file '/lib/modules/4.5.5-x86_64-linode69/modules.dep.bin'
Redirecting to: /etc/init.d/ipsec start
Starting pluto IKE daemon for IPsec: Initializing NSS database

xl2tpd[1]: setsockopt recvref[30]: Protocol not available
xl2tpd[1]: This binary does not support kernel L2TP.
xl2tpd[1]: xl2tpd version xl2tpd-1.3.6 started on 6538e2d25626 PID:1
xl2tpd[1]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
xl2tpd[1]: Forked by Scott Balmos and David Stipp, (C) 2001
xl2tpd[1]: Inherited by Jeff McAdams, (C) 2002
xl2tpd[1]: Forked again by Xelerance (www.xelerance.com) (C) 2006
xl2tpd[1]: Listening on IP address 0.0.0.0, port 1701

docker: Error response from daemon: driver failed programming external connectivity on endpoint ipsec-vpn-server (87fb4aaf354e190bb59ecb3f5874d9be47b57ced728ebe6958784d92d8f70199): iptables failed: iptables --wait -t nat -A DOCKER -p udp -d 0/0 --dport 4500 -j DNAT --to-destination 172.17.0.2:4500 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1).

CentOS Linux release 7.2.1511 (Core)

请问如何添加多个用户呢?

请问如何添加多个用户呢?
另外
centos7上安装后:win7,Mac均成功
安卓手机有问题,xauth PSK模式可连接但无网络,l2tp/ipsec psk模式无法连接

Ping devices behind VPN client

Hi,
I started this docker container on my server. Then, I successfully connected a L2TP client (configured on a mikrotik mAP 2nD router) to the container. Now, the router running the L2TP client has three address classes (and two physical ethernet ports): one private address class (10.0.10.0/24) on the WAN interface that is connected to the horizontal wiring to get the Internet connection, one private address class (192.168.88.0/24) on the second ethernet port, and one private address 192.168.42.11 as VPN client (the VPN server has the 192.168.42.1 address). The VPN endpoints are able to ping each other and the clients on the 192.168.88.0/24 network are able to ping the VPN server endpoint (i.e. 192.168.42.1). Unfortunately, I can't ping the 192.168.88.0/24 network from the VPN server...do I have to change something on the VPN server configuration? or is this a VPN client issue?
Thanks

whack: Pluto is not running (no "/var/run/pluto/pluto.ctl")

I got this error: whack: Pluto is not running (no "/var/run/pluto/pluto.ctl")

When i check if the server is running how can i fix this?

More error logs of the docker:

Trying to auto discover IPs of this server...

================================================
IPsec VPN server is now ready for use!

Connect to your new VPN with these details:

Server IP: ********
IPsec PSK: ********
Username: ********
Password: ********

Write these down. You'll need them to connect!

Setup VPN Clients: https://git.io/vpnclients

================================================

modprobe: ERROR: could not insert 'af_key': Exec format error
Redirecting to: /etc/init.d/ipsec start
Starting pluto IKE daemon for IPsec: Initializing NSS database
.....
xl2tpd[1]: setsockopt recvref[30]: Protocol not available
xl2tpd[1]: This binary does not support kernel L2TP.
xl2tpd[1]: xl2tpd version xl2tpd-1.3.6 started on 87c976415d30 PID:1
xl2tpd[1]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
xl2tpd[1]: Forked by Scott Balmos and David Stipp, (C) 2001
xl2tpd[1]: Inherited by Jeff McAdams, (C) 2002
xl2tpd[1]: Forked again by Xelerance (www.xelerance.com) (C) 2006
xl2tpd[1]: Listening on IP address 0.0.0.0, port 1701
xl2tpd[1]: death_handler: Fatal signal 15 received

error 800 on client

I have followed your guide to install this image in my vps, but i'm getting error 800 in my client machine, I don't know what to do to fix this error.

port 500 and 4500 was opened in my vps, but i'm still getting the same error.

host machine:

uname -a && lsb_release -a
Linux vultr.guest 3.13.0-95-generic #142-Ubuntu SMP Fri Aug 12 17:00:09 UTC 2016 x86_64 x86_64    x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename: trusty

Docker log:

xl2tpd[1]: setsockopt recvref[30]: Protocol not available
xl2tpd[1]: This binary does not support kernel L2TP.
xl2tpd[1]: xl2tpd version xl2tpd-1.3.6 started on 47a42351aaa5 PID:1
xl2tpd[1]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
xl2tpd[1]: Forked by Scott Balmos and David Stipp, (C) 2001
xl2tpd[1]: Inherited by Jeff McAdams, (C) 2002
xl2tpd[1]: Forked again by Xelerance (www.xelerance.com) (C) 2006
xl2tpd[1]: Listening on IP address 0.0.0.0, port 1701
xl2tpd[1]: death_handler: Fatal signal 15 received

docker exec -it ipsec-vpn-server ipsec status:

000 Total IPsec connections: loaded 3, active 0
000
000 State Information: DDoS cookies not required, Accepting new IKE connections
000 IKE SAs: total(31), half-open(0), open(31), authenticated(0), anonymous(0)
000 IPsec SAs: total(0), authenticated(0), anonymous(0)
000
000 #6: "l2tp-psk"[1] X.X.X.X:1008 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26760s; nodpd; idle; import:not set
000 #14: "l2tp-psk"[1] X.X.X.X:1007 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26901s; nodpd; idle; import:not set
000 #17: "l2tp-psk"[1] X.X.X.X:1006 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27022s; nodpd; idle; import:not set
000 #26: "l2tp-psk"[1] X.X.X.X:1005 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27171s; nodpd; idle; import:not set
000 #30: "l2tp-psk"[1] X.X.X.X:500 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 28648s; nodpd; idle; import:not set
000 #21: "l2tp-psk"[1] X.X.X.X:1006 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27052s; nodpd; idle; import:not set
000 #22: "l2tp-psk"[1] X.X.X.X:1005 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27156s; nodpd; idle; import:not set
000 #12: "l2tp-psk"[1] X.X.X.X:1007 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26889s; nodpd; idle; import:not set
000 #9: "l2tp-psk"[1] X.X.X.X:1008 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26788s; nodpd; idle; import:not set
000 #8: "l2tp-psk"[1] X.X.X.X:1008 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26772s; nodpd; idle; import:not set
000 #7: "l2tp-psk"[1] X.X.X.X:1008 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26764s; nodpd; idle; import:not set
000 #31: "l2tp-psk"[1] X.X.X.X:500 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 28651s; nodpd; idle; import:not set
000 #29: "l2tp-psk"[1] X.X.X.X:500 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 28647s; nodpd; idle; import:not set
000 #28: "l2tp-psk"[1] X.X.X.X:500 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 28646s; nodpd; idle; import:not set
000 #13: "l2tp-psk"[1] X.X.X.X:1007 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26893s; nodpd; idle; import:not set
000 #18: "l2tp-psk"[1] X.X.X.X:1006 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27024s; nodpd; idle; import:not set
000 #16: "l2tp-psk"[1] X.X.X.X:1006 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27020s; nodpd; idle; import:not set
000 #15: "l2tp-psk"[1] X.X.X.X:1007 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26917s; nodpd; idle; import:not set
000 #4: "l2tp-psk"[1] X.X.X.X:1008 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26758s; nodpd; idle; import:not set
000 #10: "l2tp-psk"[1] X.X.X.X:1007 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26885s; nodpd; idle; import:not set
000 #2: "l2tp-psk"[1] X.X.X.X:500 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26494s; nodpd; idle; import:not set
000 #24: "l2tp-psk"[1] X.X.X.X:1005 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27159s; nodpd; idle; import:not set
000 #19: "l2tp-psk"[1] X.X.X.X:1006 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27028s; nodpd; idle; import:not set
000 #25: "l2tp-psk"[1] X.X.X.X:1005 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27163s; nodpd; idle; import:not set
000 #5: "l2tp-psk"[1] X.X.X.X:1008 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26758s; nodpd; idle; import:not set
000 #20: "l2tp-psk"[1] X.X.X.X:1006 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27036s; nodpd; idle; import:not set
000 #3: "l2tp-psk"[1] X.X.X.X:500 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26495s; nodpd; idle; import:not set
000 #27: "l2tp-psk"[1] X.X.X.X:1005 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27187s; nodpd; idle; import:not set
000 #23: "l2tp-psk"[1] X.X.X.X:1005 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 27157s; nodpd; idle; import:not set
000 #11: "l2tp-psk"[1] X.X.X.X:1007 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26887s; nodpd; idle; import:not set
000 #1: "l2tp-psk"[1] X.X.X.X:500 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 26493s; nodpd; idle; import:not set

Drop certain connection

Hi. In my case i see that docker exec -it ipsec-vpn-server ipsec whack --trafficstatus outputs a list of connections from 1 user from 1 ip (behind NAT). How can i drop a certain connection using whack utlity without dropping another connection?

XAuth

Hi,
is it possible to force L2TP clients to use XAuth Authentication Method?
Thanks

如何转发端口到设备之一

大神您好,
我一直在用您发布的这个容器,想请教一下,我现在有一台服务器已部署此ipsec-vpn-server容器,公网ip地址假如是a.b.c.d,现有一台Windows 7已连接到ipsec-vpn服务器,子网ip是

can't modprobe af_key in debian8

Hi mate,

I use debian8 (jessie) amd64 version, kernel 4.1.5-x86_64-linode61.
and can't modprobe af_key,

modprobe af_key
modprobe: ERROR: ../libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file '/lib/modules/4.1.5-x86_64-linode61/modules.dep.bin'

Do you know how to add this? or maybe i need to rebuild kernel and enable IPSEC?

Thanks.

win10 cannot connect

It's caused by the docker instance do not support MS-CHAPv2 which is a
Add
+mschap-v2
to

/etc/ppp/options.l2tpd

in

run.sh

can solve the problem

容器正常运行一段时间后, 忽然无法连接

你好, VPN容器已经正常运行, 前几天忽然无法响应, 日志如下:

Feb 17 05:09:17 ff44858d3881 pluto[2074]: "l2tp-psk"[1] 115.*.*.* #2: responding to Main Mode from unknown peer 115.*.*.* on port 500
Feb 17 05:09:17 ff44858d3881 pluto[2074]: "l2tp-psk"[1] 115.*.*.* #2: WARNING: connection l2tp-psk PSK length of 7 bytes is too short for sha2_256 PRF in FIPS mode (16 bytes required)
Feb 17 05:09:17 ff44858d3881 pluto[2074]: "l2tp-psk"[1] 115.*.*.* #2: STATE_MAIN_R1: sent MR1, expecting MI2
Feb 17 05:09:21 ff44858d3881 pluto[2074]: "l2tp-psk"[1] 115.*.*.* #2: retransmitting in response to duplicate packet; already STATE_MAIN_R1
Feb 17 05:09:24 ff44858d3881 pluto[2074]: "l2tp-psk"[1] 115.*.*.* #2: retransmitting in response to duplicate packet; already STATE_MAIN_R1
Feb 17 05:09:27 ff44858d3881 pluto[2074]: "l2tp-psk"[1] 115.*.*.* #2: retransmitting in response to duplicate packet; already STATE_MAIN_R1
Feb 17 05:10:17 ff44858d3881 pluto[2074]: "l2tp-psk"[1] 115.*.*.* #2: deleting incomplete state after 60.000 seconds
Feb 17 05:10:17 ff44858d3881 pluto[2074]: "l2tp-psk"[1] 115.*.*.* #2: deleting state (STATE_MAIN_R1)
Feb 17 05:10:17 ff44858d3881 pluto[2074]: deleting connection "l2tp-psk"[1] 115.*.*.* instance with peer 115.*.*.* {isakmp=#0/ipsec=#0}

测试4500端口和500端口均正常

4500:
found 0 associations
found 1 connections:
     1:	flags=82<CONNECTED,PREFERRED>
	outif (null)
	src 192.168.1.2 port 62722
	dst *.*.*.* port 4500
	rank info not available

Connection to *.*.*.* port 4500 [udp/ipsec-msft] succeeded!

500: 
found 0 associations
found 1 connections:
     1:	flags=82<CONNECTED,PREFERRED>
	outif (null)
	src 192.168.1.2 port 65349
	dst *.*.*.* port 500
	rank info not available

Connection to *.*.*.* port 500 [udp/isakmp] succeeded!

请问这个问题应该如何解决?

l2tp连接尝试是变,因为安全曾在初始化与远程计算机的协商时遇到一个处理错误

docker run --name ipsec-vpn-server --env-file ./vpn.env --restart=always -p 500:500/udp -p 4500:4500/udp -p 1701:1701/udp -v /lib/modules:/lib/modules:ro -d --privileged hwdsl2/ipsec-vpn-server

root@iZ2ze9rt5c8x00a69z163rZ:/vpn# docker logs ipsec-vpn-server -f

Trying to auto discover IP of this server...

================================================

IPsec VPN server is now ready for use!

Connect to your new VPN with these details:

Server IP: 47.93.38.77

IPsec PSK: < >
Username: < >
Password: < >

Write these down. You'll need them to connect!

Important notes: https://git.io/vpnnotes2
Setup VPN clients: https://git.io/vpnclients

================================================

Redirecting to: /etc/init.d/ipsec start
Starting pluto IKE daemon for IPsec: Initializing NSS database

.
xl2tpd[1]: setsockopt recvref[30]: Protocol not available
xl2tpd[1]: This binary does not support kernel L2TP.
xl2tpd[1]: xl2tpd version xl2tpd-1.3.6 started on c48037a5f890 PID:1
xl2tpd[1]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
xl2tpd[1]: Forked by Scott Balmos and David Stipp, (C) 2001
xl2tpd[1]: Inherited by Jeff McAdams, (C) 2002
xl2tpd[1]: Forked again by Xelerance (www.xelerance.com) (C) 2006
xl2tpd[1]: Listening on IP address 0.0.0.0, port 1701

How to allow clients to connect to each other?

I've set up a vpn server and now every client is connected to the server. The connections between clients and server is perfect, but these clients can't communicate with each other. How to solve this problem?

connect success,but can not vist google...

vpn status:

admin@ubuntu:~$ sudo docker exec -it ipsec-vpn-server ipsec whack --trafficstatus
[sudo] password for admin: 
006 #20: "l2tp-psk"[5] 113.110.229.42, type=ESP, add_time=0, inBytes=955, outBytes=120, id='192.168.1.108'

windows 10 os,can not vist google,facebook an so on.
I'm in china.

Missing vpn-gen.env File?

The command
docker cp ipsec-vpn-server:/opt/src/vpn-gen.env ./
returns
Error response from daemon: Could not find the file /opt/src/vpn-gen.env in container ipsec-vpn-server

Browsing a snapshot of the image, the only file in /opt/src is run.sh

Constant Restarting

I am trying to run this docker image on my Raspberry Pi 3 running Raspbian Pixel. The container seems like it is constantly restarting and not actually running. I am not sure if this is specific to the raspberry pi because I have run this docker image on other machines with no issues at all.

centos7.2 Permission denied (you must be root)

Please Help. Thanks.

Linux iZu1na35il8Z 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[admin@iZu1na35il8Z ~]$ sudo  docker run hwdsl2/ipsec-vpn-server

VPN credentials not set by user. Generating random PSK and password...

Trying to auto discover IPs of this server...
sysctl: setting key "kernel.msgmnb": Read-only file system
sysctl: setting key "kernel.msgmax": Read-only file system
sysctl: setting key "kernel.shmmax": Read-only file system
sysctl: setting key "kernel.shmall": Read-only file system
sysctl: setting key "net.ipv4.ip_forward": Read-only file system
sysctl: setting key "net.ipv4.conf.all.accept_source_route": Read-only file system
sysctl: setting key "net.ipv4.conf.default.accept_source_route": Read-only file system
sysctl: setting key "net.ipv4.conf.all.accept_redirects": Read-only file system
sysctl: setting key "net.ipv4.conf.default.accept_redirects": Read-only file system
sysctl: setting key "net.ipv4.conf.all.send_redirects": Read-only file system
sysctl: setting key "net.ipv4.conf.default.send_redirects": Read-only file system
sysctl: setting key "net.ipv4.conf.lo.send_redirects": Read-only file system
sysctl: setting key "net.ipv4.conf.eth0.send_redirects": Read-only file system
sysctl: setting key "net.ipv4.conf.all.rp_filter": Read-only file system
sysctl: setting key "net.ipv4.conf.default.rp_filter": Read-only file system
sysctl: setting key "net.ipv4.conf.lo.rp_filter": Read-only file system
sysctl: setting key "net.ipv4.conf.eth0.rp_filter": Read-only file system
sysctl: setting key "net.ipv4.icmp_echo_ignore_broadcasts": Read-only file system
sysctl: setting key "net.ipv4.icmp_ignore_bogus_error_responses": Read-only file system
getsockopt failed strangely: Operation not permitted
iptables v1.4.21: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
getsockopt failed strangely: Operation not permitted
getsockopt failed strangely: Operation not permitted
iptables v1.4.21: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
getsockopt failed strangely: Operation not permitted
iptables v1.4.21: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `nat': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
iptables v1.4.21: can't initialize iptables table `nat': Permission denied (you must be root)

can't connect vpn service

[root@sakura ~]# vi /etc/sysctl.conf
[root@sakura ~]# sysctl -p
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 0
[root@sakura ~]# docker restart ipsec-vpn-server
ipsec-vpn-server
[root@sakura ~]# docker ps | grep ipsec-vpn-server
28a744dcf368        hwdsl2/ipsec-vpn-server   "/run.sh"           3 minutes ago       Up 7 seconds        0.0.0.0:500->500/udp, 0.0.0.0:4500->4500/udp   ipsec-vpn-server
[root@sakura ~]# docker logs ipsec-vpn-server

Trying to auto discover IPs of this server...

================================================

IPsec VPN server is now ready for use!

Connect to your new VPN with these details:

Server IP: ********
IPsec PSK: ********
Username: ********
Password: ********

Write these down. You'll need them to connect!

Setup VPN clients: https://git.io/vpnclients

================================================

Redirecting to: /etc/init.d/ipsec start
Starting pluto IKE daemon for IPsec: Initializing NSS database

.
xl2tpd[1]: setsockopt recvref[30]: Protocol not available
xl2tpd[1]: This binary does not support kernel L2TP.
xl2tpd[1]: xl2tpd version xl2tpd-1.3.6 started on 28a744dcf368 PID:1
xl2tpd[1]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
xl2tpd[1]: Forked by Scott Balmos and David Stipp, (C) 2001
xl2tpd[1]: Inherited by Jeff McAdams, (C) 2002
xl2tpd[1]: Forked again by Xelerance (www.xelerance.com) (C) 2006
xl2tpd[1]: Listening on IP address 0.0.0.0, port 1701
xl2tpd[1]: death_handler: Fatal signal 15 received

Trying to auto discover IPs of this server...

================================================

IPsec VPN server is now ready for use!

Connect to your new VPN with these details:

Server IP: ********
IPsec PSK: ********
Username: ********
Password: ********

Write these down. You'll need them to connect!

Setup VPN clients: https://git.io/vpnclients

================================================

Redirecting to: /etc/init.d/ipsec start
Starting pluto IKE daemon for IPsec: .
xl2tpd[1]: setsockopt recvref[30]: Protocol not available
xl2tpd[1]: This binary does not support kernel L2TP.
xl2tpd[1]: xl2tpd version xl2tpd-1.3.6 started on 28a744dcf368 PID:1
xl2tpd[1]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
xl2tpd[1]: Forked by Scott Balmos and David Stipp, (C) 2001
xl2tpd[1]: Inherited by Jeff McAdams, (C) 2002
xl2tpd[1]: Forked again by Xelerance (www.xelerance.com) (C) 2006
xl2tpd[1]: Listening on IP address 0.0.0.0, port 1701
[root@sakura ~]# docker exec -it ipsec-vpn-server netstat -anput
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
udp        0      0 127.0.0.1:4500          0.0.0.0:*                           566/pluto
udp        0      0 172.17.0.2:4500         0.0.0.0:*                           566/pluto
udp        0      0 0.0.0.0:1701            0.0.0.0:*                           1/xl2tpd
udp        0      0 127.0.0.1:500           0.0.0.0:*                           566/pluto
udp        0      0 172.17.0.2:500          0.0.0.0:*                           566/pluto
udp6       0      0 ::1:500                 :::*                                566/pluto
[root@sakura ~]# netstat -anput
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3548/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      3472/master
tcp        0      0 ********:22         ********:34916    ESTABLISHED 16477/sshd: root@pt
tcp        0      0 ********:22         ********:37517    ESTABLISHED 20814/sshd: root@pt
tcp        0     36 ********:22         ********:36064    ESTABLISHED 21031/sshd: root@pt
tcp        0      0 ********:22         ********:36563    ESTABLISHED 16887/sshd: root@pt
tcp        0      0 ********:22         ********:34812    ESTABLISHED 20873/sshd: root@pt
tcp6       0      0 :::22                   :::*                    LISTEN      3548/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      3472/master
udp        0      0 172.17.0.1:123          0.0.0.0:*                           451/ntpd
udp        0      0 ********:123        0.0.0.0:*                           451/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           451/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           451/ntpd
udp        0      0 0.0.0.0:14769           0.0.0.0:*                           1024/dhclient
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1024/dhclient
udp6       0      0 :::51550                :::*                                1024/dhclient
udp6       0      0 fe80::1ced:73ff:fe5:123 :::*                                451/ntpd
udp6       0      0 fe80::42:1dff:fe54::123 :::*                                451/ntpd
udp6       0      0 fe80::5400:ff:fe37::123 :::*                                451/ntpd
udp6       0      0 ********:123 :::*                                451/ntpd
udp6       0      0 ::1:123                 :::*                                451/ntpd
udp6       0      0 :::123                  :::*                                451/ntpd
udp6       0      0 :::4500                 :::*                                24710/docker-proxy
udp6       0      0 :::500                  :::*                                24717/docker-proxy
[root@sakura ~]#

service seem normal but is still can not connect

[root@sakura ~]# docker version
Client:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:
 OS/Arch:      linux/amd64


[root@sakura ~]# uname -a
Linux sakura 3.10.0-327.28.3.el7.x86_64 #1 SMP Thu Aug 18 19:05:49 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

[root@sakura ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

FATAL ERROR using docker image

Some messages:

pluto[2619]: FATAL ERROR: Failed to bind bcast socket in init_netlink() - Perhaps kernel was not compiled with CONFIG_XFRM. Errno 1: Operation not permitted

pluto[3576]: FATAL ERROR: Failed to bind bcast socket in init_netlink() - Perhaps kernel was not compiled with CONFIG_XFRM. Errno 1: Operation not permitted

pluto[3895]: FATAL ERROR: Failed to bind bcast socket in init_netlink() - Perhaps kernel was not compiled with CONFIG_XFRM. Errno 1: Operation not permitted

pluto[5171]: FATAL ERROR: Failed to bind bcast socket in init_netlink() - Perhaps kernel was not compiled with CONFIG_XFRM. Errno 1: Operation not permitted

Docker versio:

$ docker -v
Docker version 1.12.5, build 7392c3b

help help

i use iphone to connet to my ipsec server in docker. it seems 500 port error.
I have use it for several month , it works great, but in these days ,can't connect anymore.
the log shows as below.

log shows "xauth-psk"[1] 114.84.168.57:500 STATE_MAIN_R1 (sent MR1, expecting MI2); EVENT_SA_EXPIRE in 3570s; lastdpd=-1s(seq in:0 out:0); idle; import:not set and can not connect.

Improve the default settings

I'll admit I'm no VPN expert, but it seems like the defaults for this VPN could be improved quite a bit.

If nothing else, maybe add a note as to why these cipher were picked as the defaults?

  ike=3des-sha1,3des-sha2,aes-sha1,aes-sha1;modp1024,aes-sha2,aes-sha2;modp1024,aes256-sha2_512

Thanks

Ability to change ports

Hello!

I don't know if it's possible to change ports to allow multi vpn deployment on same host.

Have anyone any clue if it's possible?

`/etc/ipsec.conf` is reverted on restart

Hi, I've been using docker-ipsec-vpn-server with a lot of success, there's only one little hiccup. I'm using Android 6.0, so I followed the step here https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients.md#android to change /etc/ipsec.conf (using docker cp).

However, every time I restart the container or my machine, the ipsec.conf file gets reverted back to its original state, and then I have to make the same changes again. I'm not sure whether this is an expected behaviour. What's a good way to persist my changes?

Failed in the VPN Authentication "for buggy Apple client"

kernel version: 4.10.0-041000rc3-generic

xl2tpd[1]: Connection established to 112.8.21.1, 51239.  Local: 33444, Remote: 9 (ref=0/0).  LNS session is 'default'
xl2tpd[1]: start_pppd: I'm running: 
xl2tpd[1]: "/usr/sbin/pppd" 
xl2tpd[1]: "passive" 
xl2tpd[1]: "nodetach" 
xl2tpd[1]: "192.168.42.1:192.168.42.10" 
xl2tpd[1]: "refuse-pap" 
xl2tpd[1]: "auth" 
xl2tpd[1]: "require-chap" 
xl2tpd[1]: "name" 
xl2tpd[1]: "l2tpd" 
xl2tpd[1]: "file" 
xl2tpd[1]: "/etc/ppp/options.xl2tpd" 
xl2tpd[1]: "/dev/pts/0" 
xl2tpd[1]: Call established with 112.8.21.1, Local: 33421, Remote: 9552, Serial: 1
xl2tpd[1]: result_code_avp: result code endianness fix for buggy Apple client. network=768, le=3
xl2tpd[1]: control_finish: Connection closed to 112.8.21.1, serial 1 ()
xl2tpd[1]: Terminating pppd: sending TERM signal to pid 762
xl2tpd[1]: result_code_avp: result code endianness fix for buggy Apple client. network=256, le=1
xl2tpd[1]: control_finish: Connection closed to 112.8.21.1, port 51239 (), Local: 33444, Remote: 9

Running "--privileged" is a security risk

Just stumbled over this repo and noticed the active --privileged flag for the container.

Instead I'd recommend using --cap-add=NET_ADMIN --net=host, which leaves the host less exposed.

How to use IPSec VPN on Linux

I successfully setup my IPSec server by using your docker image. However I can't link to it on Linux.
I use vpnc to setup link. Here is the config file:

IPSec gateway xxx.xxx.xxx.xxx
IPSec ID <group-id>
IPSec secret *******
IKE Authmode psk
Xauth username xxx
Xauth password xxx

What is IPSec ID?
P.S.打英语好麻烦,如果可以的话能不能烦请用中文?

what is /lib/modules folder?

I was trying to use this container but haven't succeed yet. One thing I notice is that:
/lib/modules directory is not existed on my ubuntu 14 ec2 image, can you explain what is that?

Internal subnet IP to other container

Hi, sorry for this (stupid) question, but i'm searching two days for a solution.

I have three containers your IPSec container (vpn1), an openvpn container (vpn2) and one proxy (squid) container.
Now i want to send the traffic from VPN through the proxy.
But i need the internal VPN IP of Client in the Proxy.

With OpenVPN it's ok i've solved it.
But with ipsec it's not so easy.
So i need the 192.168.43.0/24 IP in proxy (forwarded-for).

OpenVPN is started with (--network=host).
Proxy is on default bridge and IPSec too.

Do you have any idea to solve it? 😃

vpn1 --- \

# | --- squid --- www

vpn2 --- /

P.S.: Thanks for you work, IPSec setup and IPSec Image are very usefully

Multi-user support

In order to support multiple accounts, I had to customize the CMD (run.sh) script either to allow the specification of multiple users or adding a check whether there are accounts in /etc/ppp/chap-secrets and /etc/ipsec.d/passwd before overwriting them so I could mount them as volumes and fill them with users using something similar to

docker-compose exec vpn bash
VPN_USER='new_user'
VPN_PASSWORD='new_passwd'

cat >> /etc/ppp/chap-secrets <<EOF
"$VPN_USER" l2tpd "$VPN_PASSWORD" *
EOF

VPN_PASSWORD_ENC=$(openssl passwd -1 "$VPN_PASSWORD")
cat >> /etc/ipsec.d/passwd <<EOF
$VPN_USER:$VPN_PASSWORD_ENC:xauth-psk
EOF

Is not supporting multiple users a design decision or would merge requests be accepted if they do not complicate things for a default setup.

static IP for different users

Hi,

Is it possible to configure the users to have static IP subset Address?
I have many devices to connect to the IPSec VPN server, so I would like to have this feature.

Thanks!
Wing

数据转发不成功?

刚刚部署在阿里云美西的服务器上,连接成功。然后,国内的网络访问都可以?国外的都不可以。这。。。是神马情况。

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.