Skip to content

How to configure Squid Reverse Proxy


This article will discuss a cron job that I setup to automatically restart my OpenVPN tunnel should it become disconnected for any reason.


In order to set this up, ssh into pfSense

Jump into the console and use Vi to create a shell script.


Insert the following script:

#!/usr/bin/env sh
if /sbin/ping -c 3; then
    # Success, Nothing to do
    exit 0
    # Fail, Reconnect VPN
    /usr/local/sbin/pfSsh.php playback svc restart openvpn client 2
exit 1


The IP address being pinged is the private gateway for the OpenVPN client. Also, the numerical value (ID) for the openvpn client (2) is found in the OpenVPN config files.

/var/etc/openvpn/client{ID}.conf then use ID into script

Make the script executable with chmod +x

The following should be done in a browser:

  • Open pfSense in a browser and navigate to Services --> Cron --> Settings.
  • Add a new cron job.
/root/ > /dev/null
  • Adjust the parameters as needed, although the crontab would look like this:
*/5 * * * * /root/ > /dev/null


A worthwhile way to make sure the cron job is running and doesn't silently fail is to have the job ping each time it runs. The specifics of configuring the check on is outside the scope of this article. This addition can be done as follows:

  • Create a new check on
  • Obtain the link it generates for the new job.
  • Go back to pfSense and modify the cron job syntax so that it looks like the following:
/root/ > /dev/null && curl -fsS --retry 3 -o /dev/null
  • Check the site and make sure the job is pinging successfully.