Squid url redirector

Hex Artifact Content
anonymous

Hex Artifact Content

Artifact 1ed1cb1793e0eb2ec950d85c4852d1920d12a1d6d13ee8208ae356e8f5a389f9:


0000: 48 65 72 65 20 69 73 20 61 20 73 61 6d 70 6c 65  Here is a sample
0010: 20 73 71 75 69 64 20 63 6f 6e 66 69 67 75 72 61   squid configura
0020: 74 69 6f 6e 3a 0a 0a 75 72 6c 5f 72 65 77 72 69  tion:..url_rewri
0030: 74 65 5f 70 72 6f 67 72 61 6d 20 2f 70 61 74 68  te_program /path
0040: 2f 74 6f 2f 73 71 75 69 64 2d 74 61 67 67 65 72  /to/squid-tagger
0050: 2f 73 71 75 69 64 2d 74 61 67 67 65 72 2e 70 79  /squid-tagger.py
0060: 0a 75 72 6c 5f 72 65 77 72 69 74 65 5f 63 68 69  .url_rewrite_chi
0070: 6c 64 72 65 6e 20 31 0a 75 72 6c 5f 72 65 77 72  ldren 1.url_rewr
0080: 69 74 65 5f 63 6f 6e 63 75 72 72 65 6e 63 79 20  ite_concurrency 
0090: 31 30 32 34 0a 0a 59 6f 75 20 6e 65 65 64 20 74  1024..You need t
00a0: 6f 20 63 72 65 61 74 65 20 64 61 74 61 62 61 73  o create databas
00b0: 65 20 77 69 74 68 20 73 70 65 63 69 66 69 63 20  e with specific 
00c0: 75 73 65 72 20 66 6f 72 20 73 71 75 69 64 2d 74  user for squid-t
00d0: 61 67 67 65 72 20 6c 69 6b 65 20 74 68 69 73 3a  agger like this:
00e0: 0a 0a 43 52 45 41 54 45 20 52 4f 4c 45 20 73 71  ..CREATE ROLE sq
00f0: 75 69 64 74 61 67 20 57 49 54 48 20 6c 6f 67 69  uidtag WITH logi
0100: 6e 20 70 61 73 73 77 6f 72 64 20 27 70 61 73 73  n password 'pass
0110: 77 6f 72 64 27 3b 0a 43 52 45 41 54 45 20 44 41  word';.CREATE DA
0120: 54 41 42 41 53 45 20 73 71 75 69 64 74 61 67 20  TABASE squidtag 
0130: 57 49 54 48 20 4f 57 4e 45 52 20 73 71 75 69 64  WITH OWNER squid
0140: 74 61 67 3b 0a 0a 41 66 74 65 72 20 74 68 61 74  tag;..After that
0150: 20 64 61 74 61 62 61 73 65 20 73 68 6f 75 6c 64   database should
0160: 20 62 65 20 70 6f 70 75 6c 61 74 65 64 20 77 69   be populated wi
0170: 74 68 3a 0a 0a 70 73 71 6c 20 2d 66 20 2f 70 61  th:..psql -f /pa
0180: 74 68 2f 74 6f 2f 73 71 75 69 64 2d 74 61 67 67  th/to/squid-tagg
0190: 65 72 2f 64 61 74 61 62 61 73 65 2e 73 71 6c 20  er/database.sql 
01a0: 2d 55 20 73 71 75 69 64 74 61 67 20 73 71 75 69  -U squidtag squi
01b0: 64 74 61 67 0a 0a 59 6f 75 20 61 6c 73 6f 20 73  dtag..You also s
01c0: 68 6f 75 6c 64 20 63 72 65 61 74 65 20 63 6f 6e  hould create con
01d0: 66 69 67 20 66 69 6c 65 20 6e 65 65 64 65 64 20  fig file needed 
01e0: 62 79 20 73 71 75 69 64 2d 74 61 67 67 65 72 20  by squid-tagger 
01f0: 74 6f 20 61 63 63 65 73 73 20 64 61 74 61 62 61  to access databa
0200: 73 65 2c 0a 62 79 20 64 65 66 61 75 6c 74 20 73  se,.by default s
0210: 71 75 69 64 2d 74 61 67 67 65 72 20 73 65 61 72  quid-tagger sear
0220: 63 68 65 73 20 74 68 69 73 20 66 69 6c 65 20 69  ches this file i
0230: 6e 20 2f 75 73 72 2f 6c 6f 63 61 6c 2f 65 74 63  n /usr/local/etc
0240: 2f 20 6f 6e 20 62 65 68 61 6c 66 20 6f 66 0a 62  / on behalf of.b
0250: 73 64 2d 73 74 79 6c 65 20 63 6f 6e 66 69 67 20  sd-style config 
0260: 66 69 6c 65 20 6c 6f 63 61 74 69 6f 6e 73 2e 20  file locations. 
0270: 42 75 74 20 74 68 69 73 20 63 61 6e 20 62 65 20  But this can be 
0280: 6f 76 65 72 72 69 64 64 65 6e 20 77 69 74 68 20  overridden with 
0290: 2d 63 20 63 6f 6d 6d 61 6e 64 0a 6c 69 6e 65 20  -c command.line 
02a0: 73 77 69 74 63 68 2e 0a 0a 53 61 6d 70 6c 65 20  switch...Sample 
02b0: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 69  configuration fi
02c0: 6c 65 20 69 73 20 61 6c 73 6f 20 69 6e 63 6c 75  le is also inclu
02d0: 64 65 64 2e 20 4e 6f 74 65 20 74 68 61 74 20 79  ded. Note that y
02e0: 6f 75 20 73 68 6f 75 6c 64 20 73 65 74 20 66 69  ou should set fi
02f0: 6c 65 0a 6f 77 6e 65 72 73 68 69 70 20 74 6f 20  le.ownership to 
0300: 73 71 75 69 64 20 61 6e 64 20 72 65 77 6f 6b 65  squid and rewoke
0310: 20 61 6e 79 20 72 65 61 64 69 6e 67 20 70 72 69   any reading pri
0320: 76 69 6c 65 67 65 73 20 66 72 6f 6d 20 67 72 6f  vileges from gro
0330: 75 70 20 61 6e 64 20 6f 74 68 65 72 73 2e 0a 0a  up and others...
0340: 73 71 75 69 64 2d 74 61 67 67 65 72 20 6c 6f 67  squid-tagger log
0350: 73 20 61 6c 6c 20 6d 65 73 73 61 67 65 73 20 74  s all messages t
0360: 68 72 6f 75 67 68 20 74 68 65 20 73 79 73 6c 6f  hrough the syslo
0370: 67 20 66 61 63 69 6c 69 74 79 2e 20 54 68 65 79  g facility. They
0380: 20 63 61 6e 20 62 65 0a 6f 62 74 61 69 6e 65 64   can be.obtained
0390: 20 61 6e 64 20 73 61 76 65 64 20 77 69 74 68 3a   and saved with:
03a0: 0a 0a 5b 2f 65 74 63 2f 73 79 73 6c 6f 67 2e 63  ..[/etc/syslog.c
03b0: 6f 6e 66 5d 0a 21 73 71 75 69 64 54 61 67 0a 2a  onf].!squidTag.*
03c0: 2e 2a 20 2f 76 61 72 2f 6c 6f 67 2f 73 71 75 69  .* /var/log/squi
03d0: 64 54 61 67 0a 0a 5b 2f 65 74 63 2f 6e 65 77 73  dTag..[/etc/news
03e0: 79 73 6c 6f 67 2e 63 6f 6e 66 5d 0a 2f 76 61 72  yslog.conf]./var
03f0: 2f 6c 6f 67 2f 73 71 75 69 64 54 61 67 20 36 34  /log/squidTag 64
0400: 34 20 37 20 31 30 32 34 20 2a 20 4a 0a 0a 52 65  4 7 1024 * J..Re
0410: 6d 65 62 65 72 20 74 6f 20 63 72 65 61 74 65 20  meber to create 
0420: 74 68 65 20 66 69 6c 65 20 61 6e 64 20 72 65 73  the file and res
0430: 74 61 72 74 20 73 79 73 6c 6f 67 20 61 66 74 65  tart syslog afte
0440: 72 77 69 73 65 2e 0a                             rwise..