2022 OCT UPDATE: We dockerized and added Dockerfile to run it anywhere you want on any linux distro easily. Buggy script for configuring OpenConnect (ocserv) protocol on the server easily and automatically.
2023 JAN UPDATE: We added a help instruction for Docker custom installation so everyone can fully customized ocserv configuration for him/her self like port number, custom header etc.
- Install Docker
- Build docker image
docker build -t ocserv https://github.com/samsesh/ocserv-docker.git- Run docker container
docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -d --restart unless-stopped ocserv- Add user
docker exec -ti ocserv ocpasswd -c /etc/ocserv/ocpasswd testUserName- Change user password
docker exec -ti ocserv ocpasswd -c /etc/ocserv/ocpasswd testUserName- Delete user
docker exec -ti ocserv ocpasswd -c /etc/ocserv/ocpasswd -d testUserName- Lock user
docker exec -ti ocserv ocpasswd -c /etc/ocserv/ocpasswd -l testUserName- Unlock user
docker exec -ti ocserv ocpasswd -c /etc/ocserv/ocpasswd -u testUserName- Show all users and their hashed password
docker exec -ti ocserv cat /etc/ocserv/ocpasswd- Show all connected users
docker exec -ti ocserv occtl show users- Show all options on occtl
docker exec -ti ocserv occtl help- Backup user & Restore
Backup :
docker exec -ti ocserv cat /etc/ocserv/ocpasswd >> ocserv_backup.txtRestore
docker exec -i ocserv sh -c 'cat > /etc/ocserv/ocpasswd ' < ocserv_backup.txt- Note: This only backs up and restores the list of users, it does not back up their status such as whether they are locked or not.
Tested on ubuntu 18.04 and 16.04.
Download and saving script on your server:
curl -O https://github.com/samsesh/ocserv-docker/raw/master/ocserv-install.shMaking script executable
chmod +x ocserv-install.shAnd then just run it:
./ocserv-install.shor
sudo bash ocserv-install.sh- Easy install
- Easy uninstall
- Add User
- Change Password
- Show All Users
- Delete User
- Lock User
- Unlock User
For making connection to your server, you can use AnyConnect, OpenConnect or other alternative clients.
- AnyConnect: GUI AnyConnect client for available platforms.
- OpenConnect: OpenConnect client for Linux.
And one more thing, contributions are welcome.
In docker way, at the beginning you have to clone the repo:
git clone https://github.com/samsesh/ocserv-docker.gitcd to the directory
cd ./ocserv-dockerYou can change port, disable UDP, add custom-header and so on. Modify and customize ocserv.conf file and then build your image with modified ocserv.conf:
docker build . -t ocservCreate new container from ocserv image
docker run --name ocserv --privileged -p 443:443 -p 443:443/udp -d --restart unless-stopped ocservNext steps like add or remove users are same as Docker Installation part.
Feel free to submit issues and enhancement requests or contact me my site samsesh.net.
The script is based on here