I'm trying to create an external acl helper for squid3 to (hopefully) cut down some config lines from my squid3 server and I wrote a simple python script for it:


import sys
import logging
import time

logger = logging.getLogger( 'squid_auth' )
logger.setLevel( logging.DEBUG )
fh = logging.FileHandler( 'spam.log' )
fh.setLevel( logging.DEBUG )
formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s' )
fh.setFormatter( formatter )
logger.addHandler( fh )

def grant ():
      sys.stdout.write( 'OK\n' )

def deny ():
      sys.stdout.write( 'ERR\n' )

while True:
      line = sys.stdin.readline().strip()
      if line:
              logger.info( line )
              time.sleep( 1 )

and added it into my squid.conf:

external_acl_type custom_acl %SRC %LOGIN %DST /etc/changemyip/squid/config/acl.py
acl CustomAcl external custom_acl
http_access allow CustomAcl

The path to the script is right (I can execute it in shell), the program has execute rights and everything but, when I reload squid I get this error about 5-6 times then squid crashes:

Aug 17 14:08:52 server7 (squid): The custom_acl helpers are crashing too rapidly, need help!
Aug 17 14:08:52 server7 squid[28233]: Squid Parent: child process 28290 exited with status 1
Aug 17 14:08:52 server7 squid[28233]: Exiting due to repeated, frequent failures

As you can see the script is just printing OK\n to the stdout to grant everyone. I haven't even started implementing any logic to it.

Tested with squid version: 3.1.19

  • have you tried without \n (CR/LF) ?
    – GioMac
    Aug 17 '13 at 11:19
  • tried and not working. Aug 17 '13 at 12:17
  • try to remove %LOGIN, just test
    – GioMac
    Aug 17 '13 at 12:23
  • debug_options ALL
    – GioMac
    Aug 17 '13 at 12:34

I had a similar problem. I managed to fix it by changing the ownership of the script to the squid user and moving the file from my home directory to somewhere in the root filesystem.


I still had the same problem even after following @tyrells helpful directions.

The fix?

We need to make the python script executable by running the command below.

sudo chmod u+x /path/to/external-acl.py

So to summarize here's step by step instructions.

  1. Move your script somewhere in the root filesystem. For me it was /usr/share/acl.py
  2. Fix the permissions. sudo chown proxy:proxy /usr/share/acl.py
  3. Make the script executable. sudo chmod u+x /usr/share/acl.py
  4. Restart squid. sudo service squid restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.