Re: [Openvpn-users] Client history

2024-02-28 Thread Gert Doering
Hi,

On Wed, Feb 28, 2024 at 12:52:17PM +, Peter Davis via Openvpn-users wrote:
> # cat /tmp/Connections.log 
> 2024-02-28 16:16:51 - CommonName connected with IP 192.168.129.253
> 
> So, why is the script not working in OpenVPN?

You already know the answer of that - because systemd is making /tmp
private.

Why are you running in circles?

gert
-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
 Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany g...@greenie.muc.de


signature.asc
Description: PGP signature
___
Openvpn-users mailing list
Openvpn-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-users


Re: [Openvpn-users] Client history

2024-02-28 Thread Jochen Bern

On 28.02.24 14:31, Bo Berglund wrote:

I am running *all* openvpn scripts from within /etc/openvpn/scripts and I use
the *full path* to the scripts in the conf files calls.

I also keep all of the custom logs (as defined in the conf file) below
/etc/openvpn/log, which is also perfectly accessile by tye openvpn service.

I can for the life of me not understan why someone is hell bent on complicating
the issues here by wandering around in circles in all kinds of strange locations


Well, that falls under "gotta know *your* systems", I suppose.

If the system in question were Red-Hat-ish with SELinux (it isn't, 
according to the OP), it would probably refuse your logfile placement:



# egrep 'openvpn_(var_log|unc)' 
/etc/selinux/targeted/contexts/files/file_contexts
/var/log/openvpn.*  system_u:object_r:openvpn_var_log_t:s0
/etc/openvpn/scripts(/.*)?  
system_u:object_r:openvpn_unconfined_script_exec_t:s0


Kind regards,
--
Jochen Bern
Systemingenieur

Binect GmbH


smime.p7s
Description: S/MIME Cryptographic Signature
___
Openvpn-users mailing list
Openvpn-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-users


Re: [Openvpn-users] Client history

2024-02-28 Thread Bo Berglund
On Wed, 28 Feb 2024 14:07:13 +0100, Marc SCHAEFER  wrote:

>On Wed, Feb 28, 2024 at 12:52:17PM +, Peter Davis via Openvpn-users wrote:
>> # #!/bin/bash
>> # export script_type="client-connect"
>> # export common_name="CommonName"
>> # export trusted_ip="192.168.129.253"
>> # ./server-events.sh
>
>I did not follow the whole discussion, but why on earth are you assuming that
>your current directly is somewhere known?  This is what ./ means:
>run server-events.sh in the current directory.
>
>Put your script in /usr/local/OPENVPN/scripts and call it as
>/usr/local/OPENVPN/scripts/server-events.sh for example.
>
>> So, why is the script not working in OpenVPN?
>
>If the problem is locating ./server-events.sh it is *possible* that OpenVPN log
>itself (or syslog, or the systemd journal) has some stderr output.
>
>There are other possibly problems, such as access rights (depending on what
>user the script is run on, possibly root).

I am running *all* openvpn scripts from within /etc/openvpn/scripts and I use
the *full path* to the scripts in the conf files calls.

I also keep all of the custom logs (as defined in the conf file) below
/etc/openvpn/log, which is also perfectly accessile by tye openvpn service.

I can for the life of me not understan why someone is hell bent on complicating
the issues here by wandering around in circles in all kinds of strange locations
like:
LOG_FILE="/tmp/Connections.log"

It is like using /var/log and hoping for the best

It never turns out as you want...


-- 
Bo Berglund
Developer in Sweden



___
Openvpn-users mailing list
Openvpn-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-users


Re: [Openvpn-users] Client history

2024-02-28 Thread Marc SCHAEFER
On Wed, Feb 28, 2024 at 12:52:17PM +, Peter Davis via Openvpn-users wrote:
> # #!/bin/bash
> # export script_type="client-connect"
> # export common_name="CommonName"
> # export trusted_ip="192.168.129.253"
> # ./server-events.sh

I did not follow the whole discussion, but why on earth are you assuming that
your current directly is somewhere known?  This is what ./ means:
run server-events.sh in the current directory.

Put your script in /usr/local/OPENVPN/scripts and call it as
/usr/local/OPENVPN/scripts/server-events.sh for example.

> So, why is the script not working in OpenVPN?

If the problem is locating ./server-events.sh it is *possible* that OpenVPN log
itself (or syslog, or the systemd journal) has some stderr output.

There are other possibly problems, such as access rights (depending on what
user the script is run on, possibly root).


___
Openvpn-users mailing list
Openvpn-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-users


Re: [Openvpn-users] Client history

2024-02-28 Thread Peter Davis via Openvpn-users
> On Monday, February 26th, 2024 at 5:06 PM, Bo Berglund 
>  wrote:

> On Mon, 26 Feb 2024 10:07:14 +, Peter Davis via Openvpn-users
> openvpn-users@lists.sourceforge.net wrote:
> 
> > Hi,
> > Thanks again.
> > I changed "LOG_FILE" to LOG_FILE="/tmp/Connections.log" and executed the 
> > script:
> > 
> > # ./script-events.sh
> > #
> > # cat /tmp/Connections.log
> > 2024-02-26 13:32:19 - CommonName connected with IP 192.168.129.253
> > 
> > The script worked, but where is the problem!
> 
> 
> Your description seems a bit odd, you should have started the test script
> testlogging, which in turn calls the script-events.sh script...
> 
> > Test script testlogging:
> > ---
> > #!/bin/bash
> > export script_type="client-connect"
> > export common_name="CommonName"
> > export trusted_ip="192.168.129.253"
> > ./server-events.sh <== HERE a call is made to the main script!
> > exit 0
> > 
> 
> 
> And you are way too unspecific since "where is the problem" gives nothing to
> help you by...
> 
> 
> --
> Bo Berglund
> Developer in Sweden
> 
> 
> 
> ___
> Openvpn-users mailing list
> Openvpn-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-users

Hello,
I did the test script:

# #!/bin/bash
# export script_type="client-connect"
# export common_name="CommonName"
# export trusted_ip="192.168.129.253"
# ./server-events.sh

The "LOG_FILE" in "server-events.sh" file is LOG_FILE="/tmp/Connections.log".

After it, the "Connections.log" file is created and its contents are as follows:

# cat /tmp/Connections.log 
2024-02-28 16:16:51 - CommonName connected with IP 192.168.129.253

So, why is the script not working in OpenVPN?


___
Openvpn-users mailing list
Openvpn-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-users