3

I have several openvpn .conf files for various vpns, and they all need to have these lines at the end of the file, like

script-security ... setenv PATH ... up ... down ... down-pre ... 

Is there a way to set this configuration globally across all files or in openvpn somewhere? I don't want to modify any of the individual vpn files if it's possible to configure it someplace centrally or globally.

I'm starting the config files with systemd, so sudo systemctl start [email protected].

1 Answer 1

5

You can use the --config command line option multiple times to merge configurations or also include the config option inside a config file to refer to others.

Source:OpenVPN - Getting started How-To

4
  • I've updated my question to show that I'm starting the vpns with systemd, how could I pass the --config option to systemd? I don't want to include the config option inside the config file because there are a lot of config files, I'd rather do it centrally like in some openvpn or systemd central configuration. Commented Nov 10, 2017 at 10:12
  • You can edit/copy the systemd unit file to include the option as it calls openvpn. Also a good practice would be to remove the duplicate lines from existing configs (avoiding conflicts), hence you can just add the config entry as you do it. Would it be enough? I can add it to the answer... Commented Nov 10, 2017 at 10:38
  • Is /usr/lib/systemd/system/[email protected] the systemd unit file you're referring to? How exactly can I modify that file to add the 5 config params I need to from the question? Ideally I could create a single file with just those 5 lines it and refer to it in the unit file so that so I can add just one thing to that unit file instead of 5 things. Commented Nov 10, 2017 at 10:50
  • It's pretty much that what I am suggesting. You can "override" the openvpn unit file, updating the ExecStart= line to include an extra --config path/to/conf, where you can have as many parameters as you'd like. If your unit doesn't have such line, please add it to the question so I can figure it out, but mine does. Tell me so I can update the answer accordingly... Commented Nov 10, 2017 at 10:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.