xrogue

pfsense.sh

Jul 26th, 2018
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.07 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. echo $script_type > /tmp/script
  4. if [ "$script_type" = "client-connect" ]; then
  5.         if [ -f /tmp/$common_name ]; then
  6.                 /bin/cat /tmp/$common_name > $1
  7.                 /bin/rm /tmp/$common_name
  8.         fi
  9.  /usr/bin/env > /tmp/blabla
  10.         /bin/echo "     user_name: ${common_name}
  11.        remote_pub_address: ${trusted_ip}
  12.        vpn_client_ip: ${ifconfig_pool_remote_ip}
  13.        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
  14. penVPN"
  15.  
  16. elif [ "$script_type" = "client-disconnect" ]; then
  17.         command="/sbin/pfctl -a 'openvpn/$common_name' -F rules"
  18.         eval $command
  19.         /sbin/pfctl -k $ifconfig_pool_remote_ip
  20.         /sbin/pfctl -K $ifconfig_pool_remote_ip
  21.  
  22.         /usr/bin/env > /tmp/blabla.exit
  23.         /bin/echo "     datetime: $(date +'%Y/%m/%d %H:%M:%S')
  24.        ${username} has disconnected from the office network." | /usr/local/bin/php /usr/local/bin/mail.php -s"${username} has disconnected from the office network!"
  25. fi
Advertisement
Add Comment
Please, Sign In to add comment