Squid3 reverse squid and squid in Ethiopia, please help rename proxy_monitor.sh

  • I am using pfsense in Ethiopia and it all works really well over here apart from when I try and install squid or squid3 packages.
    it gets to the proxy_monitor.sh then fails.
    The reason why it fails is that here in Ethiopia the word proxy is blocked.
    I have gor around the issue by installing a local repository and manually editing the squid.xml so it picks up the from a local source.

    If anyone would be so kind to rename this script to anything that does not contain the word proxy in this would be a life saver as I am training people here on how to use/install pfsense and the work roud solution requires an extra computer and other stuff that is difficult to get over here.

    Many thanks in advance for any help given

  • Seems easy to implement a name change, and it is nice to help out people from countries that put weird internet controls in place.
    There is already a squid_monitor.php, so it might be a little confusing to also have squid_monitor.sh, also there are some grep lines of code that look for the strings "squid" and "proxy_monitor" and find matching processes to kill. Having a process called "squid_monitor" would result in it matching a simple grep for "squid". So it would be best not to have the string "squid" in the name (saves having to mess with making those grep pipelines use better string matching patterns).
    sqp_monitor.sh (SQuid Proxy monitor) would make a unique name for matching.
    I am happy to do the search/replace through the code - should not take long.
    Marcello - as package maintainer, what do you think?

  • you mean just rename files with proxy to squid? eg:proxy_monitor.sh files to squid_monitor.sh ???

  • Yes, but having a process called squid_monitor will be a problem - some "grep" commands that currently look for processes that match anything that starts with "squid" might also kill "squid_monitor". So I suggest rename proxy_monitor.sh to sqp_monitor.sh, and make the necessary find/replace everywhere that refers to proxy_monitor.
    Actually, there are only a couple of files to change - I'll make a pull request for squid-reverse and you can look and see what you think.

  • @marcelloc - I just submitted a new pull request for squid-reverse (=squid3 package).
    There is a small issue with the way proxy_monitor.sh is setup at present. It gets put in /usr/local/etc/rc.d - that dir is for *.sh scripts that are intended to be called to start/stop packages (services) with the parameter "start" or "stop". Currently, rc.start_packages and rc.stop_packages are calling "proxy_monitor.sh start", "proxy_monitor.sh stop".
    proxy_monitor.sh does have code to avoid running twice, which avoids direct problems with these start/stop calls. However:
    a) If proxy_monitor.sh is not already running, then a call like "proxy_monitor.sh start" or "proxy_monitor.sh stop" will actually cause proxy_monitor.sh to run "normally", i.e. in its "do forever" monitoring loop. It would never return to the caller. This could result in rc.stop_packages effectively "hanging" and thus the system not shutting down.
    b) There is also the possibility that rc.start_packages might end up in this condition also at boot time, and the console login menu would never get displayed.
    It seems much safer to make the squid proxy monitor script be in /usr/local/pkg along with the other various bits of squid code. The squid_install_command() function then calls write_rcfile() to generate a proper start/stop script in /usr/local/etc/rc.d
    Now rc.start_packages and rc.stop_packages will start and stop the squid proxy monitor at the necessary times.
    The new monitor sript is called sqpmon.sh
    The start/stop file is called sqp_monitor.sh
    I hope this all makes sense - it resolves these issues as well as fixing the naming problem that debremarkos has.

  • Did you tested install, restart and reboot process?

    This code was from squid2, I've changed swap file size check.

  • The changes in my pull request were all for files in the squid-reverse folder (which is squid3 package) - https://github.com/bsdperimeter/pfsense-packages/tree/master/config/squid-reverse - cmb committed it a few hours ago.
    The 1st 4 files in the folder are the new/changed ones.
    I have done a squid3 install and have squid and sqpmon processes running, rebooted to test startup and it starts fine.
    There should not be anything changed in squid(2).
    @debremarkos - please try a squid3 install from Ethiopia and tell us how it goes.

  • thanks phil.davis!  :)

  • will try the squid 3 package now, sorry for the late reply we have been having some power issues over here (ie we have had none)
    Will let you know the results.

    Thank you Marcelloc and Phil for your help it is really appreciated.

  • Look forward to hearing how it goes. I understand the power issues, in Nepal we have places with up to 18-hours load-shedding each day (power on for 2 * 3-hour blocks). It makes low-power computing devices and solar panels very useful!

  • Phil, just tested and package installed like a DREAM!

    Thanks so much for this , Pfsense is used in so many universities here and this will mean these universities no longer have to fear a reinstall of pfsense (from a backup that includes the squid3 packages).

    Many many thanks

Log in to reply