{"id":6332,"date":"2020-07-05T01:26:26","date_gmt":"2020-07-04T22:26:26","guid":{"rendered":"https:\/\/kifarunix.com\/?p=6332"},"modified":"2024-03-14T22:14:27","modified_gmt":"2024-03-14T19:14:27","slug":"configure-squid-proxy-openldap-authentication-on-pfsense","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/configure-squid-proxy-openldap-authentication-on-pfsense\/","title":{"rendered":"Configure Squid Proxy OpenLDAP Authentication on pfSense"},"content":{"rendered":"\n
Welcome to our tutorial on how to configure Squid Proxy OpenLDAP authentication on pfSense. Squid Proxy supports different types of authentication method, one of them being the lightweight directory access protocol (LDAP). Squid proxy authentication<\/a> ensures that only authenticated users can access the Internet as a way of filtering Internet access for individuals.<\/p>\n\n\n\n In our previous guide, we provided a step-by-step tutorial on how to install and setup Squid Proxy on pfSense. Below is the link;<\/p>\n\n\n\n Install and Setup Squid Proxy on pfSense<\/a><\/p>\n\n\n\n We assume that you already installed and setup Squid on pfSense, if not, follow the link above to set it up.<\/p>\n\n\n\n We also assume that have an OpenLDAP server up and running. In our case, we are using an OpenLDAP server running on a CentOS 8 system;<\/p>\n\n\n\n Install and Setup OpenLDAP on CentOS 8<\/a><\/p>\n\n\n\n To begin with, login to pfSense web interface and navigate to Services > Squid Proxy Server<\/strong>.<\/p>\n\n\n\n Click Authentication<\/strong> tab. This is where you define your Squid Proxy authentication mechanisms and settings.<\/p>\n\n\n\n On the Squid Authentication General Settings section;<\/p>\n\n\n\n In this section, you need to define your OpenLDAP authentication details.<\/p>\n\n\n\n Click Save<\/strong> once your are done with configurations.<\/p>\n\n\n\n Note that we chose STARTTLS as our transport method. As such, we need to install the CA certificate of the LDAP server for trusted connections.<\/p>\n\n\n\n Therefore, login into pfSense console via SSH. Replace pfsense-IP<\/strong> with the IP address of your pfSense server<\/p>\n\n\n\n Download the LDAP CA certificate using OpenSSL command. Replace the IP address accordingly.<\/p>\n\n\n\n Copy the certificate part;<\/p>\n\n\n\n Put the certificate in a file and store it in a convenient location, eg, Paste the certificate above into the file;<\/p>\n\n\n\n Next, open the Save and exit the file.<\/p>\n\n\n\n To test our Squid Proxy OpenLDAP authentication on browser, we will use Firefox. Learn how to configure proxy on firefox by checking the link below.<\/p>\n\n\n\n How to Configure Proxy Settings on Firefox Browser<\/a><\/p>\n\n\n\n Once you setup the proxy and try to browser Internet, you will be prompted to authenticate.<\/p>\n\n\n\n Enter your LDAP credentials and proceed to surf Internet.<\/p>\n\n\n\n You can tail Squid logs as well as LDAP logs to check what is going on.<\/p>\n\n\n\n You can as well check Squid logs from pfSense web interface in real time by navigating to Services > Squid Proxy Server > Real Time<\/strong>.<\/p>\n\n\n\n Similarly, check you LDAP logs;<\/p>\n\n\n\n That is it on how to configure Squid Proxy OpenLDAP authentication of pfSense.<\/p>\n\n\n\n Monitor Squid logs with Grafana and Graylog<\/a><\/p>\n\n\n\n Create Squid Logs Extractors on Graylog Server<\/a><\/p>\n\n\n\n Monitor Squid Access Logs with Graylog Server<\/a><\/p>\n\n\n\nConfiguring Squid Proxy OpenLDAP Authentication on pfSense<\/h2>\n\n\n\n
Configure Squid OpenLDAP Authentication Settings<\/h3>\n\n\n\n
Define Squid Authentication General Settings<\/h4>\n\n\n\n
\n
<\/figure>\n\n\n\n
Define Squid Authentication LDAP Settings<\/h4>\n\n\n\n
\n
<\/figure>\n\n\n\n
Import OpenLDAP CA Certificate on pfSense<\/h3>\n\n\n\n
ssh root@pfsense-IP<\/code><\/pre>\n\n\n\n
openssl s_client -connect 192.168.57.19:636 -showcerts < \/dev\/null | openssl x509 -text | sed -ne '\/-BEGIN CERTIFICATE-\/,\/-END CERTIFICATE-\/p'<\/code><\/pre>\n\n\n\n
-----BEGIN CERTIFICATE-----\nMIIDvzCCAqegAwIBAgIUc8imlOVhEej453dXtvacn7krg1MwDQYJKoZIhvcNAQEL\n...\n...\nIgf9K1e9M0Q+j2XEsTeCYVU\/v0Jt0kER0+V\/NM0IrDOX+6kRz6DNsZrwcMEf5Yvp\nARWZ\n-----END CERTIFICATE-----<\/code><\/pre>\n\n\n\n
\/usr\/local\/etc\/ssl\/<\/code><\/strong>.<\/p>\n\n\n\n
vi \/usr\/local\/etc\/ssl\/cacert.pem<\/code><\/pre>\n\n\n\n
-----BEGIN CERTIFICATE-----\nMIIDvzCCAqegAwIBAgIUc8imlOVhEej453dXtvacn7krg1MwDQYJKoZIhvcNAQEL\n...\n...\nIgf9K1e9M0Q+j2XEsTeCYVU\/v0Jt0kER0+V\/NM0IrDOX+6kRz6DNsZrwcMEf5Yvp\nARWZ\n-----END CERTIFICATE-----<\/code><\/pre>\n\n\n\n
\/usr\/local\/etc\/openldap\/ldap.conf<\/strong><\/code> file and insert the lines below.<\/p>\n\n\n\n
vi \/usr\/local\/etc\/openldap\/ldap.conf<\/code><\/pre>\n\n\n\n
TLS_CACERT \/usr\/local\/etc\/ssl\/cacert.pem<\/strong>\nTLS_REQCERT allow<\/code><\/pre>\n\n\n\n
Testing Squid Proxy OpenLDAP Authentication on Browser<\/h3>\n\n\n\n
<\/figure>\n\n\n\n
tail -f \/var\/squid\/logs\/access.log<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
tail -f \/var\/log\/slapd.log<\/code><\/pre>\n\n\n\n
Related Tutorials<\/h3>\n\n\n\n