wheelybird / openvpn-server-ldap-otp

A dockerised OpenVPN server using LDAP for authentication, with optional 2FA via Google Authenticator
MIT License
171 stars 74 forks source link

How to set OVPN_EXTRA with multiple lines? #59

Open skret028 opened 1 year ago

skret028 commented 1 year ago

I want to set static IP to a certain client. As I searched,I shall add 2 lines to /etc/openvpn/server.conf ifconfig-pool-persist ipp.txt client-config-dir /etc/openvpn/ccd And setup a file as /etc/openvpn/ccd/username ifconfig-push 10.8.0.5 10.8.0.6

I tried to modify /etc/openvpn/server.conf,but it restores every launch. I also tried to add -e OVPN_EXTRA="ifconfig-pool-persist /etc/openvpn/ipp.txt\nclient-config-dir /etc/openvpn/ccd" \ It seems the escape character '\n' dosen't work properly.

wheelybird commented 1 year ago

This depends on how you're running Docker. Looks like you're passing arguments to docker run, so you could create a multiline variable, e.g.:

extraconfig="
ifconfig-pool-persist /etc/openvpn/ipp.txt
client-config-dir /etc/openvpn/ccd"

and then -e OVPN_EXTRA=$extraconfig. I think that should work.