Hi,
I used OpenVPN at home on an OPNSense firewall & since this is a home LAN the use of VPN is minimal and and have limited users.
My request:
At the time of a VPN user logging in, is there a way to execute a custom shell script on OpenVPN server? If so where do I need to add the script - config file or its location?
The idea is that as soon a VPN user logs in, the script will execute on server and send me a text "User-X has logged-on/logged-off at xx:yy:zz".
Any pointers will be appreciated!
HOWTO - use Monit to monitor VPN
Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech
-
- OpenVPN Protagonist
- Posts: 11136
- Joined: Fri Jun 03, 2016 1:17 pm
Re: Newbie question around custom shell script
Start here: https://community.openvpn.net/openvpn/w ... nPage#lbAS
If you feel brave then you could try this: https://github.com/TinCanTech/easy-tls
If you feel brave then you could try this: https://github.com/TinCanTech/easy-tls
-
- OpenVpn Newbie
- Posts: 4
- Joined: Sun Jan 02, 2022 7:36 pm
Re: Newbie question around custom shell script
Thanks for the pointers, I've become little bold experimenting stuff on OPNSense and just need to follow one rule i.e make a backup of configuration. The experiments mostly end badly but system restoration is a breeze once I am done messing around!TinCanTech wrote: ↑Sun Jan 02, 2022 9:46 pmStart here: https://community.openvpn.net/openvpn/w ... nPage#lbAS
If you feel brave then you could try this: https://github.com/TinCanTech/easy-tls
-
- OpenVpn Newbie
- Posts: 4
- Joined: Sun Jan 02, 2022 7:36 pm
Re: Newbie question around custom shell script
If I want to access an environment variable say "ifconfig_remote" from command line of the OS running OpenVPN Server then how do I get the output. I have tried "echo $ifconfig_remote", tried exporting it from a bash script using "--client-connected" option but each time I get "undefined_variable" as output.TinCanTech wrote: ↑Sun Jan 02, 2022 9:46 pmStart here: https://community.openvpn.net/openvpn/w ... nPage#lbAS
-
- OpenVPN Protagonist
- Posts: 11136
- Joined: Fri Jun 03, 2016 1:17 pm
Re: Newbie question around custom shell script
Imagine if you have 50 clients connected to your server, which ifconfig_remote, for which client, do you require ?
That is not how your server OS works. And teaching you how your OS works is way beyond the scope of this Forum.
The variables are only available to a script which was started by openvpn.
-
- OpenVpn Newbie
- Posts: 4
- Joined: Sun Jan 02, 2022 7:36 pm
Re: Newbie question around custom shell script [Solved]
I finally got OpenVPN and Monit to work together & the solution actually worked out to be lot simpler than I originally thought - https://forum.opnsense.org/index.php?topic=26221.0
@TinCanTech - thanks for your inputs!
@TinCanTech - thanks for your inputs!
-
- OpenVPN Protagonist
- Posts: 11136
- Joined: Fri Jun 03, 2016 1:17 pm
Re: HOWTO - use Monit to monitor VPN
Edited for visibility.
No idea of the quality.
Imagine, if you had 5,000 clients and ..
No idea of the quality.
Imagine, if you had 5,000 clients and ..