TommyLau / docker-ocserv

Docker OpenConnect VPN Server
349 stars 243 forks source link

Cannot write to '/etc/ocserv/ocpasswd'. #30

Closed hetz closed 6 years ago

hetz commented 6 years ago

Ubuntu 16 AWS always say ocpasswd can't write or locked.

TommyLau commented 6 years ago

You should create that file in container but not your host.

hetz commented 6 years ago

thx 🍰 ,I want mount ocpasswd out of docker container. so I run script

sudo docker run --name ocserv \
        --privileged \
        -p 443:443 -p 443:443/udp \
        -e CA_CN="VPN CA" \
        -e CA_ORG="Inc." \
        -e CA_DAYS=3650 \
        -e SRV_CN=inner--vpn.test.com \
        -e SRV_ORG="Inc." \
        -e SRV_DAYS=365 \
        -e NO_TEST_USER=1 \
        -v /home/ubuntu/tools/tommylau_ocserv/ocpasswd:/etc/ocserv/ocpasswd \
        -d tommylau/ocserv

success run.

but I run

docker exec -ti ocserv ocpasswd -c /etc/ocserv/ocpasswd -g "Route,All" tommy

I get error file '/etc/ocserv/ocpasswd' is locked.

TommyLau commented 6 years ago

OK, I see.

I suggest you to mount a directory other than a file.

-v /home/yourname/ocserv:/etc/ocserv

That way you can also modify the configuration file out of the container.

Yet better way is to use certificate method.

hetz commented 6 years ago

thank i got it 👍

mamirpanah commented 1 year ago

-v /home/yourname/ocserv:/etc/ocserv Still does not work