1

I've installed openvpn on Ubuntu18, and it works. I'd like to have a log containing only the times when users connect and disconnect. Found a hint how to do it at [https://github.com/furlongm/openvpn-monitor/issues/27]

use OpenVPN's hooks to have it log when users connect/disconnect. It's trivial to write a script that reads env vars and writes them to a log file. Just add that script to OpenVPN's config file as: client-connect /path/to/script client-disconnect /path/to/script

I understand how to edit the config file, but not the part about environment vars.

My *nix skills are about 3/10. Be gentle plz.

0

The env vars are environment variables. These are a list of variables that executed applications have access to. An application may be executed with different env vars values, and this may change its behaviour.

In a shell script, these are easily accessible. Eg. in Bash an env var is called the same as any other variable - simply by its name.

In this example, I gather, the VPN server will run the script with set environment variables relevant to a client session, so that they can easily be processed in the script.

If you know the variables that are used, just make use of them in the script. Otherwise, you may need to figure them out. For a start, try the env command, which will dump all the env vars for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.