Wednesday, June 29, 2011

Sample smb.conf File

[global]
netbios name = KAPRE
workgroup = HEDCEN
server string = HedCen File Server
security = user
guest account = bisita

[teachers]
path = /home/teacher/Documents
writeable = yes
valid users = @teacher
locking = yes
create mode = 0660
directory mode = 0770

[students]
path = /home/student/Documents
writeable = yes
valid users = @student
locking = yes
create mode = 0660
directory mode = 0770

[home]
comment = Home Directory
path = %H
valid users = %S
create mode = 0600
directory mode = 0700
locking = no

Friday, June 17, 2011

HedCen Squid Server

acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network

acl blocksites url_regex "/etc/squid/block-squid.acl"
acl blocktime url_regex "/etc/squid/timeblock-squid.acl"

acl morning time 07:00-12:00
acl okam1 time 00:00-06:59
acl okam2 time 12:01-12:29
acl afternoon time 12:30-19:00
acl okpm1 time 19:01-23:59

acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT

http_access deny blocksites


http_access deny morning blocktime
http_access deny afternoon blocktime

http_access allow okam1 blocktime
http_access allow okam2 blocktime
http_access allow okpm1 blocktime

http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all

http_port 3128 transparent

hierarchy_stoplist cgi-bin ?
access_log /var/log/squid/access.log squid
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
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
coredump_dir /var/spool/squid

HedCen DHCP Server

#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim;
ignore client-updates;

subnet 10.10.10.0 netmask 255.255.255.0 {
range 10.10.10.10 10.10.10.110;
option routers 10.10.10.1;
option subnet-mask 255.255.255.0;
option domain-name "hedcen.portal.ph";
option domain-name-servers 10.10.10.1;
option netbios-name-servers 10.10.10.1;
default-lease-time 21600;
max-lease-time 43200;
}

Transparent Squid Setup Firewall Script

#!/bin/bash

echo 1 > /proc/sys/net/ipv4/ip_forward

# Flush rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -s 10.10.10.0/255.255.255.0 -d 0.0.0.0/0.0.0.0 -j MASQUERADE

Thursday, June 2, 2011

Sample Squid Configuration File

The following is a sample squid 2.7 configuration file (/etc/squid/squid.conf):

acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network

acl blocksites url_regex "/etc/squid/squid-block.acl"

acl officehour time M T W H F 9:00-16:59
acl afteroffice time 17:00-24:00
acl beforeoffice time 00:00-6:00
acl banned dst www.pornsite.com

acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT

http_access allow afteroffice blocksites
http_access allow beforeoffice blocksites
http_access deny blocksites

http_access deny banned

http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 3128
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
hosts_file /etc/hosts
coredump_dir /var/spool/squid