Re: Client history

Bo Berglund <[email protected]>
Newsgroups gmane.network.openvpn.user
Message-ID <[email protected]>
On Fri, 23 Feb 2024 08:12:47 +0000, Peter Davis via Openvpn-users
<[email protected]> wrote:

>Hi,
>Thanks again.
>You right. Logs are under "/tmp/systemd-private-0b76fd773c1b491090b475708960936b-openvpn\@server.service-kEyUKj/tmp/Connections.log".
>
>Why is nothing written to the file when I create it in the "/var/log/openvpn directory"?
>
># ls -l /var/log/openvpn/
>total 40
>-rw-r--r-- 1 root root     0 Feb 23 10:16 Connections.log
>-rw------- 1 root root   603 Feb 23 11:41 openvpn-status.log
>-rw------- 1 root root 30242 Feb 23 11:40 openvpn.log

Why don't you (at least for testing that the script works) do as follows:

/etc/openvpn/server/server.conf:
--------------------------------
script-security 2
client-connect /etc/openvpn/scripts/server-events.sh
client-disconnect /etc/openvpn/scripts/server-events.sh

/etc/openvpn/scripts/server-events.sh:
--------------------------------------
# Log file path
LOG_FILE="/etc/openvpn/log/server-events.log"

(Notice case of the identifier!, see below)

On the command line:
--------------------
if you do not yet have a dir /etc/openvpn/log then do:

sudo mkdir /etc/openvpn/log

*DO NOT* create the log file there, let the script do it for you so the
permissions will be correctly set!

Now restart the openvpn server and make a connect attempt, then check the
/etc/openvpn/log dir for the logfile.

IMPORTANT:
==========
And please note that *all* identifiers are *case sensitive* in Linux so the
entry in your earlier post:

log_file="/tmp/Connections.log"

is *NOT* compatible with the script as I had written it where the variable
LOG_FILE is used...


-- 
Bo Berglund
Developer in Sweden
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.