mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 23:18:42 +01:00
squid: initial import from old-packages
Signed-off-by: Luka Perkov <luka@openwrt.org>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
acl localnet src 10.0.0.0/8
|
||||
acl localnet src 172.16.0.0/12
|
||||
acl localnet src 192.168.0.0/16
|
||||
acl localnet src fc00::/7
|
||||
acl localnet src fe80::/10
|
||||
|
||||
acl ssl_ports port 443
|
||||
|
||||
acl safe_ports port 80
|
||||
acl safe_ports port 21
|
||||
acl safe_ports port 443
|
||||
acl safe_ports port 70
|
||||
acl safe_ports port 210
|
||||
acl safe_ports port 1025-65535
|
||||
acl safe_ports port 280
|
||||
acl safe_ports port 488
|
||||
acl safe_ports port 591
|
||||
acl safe_ports port 777
|
||||
acl connect method connect
|
||||
|
||||
http_access deny !safe_ports
|
||||
http_access deny connect !ssl_ports
|
||||
|
||||
http_access allow localhost manager
|
||||
http_access deny manager
|
||||
|
||||
http_access deny to_localhost
|
||||
|
||||
http_access allow localnet
|
||||
http_access allow localhost
|
||||
|
||||
http_access deny all
|
||||
|
||||
refresh_pattern ^ftp: 1440 20% 10080
|
||||
refresh_pattern ^gopher: 1440 0% 1440
|
||||
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
|
||||
refresh_pattern . 0 20% 4320
|
||||
|
||||
access_log none
|
||||
cache_log /dev/null
|
||||
cache_store_log /dev/null
|
||||
logfile_rotate 0
|
||||
|
||||
logfile_daemon /dev/null
|
||||
@@ -0,0 +1,5 @@
|
||||
config squid 'squid'
|
||||
option config_file '/etc/squid/squid.conf'
|
||||
option http_port '3128'
|
||||
option coredump_dir '/tmp/squid'
|
||||
option visible_hostname 'OpenWrt'
|
||||
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
|
||||
START=90
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/squid
|
||||
CONFIGFILE="/tmp/squid/squid.conf"
|
||||
|
||||
validate_squid_section() {
|
||||
uci_validate_section squid squid "${1}" \
|
||||
'config_file:string' \
|
||||
'http_port:port:3128' \
|
||||
'coredump_dir:string' \
|
||||
'visible_hostname:string:OpenWrt' \
|
||||
'pinger_enable:string:off'
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local config_file http_port coredump_dir visible_hostname pinger_enable
|
||||
|
||||
validate_squid_section squid || {
|
||||
echo "validation failed"
|
||||
return 1
|
||||
}
|
||||
|
||||
mkdir -p $(dirname $CONFIGFILE)
|
||||
|
||||
cat $config_file > $CONFIGFILE
|
||||
echo http_port $http_port >> $CONFIGFILE
|
||||
echo coredump_dir $coredump_dir >> $CONFIGFILE
|
||||
echo visible_hostname $visible_hostname >> $CONFIGFILE
|
||||
echo pinger_enable $pinger_enable >> $CONFIGFILE
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command $PROG -s -f $CONFIGFILE -N
|
||||
procd_set_param file $CONFIGFILE
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
${PROG} -f $CONFIGFILE -N -k shutdown 2>/dev/null
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "squid"
|
||||
procd_add_validation validate_squid_section
|
||||
}
|
||||
Reference in New Issue
Block a user