OpenVPN email stopped working
-
HI,
I have updated PF sense and now the script that fired email notifications stopped working.
Here is the 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
/bin/echo "user_name: ${common_name} 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} connected to the OpenVPN"
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
/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} disconnected from the OpenVPN"
fiexit 0
I did try a code editor but I can't get it to work
Any help is much appreciated -
if you put some custom script on and then you updated pfsense, then yeah that could break your script.. Where did you get this script - who is the author.. Contact him/her/them for support.
-
It was just standard /usr/local/sbin/openvpn.attributes.sh amended with the email bit.
Managed to fix it now, thanks for your help -
@tig-ext said in OpenVPN email stopped working:
fired email notifications stopped working
How did you implement this ?
I'm using :
where the file/script /root/notify.sh is my script.
The Custom option box isn't 'reset' when upgrading pfSense ....
-
Like I previously mentioned, I am using customized /usr/local/sbin/openvpn.attributes.sh.
Just look at the first post -
I know
Just wanted to propose you a method that doesn't need editing core files.
-
@Gertjan
I am confused now,
You did ask "How did you implement this ?"....
Your proposed method does not notify when VPN client disconnects -
@tig.ext what they are trying to tell you is that it's not a good idea to modify a core file because as soon as you upgrade pfsense again you will lose that mods again. instead create a script inside /root like connect.sh and disconnect.sh and call it with the advanced configuration where you can set client-connect /root/connect.sh and client-disconnect /root/disconnect.sh
-
-
@tig-ext said in OpenVPN email stopped working:
@kiokoman Yep, I do get it,
I was just pointing out that @Gertjan asked how I did it and when I pointed him to first post he replied
"I know "
This thread can be closed now, thanks for the suggestionsHi, Can you tell me your solutions?