xrogue icon

pfsense.sh

xrogue | PRO | 07/26/18 07:01:09 AM UTC | 0 ⭐ | 291 👁️ | Never ⏰ | []
Bash |

1.07 KB

|

None

|

0 👍

/

0 👎

#!/bin/sh
 
echo $script_type > /tmp/script
if [ "$script_type" = "client-connect" ]; then
        if [ -f /tmp/$common_name ]; then
                /bin/cat /tmp/$common_name > $1
                /bin/rm /tmp/$common_name
        fi
 /usr/bin/env > /tmp/blabla
        /bin/echo "     user_name: ${common_name}
        remote_pub_address: ${trusted_ip}
        vpn_client_ip: ${ifconfig_pool_remote_ip}
        datetime: $(date +'%Y/%m/%d %H:%M:%S')"| /usr/local/bin/php /usr/local/bin/mail.php -s"${common_name} has connected to the office network via O
penVPN"
 
elif [ "$script_type" = "client-disconnect" ]; then
        command="/sbin/pfctl -a 'openvpn/$common_name' -F rules"
        eval $command
        /sbin/pfctl -k $ifconfig_pool_remote_ip
        /sbin/pfctl -K $ifconfig_pool_remote_ip
 
        /usr/bin/env > /tmp/blabla.exit
        /bin/echo "     datetime: $(date +'%Y/%m/%d %H:%M:%S')
        ${username} has disconnected from the office network." | /usr/local/bin/php /usr/local/bin/mail.php -s"${username} has disconnected from the office network!"
fi

Comments