Portál AbcLinuxu, 10. května 2025 05:52
$soubor="/etc/openvpn/access"; if ($x509 =~ /\/CN=([^\/]+)/) { # Accept the connection if the X509 common name # string matches the passed cn argument. $klic = $1; if (open(ALLOW, $soubor)){ # success while ($radek = <ALLOW>){ chomp $radek; if ($klic =~ /$radek/){ if (length($radek) !=0){ @args = ("logger -p local6.warn -t OpenVPN 'Login success: '.$klic"); system(@args) == 0 or die "Unable to use a system LOGGER, system @args failed: $?"; close(ALLOW); exit 0; } } } close(ALLOW); @args = ("logger -p local6.warn -t OpenVPN 'Login Denied: '.$klic"); system(@args) == 0 or die "Unable to use a system LOGGER, system @args failed: $?"; exit 1; } else { # fail - unable to open ACCESS file @args = ("logger -p local6.warn -t OpenVPN 'Unable to open ACCESS file: '.$klic"); system(@args) == 0 or die "Unable to use a system LOGGER, system @args failed: $?"; exit 1; } exit 1; #exit 0; }neni to buhvico - urcite nejaky zdatny Perlista by to jiste vyPerlil lepe (viz OPEN atp), ale delal jsem to pred casem opravdu ve spechu, a nedostal jsem se k vylepseni, takze ctenar promine :) je vhodne upravit logovani, pripadne si logovat do made home logu. S.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.