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

    Squid Proxy with ldap Authentication

    Scheduled Pinned Locked Moved Cache/Proxy
    3 Posts 2 Posters 3.3k 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.
    • N
      net_admin
      last edited by

      I am setting up a pfsense firewall with a squid3 proxy. I am looking to authenticate against an openldap server using the starttls option. The server does not allow authentication or binds to be performed unless ssl or starttls is used.

      I do not see an option in the squid setting page to set these options - or to specify a CA to use for building the trust relationship.

      Is there an option I am overlooking, or is this set some place else (cli maybe?)

      Thanks

      1 Reply Last reply Reply Quote 0
      • N
        net_admin
        last edited by

        So I was able to make this work:

        1. scp Root Cert to pfsense (I sent it to /opt/ca.pem)

        2. Edit squid.inc file, and add -ZZ option to the command (note: option requires version 3)
          The -ZZ option specifies to use startTLS

        File: /usr/local/pkg/squid.inc  (search file for appropriate line)
        From ->

        $conf .= "auth_param basic program " . SQUID_LOCALBASE . "/libexec/squid/basic_ldap_auth -v {$settings['ldap_ver
        sion']} -b {$settings['ldap_basedomain']} -D {$settings['ldap_user']} $password -f \"{$settings['ldap_filter']}\" -u {$settings['ldap_userattrib
        ute']} -P {$settings['auth_server']}$port\n";
        

        To ->

        $conf .= "auth_param basic program " . SQUID_LOCALBASE . "/libexec/squid/basic_ldap_auth -ZZ -v {$settings['ldap_ver
        sion']} -b {$settings['ldap_basedomain']} -D {$settings['ldap_user']} $password -f \"{$settings['ldap_filter']}\" -u {$settings['ldap_userattrib
        ute']} -P {$settings['auth_server']}$port\n";
        
        1. Edit squid.conf with same option:
          File: /usr/pbi/squid-amd64/local/etc/squid/squid.conf (search file for appropriate line)
          From ->
        auth_param basic program /usr/pbi/squid-amd64/local/libexec/squid/basic_ldap_auth -v 3 -b ou=People,dc=example,dc=com -D cn=nssproxy,ou=Serv
        ices,dc=example,dc=com -w passHere -f "(&(objectClass=person)(uid=%s))" -u uid -P ldap.example.com:389
        

        To ->

        auth_param basic program /usr/pbi/squid-amd64/local/libexec/squid/basic_ldap_auth -ZZ -v 3 -b ou=People,dc=example,dc=com -D cn=nssproxy,ou=Serv
        ices,dc=example,dc=com -w passHere -f "(&(objectClass=person)(uid=%s))" -u uid -P ldap.example.com:389
        

        4. Edit ldap.conf file to point to ca.pem like:
        File:/usr/pbi/squid-amd64/local/etc/openldap/ldap.conf

        #
        # LDAP Defaults
        #
        
        # See ldap.conf(5) for details
        # This file should be world readable but not world writable.
        
        #BASE	dc=example,dc=com
        #URI	ldap://ldap.example.com ldap://ldap-master.example.com:666
        
        #SIZELIMIT	12
        #TIMELIMIT	15
        #DEREF		never
        TLS_CACERT /opt/ca.pem
        TLS_REQCERT allow
        
        

        With all this being said - my concern is that these changes will be overwritten at some point due to an update, reboot, restart, ect.  What is the preferred method for adding changes/options that are not directly supported via the GUI?

        If all possible I would prefer to do this via the GUI (still hoping I missed the option) - I would like to stay away from these kind of customizations as much as possible.

        1 Reply Last reply Reply Quote 0
        • R
          robertfranz
          last edited by

          This going to sounds odd - but on the Squid Local Cache tab, at the bottom of the pager is a section labelled Dynamic and Update Content.

          In that section is a text box "Custom refresh_patterns"

          Apparently, there are a lot of options that can be passed here - I know I've passed log directives to change to combined and pipe it through syslog_ng.

          Quite possible that your code could be passed here, and it does survive reboots and (so far) upgrades.

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