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

foreign_options in client.ovpn #35

Open
eoli3n opened this issue May 15, 2021 · 2 comments
Open

foreign_options in client.ovpn #35

eoli3n opened this issue May 15, 2021 · 2 comments

Comments

@eoli3n
Copy link

eoli3n commented May 15, 2021

I want to set my DOMAIN-SEARCH, but when I use the following code in client.ovpn, the script can't read it

setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
script-security 2
foreign_option_3='dhcp-option DOMAIN be.bnc.ch'
foreign_option_4='dhcp-option DOMAIN-SEARCH bnc.local'
up /etc/openvpn/scripts/openvpn-update-resolv-conf/update-resolv-conf.sh
down /etc/openvpn/scripts/openvpn-update-resolv-conf/update-resolv-conf.sh
down-pre

Is the only way is to set vars in /etc/openvpn/scripts/openvpn-update-resolv-conf/update-resolv-conf.sh ?

@TinCanTech
Copy link

Your syntax is incorrect:
foreign_option_{n} is a variable which is set when a server pushes something to the client, which the client does not understand. I do not believe you can set it in a config file. Also, if it can be set then the syntax would be setenv foreign_option_3 'dhcp-option DOMAIN be.bnc.ch'. Also, your variable for PATH may need to be quoted.

@eoli3n
Copy link
Author

eoli3n commented May 15, 2021

setenv PATH "/usr/sbin:/usr/bin:/sbin:/bin"
setenv foreign_option_3 "dhcp-option DOMAIN-SEARCH domain.fr"                             
setenv foreign_option_4 "dhcp-option DOMAIN-SEARCH sub.domain.fr"                      
script-security 2
up /etc/openvpn/scripts/openvpn-update-resolv-conf/update-resolv-conf.sh
down /etc/openvpn/scripts/openvpn-update-resolv-conf/update-resolv-conf.sh
down-pre

keeps adding only search domain.fr instead of search domain.fr sub.domain.fr


If I edit update-resolv-conf.sh to set this, tt adds the two domains search, which is what i want

# Example envs set from openvpn:
# foreign_option_1='dhcp-option DNS 193.43.27.132'
# foreign_option_2='dhcp-option DNS 193.43.27.133'
foreign_option_3="dhcp-option DOMAIN-SEARCH domain.fr"
foreign_option_4="dhcp-option DOMAIN-SEARCH sub.domain.fr"

I just moved to an os without systemd, before i was using systemd script and I only had to set to client.ovpn, I don't know why its not working anymore.

dhcp-option DOMAIN-SEARCH domain.fr
dhcp-option DOMAIN-SEARCH sub.domain.fr

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