Use pfsense notification/SMTP function in sgerror.php (squidguard) - help



  • Hi,

    I am not good in php and web technologgies so I asked a colleague to modify parts of the sgerror.php of squidguard to give the user the ability to send me an e-mail with the blocked URL and a comment so that I am able to unblock the URL.

    My colleague used sendmail for php but it does not work and we found out that sendmail seems not to be installed/running on pfsense.

    Now my idea is to use the SMTP credentials uses unter SYSTEM –> ADVANCED --> NOTIFICATIONS in this sgerror.php file to authenticate on the destination E-Mail server.
    Easiest would be probably to "steal" the function from a pfsense file which for example triggers "gateway down" event. Then "just" put this function into the sgerror.php and that's it.

    So where to find the function which triggers an E-Mail event for "Gateway down" or something else?
    Or did anyone else built a sgerror.php which can already do what I want?

    Thank you very much for your feedback!



  • Hi,

    I tried to install sendmail on my pfsense 2.0.3 with freebsd 8.1 from this location:

    
    pkg_add -r http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/8.1-RELEASE/packages/All/sendmail-8.14.4_2.tbz
    
    

    It is now ih the list when doing

    
    pkg_info
    
    

    but I cannot find the confi file like

    
    sendmail.cf
    
    

    Isn't that the correct way to install an additional package which is not available in the package manager of pfsense?


  • Rebel Alliance Developer Netgate

    We don't include a config file for sendmail, you'd have to make one.

    But sendmail is way overkill.

    Look at what I did for the arpwatch package a couple weeks back. A small php script that gets dropped in where sendmail would go, and lets programs get mail out.



  • @jimp:

    We don't include a config file for sendmail, you'd have to make one.

    But sendmail is way overkill.

    Look at what I did for the arpwatch package a couple weeks back. A small php script that gets dropped in where sendmail would go, and lets programs get mail out.

    You probably mean this one:
    https://github.com/pfsense/pfsense-packages/blob/master/config/sm.php

    Unfortunately I am still using pfsense 2.0.3 and not 2.1.


  • Rebel Alliance Developer Netgate

    Then get with the times already and upgrade :-)

    It's not an unreasonable restriction these days. The function that script calls only exists on 2.1.

    Sure it could be done on 2.0.x but it means copying a bunch of code and a lot of extra work.


Log in to reply