Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    OpenVPN email stopped working

    Scheduled Pinned Locked Moved OpenVPN
    10 Posts 5 Posters 922 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tig.ext
      last edited by

      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"
      fi

      exit 0

      I did try a code editor but I can't get it to work
      Any help is much appreciated

      GertjanG 1 Reply Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator
        last edited by

        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.

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.8, 24.11

        1 Reply Last reply Reply Quote 0
        • T
          tig.ext
          last edited by

          It was just standard /usr/local/sbin/openvpn.attributes.sh amended with the email bit.
          Managed to fix it now, thanks for your help

          1 Reply Last reply Reply Quote 0
          • GertjanG
            Gertjan @tig.ext
            last edited by

            @tig-ext said in OpenVPN email stopped working:

            fired email notifications stopped working

            How did you implement this ?

            I'm using :
            ce04da38-a799-42a7-8298-22e1cf6d3ce5-image.png

            where the file/script /root/notify.sh is my script.

            The Custom option box isn't 'reset' when upgrading pfSense ....

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            T 1 Reply Last reply Reply Quote 0
            • T
              tig.ext
              last edited by

              Like I previously mentioned, I am using customized /usr/local/sbin/openvpn.attributes.sh.
              Just look at the first post

              1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan
                last edited by

                I know ☺

                Just wanted to propose you a method that doesn't need editing core files.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 0
                • T
                  tig.ext @Gertjan
                  last edited by

                  @Gertjan
                  I am confused now,
                  You did ask "How did you implement this ?"....
                  Your proposed method does not notify when VPN client disconnects

                  1 Reply Last reply Reply Quote 0
                  • kiokomanK
                    kiokoman LAYER 8
                    last edited by

                    @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

                    ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
                    Please do not use chat/PM to ask for help
                    we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
                    Don't forget to Upvote with the 👍 button for any post you find to be helpful.

                    T 1 Reply Last reply Reply Quote 0
                    • T
                      tig.ext @kiokoman
                      last edited by

                      @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 suggestions

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        thanhlangso @tig.ext
                        last edited by

                        @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 suggestions

                        Hi, Can you tell me your solutions?

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.