Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The camouflage parameter is not connected. #75

Open
combx opened this issue Jul 2, 2024 · 6 comments
Open

The camouflage parameter is not connected. #75

combx opened this issue Jul 2, 2024 · 6 comments

Comments

@combx
Copy link

combx commented Jul 2, 2024

What I do:
docker pull quay.io/aminvakil/ocserv

docker run --name ocserv --sysctl net.ipv4.ip_forward=1 --cap-add NET_ADMIN --security-opt no-new-privileges -p 443:443 -p 443:443/udp -v /etc/letsencrypt/live/xxx.xx/privkey.pem:/etc/ocserv/certs/server-key.pem -v /etc/letsencrypt/live/xxx.xx/fullchain.pem:/etc/ocserv/certs/server-cert.pem -d quay.io/aminvakil/ocserv

docker exec ocserv sed -i '/^camouflage = /{s/false/true/}' /etc/ocserv/ocserv.conf
docker exec ocserv sed -i '/^camouflage_secret = /{s/mysecretkey/xxxsecret/}' /etc/ocserv/ocserv.conf
docker exec -ti ocserv ocpasswd -c /etc/ocserv/ocpasswd xxx

At the moment the connection to the server is working, but to any URL. Camouflage function is not active

After
docker restart ocserv
settings regarding Camouflage are reset to factory settings (false, mysecretkey)

Why doesn't the Camouflage option work?

@aminvakil
Copy link
Owner

This is happening after #72 got merged and ocserv.conf changes will not persist after a restart which is fine IMO.

You should persist your ocserv.conf and mount it into your container, make changes on your host and then restart your container.

Or you can make camouflage settings an environment variable in a PR, I'll be happy to review and merge it.

@combx
Copy link
Author

combx commented Jul 3, 2024

This is happening after #72 got merged and ocserv.conf changes will not persist after a restart which is fine IMO.
Got it

You should persist your ocserv.conf and mount it into your container, make changes on your host and then restart your container.
Agree. This is the first thing I did.
But I got an interesting result.
I add this code to the container launch line
-v /root/aminvakil/ocserv.conf:/etc/ocserv/ocserv.conf -v /root/aminvakil/ocpasswd:/etc/ocserv/ocpasswd

And after
docker restart ocserv
the ocserv.conf config file is rewritten to the default one, and the ocpasswd file remains with the data.

If I run the add new user command I get an error
Cannot write to '/etc/ocserv/ocpasswd'.
If I run the command to change parameters in ocserv.conf, the following error appears
sed: can't move '/etc/ocserv/ocserv.confjbiJNe' to '/etc/ocserv/ocserv.conf': Resource busy
Perhaps this is related to rights and the container does not have the rights to write to /root/aminvakil/ocserv.conf

And I have some problems with the network. After connecting to the VPN from my phone, there is no Internet access

@aminvakil
Copy link
Owner

Yes, my configurations have got lost as well, I've reverted #72, please pull the latest image.

@combx
Copy link
Author

combx commented Jul 4, 2024

Yes, my configurations have got lost as well, I've reverted #72, please pull the latest image.

Failed to launch(
I tried to run it in two ways
first way
git pull origin master
docker build .
and after launching the image
docker run --name ocserv --sysctl net.ipv4.ip_forward=1 --cap-add NET_ADMIN --security-opt no-new-privileges -p 443:443 -p 443:443/udp -d quay.io/ aminvakil/ocserv
connection via test user occurs, but the Internet does not work

second way
docker pull quay.io/aminvakil/ocserv
docker-compose up -d
connection occurs, but the Internet does not work

maybe I'm doing something wrong, I'm sad

@aminvakil
Copy link
Owner

maybe I'm doing something wrong, I'm sad

Try with exact tag:

docker run --name ocserv --sysctl net.ipv4.ip_forward=1 --cap-add NET_ADMIN --security-opt no-new-privileges -p 443:443 -p 443:443/udp -d quay.io/aminvakil/ocserv:1.3.0-5

@combx
Copy link
Author

combx commented Jul 5, 2024

maybe I'm doing something wrong, I'm sad

Try with exact tag:

docker run --name ocserv --sysctl net.ipv4.ip_forward=1 --cap-add NET_ADMIN --security-opt no-new-privileges -p 443:443 -p 443:443/udp -d quay.io/aminvakil/ocserv:1.3.0-5

I tried different options.
I connected my config file and passwords.
launched with standard parameters.
does not work(

last log with docker-compose

ocserv | Signing certificate...
ocserv | Create test user 'test' with password 'test'
ocserv | sysctl: error setting key 'net.ipv4.ip_forward': Read-only file system
ocserv | note: vhost:default: setting 'plain' as primary authentication method
ocserv | note: the cisco-client-compat option implies select-group-by-url = true; enabling
ocserv | note: setting 'file' as supplemental config option
ocserv | listening (TCP) on 0.0.0.0:443...
ocserv | listening (TCP) on [::]:443...
ocserv | listening (UDP) on 0.0.0.0:443...
ocserv | listening (UDP) on [::]:443...

last log with docker

[@76178 ocserv1]# docker logs --tail=50 38e0ad0a57e4
sysctl: error setting key 'net.ipv4.ip_forward': Read-only file system
error: cannot access config file: /etc/ocserv/ocserv.conf
Usage: ocserv -c [config]
Use ocserv --help for more information.

With my conf camouflage is working, but not internet ((

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants