Anyone knows how to activate and decativate a openvpn connection with script ?
I have some connections which shall be useable only turing working hours.
So your goal is to cron
the script? Firewall rules do not allow time conditions? (I cannot access to any IpFire setup currently)
Yes it shall be don with a cronjob. Firewall rules are not useable in this scenario, because not all connections shall be disabled. I just want to automate what i can do in the gui by hand. ( activate/disactivate )
Hi all,
for Roadwarriors you would probably need to modify /var/ipfire/ovpn/ovpnconfig via grep for connection and sed on and off --> https://git.ipfire.org/?p=ipfire-2.x.git;a=blob;f=html/cgi-bin/ovpnmain.cgi;h=00ecd77a02352b7a93a18f355142c36966f59cab;hb=refs/heads/core144#l3110 . Currently not sure if you need to restart the OpenVPN server then, may if they are connected but better to check this by yourself.
If you have N2N connections you can use simply /usr/local/bin/openvpnctrl -->
$ /usr/local/bin/openvpnctrl
Wrapper for OpenVPN ipfire-2.2.4
openvpnctrl <option>
Valid options are:
-s --start
starts OpenVPN (implicitly creates chains and firewall rules)
-k --kill
kills/stops OpenVPN
-r --restart
restarts OpenVPN (implicitly creates chains and firewall rules)
-sn2n --start-net-2-net
starts all net2net connections
you may pass a connection name to the switch to only start a specific one
-kn2n --kill-net-2-net
kills all net2net connections
you may pass a connection name to the switch to only start a specific one
-drrd --delete-rrd
Deletes the RRD data for a specific client
you need to pass a connection name (RW) to the switch to delete the directory (case sensitive)
-d --display
displays OpenVPN status to syslog
-fwr --firewall-rules
removes current OpenVPN chains and rules and resets them according to the config
-sdo --start-daemon-only
starts OpenVPN daemon only