| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | |||
| 4 | package App::Squid::Redirector::Fugu; | ||
| 5 | |||
| 6 | our $VERSION = '0.0.9'; | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | App::Squid::Redirector::Fugu - A Squid HTTP redirector. | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | Fugu is a Squid HTTP redirector based on Squidguard. | ||
| 15 | |||
| 16 | =head1 USAGE | ||
| 17 | |||
| 18 | =head2 A full config file example | ||
| 19 | |||
| 20 | { | ||
| 21 | "bdbdir": "/var/lib/fugu", | ||
| 22 | "logdir": "/var/log/squid3", | ||
| 23 | |||
| 24 | "dbdsn": "dbi:mysql:mydbname;host=192.168.1.48", | ||
| 25 | "dbuser": "mydbuser", | ||
| 26 | "dbpassword": "mydbpassword", | ||
| 27 | |||
| 28 | "ldapserver": "server.domain.local", | ||
| 29 | "ldapdn": "cn=myldapuser,ou=Department,dc=domain,dc=local", | ||
| 30 | "ldappassword": "myldappassword", | ||
| 31 | |||
| 32 | "time": { | ||
| 33 | "work": [ | ||
| 34 | { "smtwhfa": "10:00-12:00" }, | ||
| 35 | { "smtwhfa": "13:30-18:00" } | ||
| 36 | ], | ||
| 37 | "nowork": [ | ||
| 38 | { "smtwhfa": "18:01-09:59" }, | ||
| 39 | { "smtwhfa": "12:01-13:29" } | ||
| 40 | ] | ||
| 41 | }, | ||
| 42 | |||
| 43 | "src": { | ||
| 44 | "finance": { | ||
| 45 | "ip_sql": "select address from user where department='finance' and active='Y'" | ||
| 46 | }, | ||
| 47 | "humanresources": { | ||
| 48 | "ip_file": "humanresources-ips" | ||
| 49 | }, | ||
| 50 | "it": { | ||
| 51 | "user_sql": "select login from user where department='it' and active='Y'" | ||
| 52 | }, | ||
| 53 | "marketing": { | ||
| 54 | "user_file": "marketing-users" | ||
| 55 | }, | ||
| 56 | "production": { | ||
| 57 | "user_ldap_base": "dc=domain,dc=local", | ||
| 58 | "user_ldap_filter": "(&(objectclass=person)(memberof=cn=production,ou=Groups,dc=domain,dc=local))", | ||
| 59 | "user_ldap_attr": "sAMAccountName" | ||
| 60 | }, | ||
| 61 | "purchasing": { | ||
| 62 | "user_ldap_base": "dc=domain,dc=local", | ||
| 63 | "user_ldap_filter": "(&(objectclass=person)(memberof=cn=purchasing,ou=Groups,dc=domain,dc=local))", | ||
| 64 | "user_ldap_attr": "sAMAccountName" | ||
| 65 | } | ||
| 66 | }, | ||
| 67 | |||
| 68 | "dst": { | ||
| 69 | "exe": { | ||
| 70 | "expression_file": "exe-expressions" | ||
| 71 | }, | ||
| 72 | "socialnet": { | ||
| 73 | "domain_file": "socialnet-domains" | ||
| 74 | }, | ||
| 75 | "porn": { | ||
| 76 | "domain_file": "porn-domains", | ||
| 77 | "url_file": "porn-urls" | ||
| 78 | }, | ||
| 79 | "allowed": { | ||
| 80 | "domain_file": "allowed-domains", | ||
| 81 | "url_file": "allowed-urls" | ||
| 82 | }, | ||
| 83 | "denied": { | ||
| 84 | "domain_sql": "select domain from table_domain where category='denied'", | ||
| 85 | "url_sql": "select url from table_url where category='denied'" | ||
| 86 | } | ||
| 87 | }, | ||
| 88 | |||
| 89 | "access": [ | ||
| 90 | { | ||
| 91 | "src": "it", | ||
| 92 | "pass": [ | ||
| 93 | "!porn", | ||
| 94 | "all" | ||
| 95 | ] | ||
| 96 | }, | ||
| 97 | { | ||
| 98 | "src": "humanresources", | ||
| 99 | "pass": [ | ||
| 100 | "allowed", | ||
| 101 | "socialnet", | ||
| 102 | "none" | ||
| 103 | ] | ||
| 104 | }, | ||
| 105 | { | ||
| 106 | "src": "production", | ||
| 107 | "pass": [ | ||
| 108 | "allowed", | ||
| 109 | "none" | ||
| 110 | ] | ||
| 111 | }, | ||
| 112 | { | ||
| 113 | "src": "default", | ||
| 114 | "time": "work", | ||
| 115 | "pass": [ | ||
| 116 | "allowed", | ||
| 117 | "!exe", | ||
| 118 | "!socialnet", | ||
| 119 | "!porn", | ||
| 120 | "none" | ||
| 121 | ], | ||
| 122 | "redirect": { | ||
| 123 | "http": "http://www.google.com", | ||
| 124 | "https": "www.google.com:443" | ||
| 125 | } | ||
| 126 | }, | ||
| 127 | { | ||
| 128 | "src": "default", | ||
| 129 | "time": "nowork", | ||
| 130 | "pass": [ | ||
| 131 | "!exe", | ||
| 132 | "!porn", | ||
| 133 | "all" | ||
| 134 | ], | ||
| 135 | "redirect": { | ||
| 136 | "http": "http://www.google.com", | ||
| 137 | "https": "www.google.com:443" | ||
| 138 | } | ||
| 139 | } | ||
| 140 | ] | ||
| 141 | |||
| 142 | } | ||
| 143 | |||
| 144 | =head2 Building domains and URLs DBs | ||
| 145 | |||
| 146 | fugu-build --config /etc/fugu.conf | ||
| 147 | |||
| 148 | =head2 Configuring squid.conf | ||
| 149 | |||
| 150 | url_rewrite_program fugu --config /etc/fugu.conf | ||
| 151 | |||
| 152 | =cut | ||
| 153 | |||
| 154 | 1; |