วันพฤหัสบดีที่ 22 กรกฎาคม พ.ศ. 2553

Config Apache

ServerSignature Off
ServerTokens Prod


The first one, ServerSignature Off tells apache not to display the server version on error pages, or other pages it generates.
บรรทัดแรก ServerSignature Off บอก Apache ไม่ให้แสดงรุ่นของ Apache ในหน้าที่ผิดพลาด หรือหน้าอื่นๆ ที่ตัว Apache สร้างขึ้น

The second one ServerTokens Prod tells apache to only return Apache in the Server header, returned on every page request.


ที่มา : http://www.petefreitag.com/item/419.cfm

วันอังคารที่ 13 กรกฎาคม พ.ศ. 2553

Chillispot แบบ fixed ip

บทความทั้งหมดมาจาก
http://manajung.blogspot.com/2010/01/chillispot-fix-ip-static-ip-address.html
ขอบคุณครับ

Chillispot แบบ fixed ip (Static IP address) และแบบ DHCP
มีหลายคนเข้าใจผิด คิดว่า Chillispot ทำงานกับเครื่องลูกที่ถูก fixed IP ไม่ได้

-ubuntu 8.0.4
-chillispot 1.0
-freeradius 1.1.7
-phpmyprepaid 0.4 RC3


#nano /etc/chillispot.conf -------------ตามนี้

###########################################
#
# Sample ChilliSpot configuration file
#
##########################################

# TAG: fg
# Include this flag if process is to run in the foreground
#fg

# TAG: debug
# Include this flag to include debug information.
#debug

# TAG: interval
# Re-read configuration file at this interval. Will also cause new domain
# name lookups to be performed. Value is given in seconds.
#interval 3600

# TAG: pidfile
# File to store information about the process id of the program.
# The program must have write access to this file/directory.
#pidfile /var/run/chilli.pid

# TAG: statedir
# Directory to use for nonvolatile storage.
# The program must have write access to this directory.
# This tag is currently ignored
#statedir ./


# TUN parameters

# TAG: net
# IP network address of external packet data network
# Used to allocate dynamic IP addresses and set up routing.
# Normally you do not need to uncomment this tag.
net 10.0.134.0/24

# TAG: dynip
# Dynamic IP address pool
# Used to allocate dynamic IP addresses to clients.
# If not set it defaults to the net tag.
# Do not uncomment this tag unless you are an experienced user!

dynip 10.0.134.16/25

# TAG: statip
# Static IP address pool
# Used to allocate static IP addresses to clients.
# Do not uncomment this tag unless you are an experienced user!
statip 10.0.134.0/28


# TAG: dns1
# Primary DNS server.
# Will be suggested to the client.
# If omitted the system default will be used.
# Normally you do not need to uncomment this tag.
#dns1 192.168.0.101

# TAG: dns2
# Secondary DNS server.
# Will be suggested to the client.
# If omitted the system default will be used.
# Normally you do not need to uncomment this tag.


# TAG: domain
# Domain name
# Will be suggested to the client.
# Normally you do not need to uncomment this tag.
#domain tfh.com,192.168.0.101

# TAG: ipup
# Script executed after network interface has been brought up.
# Executed with the following parameters:
#
# Normally you do not need to uncomment this tag.
#ipup /etc/chilli.ipup

# TAG: ipdown
# Script executed after network interface has been taken down.
# Executed with the following parameters:
#
# Normally you do not need to uncomment this tag.
#ipdown /etc/chilli.ipdown

# Radius parameters

# TAG: radiuslisten
# IP address to listen to
# Normally you do not need to uncomment this tag.
#radiuslisten 127.0.0.1

# TAG: radiusserver1
# IP address of radius server 1
# For most installations you need to modify this tag.
radiusserver1 127.0.0.1

# TAG: radiusserver2
# IP address of radius server 2
# If you have only one radius server you should set radiusserver2 to the
# same value as radiusserver1.
# For most installations you need to modify this tag.
radiusserver2 127.0.0.1

# TAG: radiusauthport
# Radius authentication port
# The UDP port number to use for radius authentication requests.
# The same port number is used for both radiusserver1 and radiusserver2.
# Normally you do not need to uncomment this tag.
#radiusauthport 1812

# TAG: radiusacctport
# Radius accounting port
# The UDP port number to use for radius accounting requests.
# The same port number is used for both radiusserver1 and radiusserver2.
# Normally you do not need to uncomment this tag.
#radiusacctport 1813

# TAG: radiussecret
# Radius shared secret for both servers
# For all installations you should modify this tag.
radiussecret sharedsecret

# TAG: radiusnasid
# Radius NAS-Identifier
# Normally you do not need to uncomment this tag.
#radiusnasid nas01

# TAG: radiuslocationid
# WISPr Location ID. Should be in the format: isocc=,
# cc=,ac=,network=
# Normally you do not need to uncomment this tag.
#radiuslocationid isocc=us,cc=1,ac=408,network=ACMEWISP_NewarkAirport

# TAG: radiuslocationname
# WISPr Location Name. Should be in the format:
# ,
# Normally you do not need to uncomment this tag.
#radiuslocationname ACMEWISP,Gate_14_Terminal_C_of_Newark_Airport


# Radius proxy parameters

# TAG: proxylisten
# IP address to listen to
# Normally you do not need to uncomment this tag.
#proxylisten 10.0.0.1

# TAG: proxyport
# UDP port to listen to.
# If not specified a port will be selected by the system
# Normally you do not need to uncomment this tag.
#proxyport 1645

# TAG: proxyclient
# Client(s) from which we accept radius requests
# Normally you do not need to uncomment this tag.
#proxyclient 10.0.0.1/24

# TAG: proxysecret
# Radius proxy shared secret for all clients
# If not specified defaults to radiussecret
# Normally you do not need to uncomment this tag.
#proxysecret testing123


# DHCP Parameters

# TAG: dhcpif
# Ethernet interface to listen to.
# This is the network interface which is connected to the access points.
# In a typical configuration this tag should be set to eth1.
dhcpif eth1
GNU nano 2.0.7 File: /etc/chilli.conf


# TAG: dhcpmac
# Use specified MAC address.
# An address in the range 00:00:5E:00:02:00 - 00:00:5E:FF:FF:FF falls
# within the IANA range of addresses and is not allocated for other
# purposes.
# Normally you do not need to uncomment this tag.
#dhcpmac 00:00:5E:00:02:00

# TAG: lease
# Time before DHCP lease expires
# Normally you do not need to uncomment this tag.
#lease 600


# Universal access method (UAM) parameters

# TAG: uamserver
# URL of web server handling authentication.
uamserver https://10.0.134.1/cgi-bin/hotspotlogin.cgi

# TAG: uamhomepage
# URL of welcome homepage.
# Unauthenticated users will be redirected to this URL. If not specified
# users will be redirected to the uamserver instead.
# Normally you do not need to uncomment this tag.
uamhomepage http://10.0.134.1/welcome.html

# TAG: uamsecret
# Shared between chilli and authentication web server
uamsecret sharedsecret

# TAG: uamlisten
# IP address to listen to for authentication requests
# Do not uncomment this tag unless you are an experienced user!
uamlisten 10.0.134.1

# TAG: uamport
# TCP port to listen to for authentication requests
# Do not uncomment this tag unless you are an experienced user!
#uamport 3990


# TAG: uamallowed
# Comma separated list of domain names, IP addresses or network segments
# the client can access without first authenticating.
# It is possible to specify this tag multiple times.
# Normally you do not need to uncomment this tag.
uamallowed www.chillispot.org,10.10.134.0/24

# TAG: uamanydns
# If this flag is given unauthenticated users are allowed to use
# any DNS server.
# Normally you do not need to uncomment this tag.
uamanydns


# MAC authentication

# TAG: macauth
# If this flag is given users will be authenticated only on their MAC
# address.
# Normally you do not need to uncomment this tag.
macauth

# TAG: macallowed
# List of MAC addresses.
# The MAC addresses specified in this list will be authenticated only on
# their MAC address.
# This tag is ignored if the macauth tag is given.
# It is possible to specify this tag multiple times.
# Normally you do not need to uncomment this tag.
#macallowed 00-0F-B0-D4-AF-2A

# TAG: macpasswd
# Password to use for MAC authentication.
# Normally you do not need to uncomment this tag.
macpasswd passwd

# TAG: macsuffix
# Suffix to add to MAC address in order to form the username.
# Normally you do not need to uncomment this tag.
#macsuffix suffix
---------------------------------------------------------
จบแกรแก้ไขไพล์

Fix IP ที่เครื่อง Client เป็น 10.0.134.15
netmask 255.255.255.0
gateway 10.0.134.1
dns x.x.x.x (แล้วแต่จะใช้)

และ เพิ่ม account ใน phpmyprepaid แบบ Subscription Time Account
ตรง username ให้ใส่ Mac address เช่น 00-13-D4-68-9C-88
ตรงช่อง password ให้ใส่ password อันเดียวกับ ที่บรรทัด macpasswd ในที่นี้คือ passwd

เพิ่มข้อมูล ใน Database
#mysql -u root -p
mysql>insert into radreply (username,attribute,op,value) values('00-13-D4-68-9C-88','Framed-IP-Address',':=','10.0.134.15');

mysql>INSERT INTO radcheck (username, attribute, value) VALUES ("00-13-D4-68-9C-88", "Auth-Type", "Accept");

mysql>quit;

นำ Client มาเสียบสาย LAN แล้วลองเปิดเวบดูนะครับ
ไม่ต้องกรอกข้อมูลหน้า login ใช้เน็ตได้เลย

วันศุกร์ที่ 9 กรกฎาคม พ.ศ. 2553

เทคนิค Squid 3.0 อนุญาตเฉพาะ mac address ที่ลงทะเบียน

ความเป็นมาคือ ให้นักเรียนใช้ระบบ Authetication ผ่าน Radius ส่วนครูและบุคลากรทางการศึกษาใช้แบบอิสระ(ไม่ต้องใส่รหัส) อยูบนเครือข่ายเดียวกัน วันดีคืนดี ก็มีคน(นักเรียน)มา Fix IP ใช้เน็ต เลยหาทางแก้ไข ถ้า Block IP เขาก็เปลี่ยนไปใช้ตัวอื่นอีก เลยคิดว่าน่าจะลงทะเบียนเครื่องแล้วเก็บ Mac Address ไว้ แล้วอนุมัติให้เฉพาะ Mac Address เหล่านี้เท่านั้นที่ใช้เน็ตได้ ที่เหลือให้ปฏิเสธ หาอยู่นานจนได้อย่างนี้

acl Member arp "/etc/memberlist.lst" # กำหนด acl ชื่อ Member โดย List ของ Mac Address อยู่ที่ไฟล์ใน /etc/memberlist.lst
http_access deny !Member #ให้ปฏิเสธการเชื่อมต่อของ Mac Address ที่ไม่ตรงกับ acl Member

ก็ได้ผลเป็นที่น่าพอใจ ลองใช้เครื่องอื่น ๆ Fix IP มา ปรากฎว่าเชื่อมต่อได้ แต่เมื่อเปิดเว็บ โช๊ะเด๊ะ ติด Squid ซะงั้น เฮ้อ โล่งอกไปที หลังจากหาวิธีป้องกันคนนอกมาใช้เครือข่ายตั้งนาน

อาจจะมีนักเรียนที่เก่ง(น้อยมากแต่ป้องกันไว้ก่อน) แอบใช้ซอร์ฟแวร์บางชนิดเพื่อทะลุ block ของ squid ที่นิยมใช้คือ ultrasurf อันนี้ก็แก้ไขได้ ดูในส่วนของ security แล้วกัน คุณ yim แนะนำไว้ เจ๋งมากๆ

ที่เป็นตัวฉัน

รูปภาพของฉัน
เรียนภาษาอังกฤษมา แต่ชีวิตผกผันให้ต้องมาเป็น admin ซะนี่ เล่นเอาซะมึน และงงตามลำดับ คิดอย่างเดียวว่า เป็นอะไรเป็นได้ถ้าใจอยากเป็น อุปสรรคคือแบบฝึกหัด ท้อแต่ไม่เคยถอย คิดไว้เสมอ ความพยายามอยู่ที่ไหน ความสำเร็จอยู่ที่นั่น ถ้าพยายามก่อน ก็ชนะแล้ว 50% อีก 50 % ใช้ความสามารถเอาเอง