Archive for the ‘debian’ Category
Posted by กวิน ชัยเลิศ on Friday, January 16th, 2009
สำหรับผู้ดูแลระบบที่มีความจำเป็นต้องใช้งาน Remote Login ผ่าน OpenSSH Client อยู่เป็นประจำไม่ว่าจะใช้งานบน Linux, *BSD, Mac OS X คงจะเกิดอาการเบื่อไม่น้อยที่ต้องพิมพ์ Password ทุกๆ ครั้งที่ต้องการจะ Login (ไม่นับ Password จำพวก 123456 นะครับ) ทางออกสำหรับผู้ที่ต้องการ Login โดยไม่ต้องพิมพ์ Password แถมยังคงความปลอดภัยตามแบบฉบับของ OpenSSH สามารถทำได้ตามวิธีดังต่อไปนี้ครับ
ระบบที่ทำการทดสอบ
- OpenSSH Client บน Mac OS X 10.5.6
- OpenSSH Server บน Ubuntu 8.04
ขั้นตอนแรก ทำการสร้าง keys สำหรับยืนยันตัวตนระหว่าง Client และ Server (ทำบนเครื่อง Client ในที่นี้คือ Mac OS X)
MacClient:~ UserA$ ssh-keygen -t rsa
MacClient:~ UserA$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/UserA/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/UserA/.ssh/id_rsa.
Your public key has been saved in /Users/UserA/.ssh/id_rsa.pub.
The key fingerprint is:
a4:74:0b:bc:2f:d1:f5:c7:4e:90:51:7f:f4:45:84:a0 UserA@MacClient
คลิกที่นี่เพื่อดูส่วนที่เหลือ »
Tags: *BSD, centos, Linux, Login, Mac OS X, OpenSSH, password, ssh, ubuntu, รหัสผ่าน
Posted in CentOS, FreeBSD, Mac OS X, Operating System, debian, ubuntu | 1 Comment »
Posted by กวิน ชัยเลิศ on Friday, January 16th, 2009
กรณีที่ผู้ดูแลระบบได้รับมอบหมายให้ดูแล server ที่ตนเองไม่ได้ติดตั้ง คงจะอยากรู้ว่า Linux / Unix server ที่ใช้อยู่เป็น version อะไร …
สามารถตรวจสอบได้จากคำสั่งต่อไปนี้ครับ
ได้ Output ประมาณนี้ครับ
Linux version 2.6.27-9-generic (buildd@rothera) (gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11) ) #1 SMP Thu Nov 20 21:57:00 UTC 200
หรือดู version ในไฟล์ /etc/issue
(issue – pre-login message and identification file)
ได้ Output ประมาณนี้ครับ
* ทดสอบบน Ubuntu 8.10
Tags: *BSD, command, Distribution, Linux, คำสั่ง
Posted in CentOS, Operating System, debian, ubuntu | 1 Comment »
Posted by อัทศักดิ์ วงศ์กิตตะ on Thursday, January 15th, 2009
สวัสดีอีกครั้งครับหลังจากหายหน้าหายตาไปนาน จริงๆก็ไม่ได้ไปไหนแค่หลังๆมางานที่ office ค่อนข้างมากแล้วผมเองก็ไปเที่ยวสะบ่อยๆ เลยไม่ค่อยได้มาเขียนบทความให้อ่านกัน วันนี้เป็นเรื่องการทำ VPN โดยใช้ OpenVPN ทำไมต้องเป็น OpenVPN สาเหตุของผมคือ ผมเองต้องติดตั้งระบบ Auth System (Radius + Chillispot + Syslog-ng) แต่ละที่ดันเป็น Dynamic IP หมด เวลาจะแก้ไขอะไรก็ต้องไป set router ซึ่งมันไม่ใช่ทางเลือกที่ดีเลย ทางแก้ผมเลย set up ที่ Center แล้วให้ Site แต่ละที่ทำการสร้าง VPN Connection ไปยัง Center
Server# apt-get install openvpn
Server# vi /etc/openvpn/server.conf
# ไฟล์ /etc/openvpn/server.conf
dev tap0
proto tcp-server
ping 1
ping-restart 5
port 10000
ifconfig 10.10.10.1 255.255.255.0
Client# apt-get install openvpn
Client# vi /etc/openvpn/client.conf
# ไฟล์ /etc/openvpn/server.conf
dev tap0
proto tcp-client
ping 1
ping-restart 5
port 10003
ifconfig 10.10.10.2 255.255.255.0
remote 203.1.1.1
Server# /etc/init.d/openvpn start
Client# /etc/init.d/openvpn start
Tags: debian, OpenVPN
Posted in Operating System, debian | No Comments »
Posted by อัทศักดิ์ วงศ์กิตตะ on Monday, September 1st, 2008
คือมี case ที่ต้องทำ transparent proxy ครับ แต่ว่าเวลา proxy มีปัญหา ผมอยากให้ทำการ ปลด proxy ออกเอง ผมเลยเขียน shell script มาเพื่อทำการ ตรวจสอบว่า proxy ทำได้หรือเปล่า ถ้าทำงานได้ ก็จะเพิ่ม iptables ทำการสร้าง DNAT ไปยังเครื่อง Proxy ครับ
คลิกที่นี่เพื่อดูส่วนที่เหลือ »
Tags: Linux, Proxy, Shell script, Squid, Transparent, TransparentProxy
Posted in Development, FreeBSD, Shell script, debian | 1 Comment »
Posted by อัทศักดิ์ วงศ์กิตตะ on Sunday, August 24th, 2008
ตามที่ พรบ ได้กำหนดให้ “ผู้ให้บริการ” เก็บ log การใช้บริการ โชคดีที่ผมมี Revert Proxy วางไว้หน้า Web Server ทำให้สามารถเก็บ Log ได้ง่ายหน่อย ตัว script ที่ผมเขียนนี้ จะทำการ rotate log และ compress log ไว้ ใน version ต่อไป จะทำการ ftp ไปไว้ยัง Log Server อื่น แทนครับ 
คลิกที่นี่เพื่อดูส่วนที่เหลือ »
Tags: Apache, Log, Proxy, Revert, Rotate, Squid, พรบ
Posted in Development, Shell script, debian | 3 Comments »
Posted by กวิน ชัยเลิศ on Friday, July 11th, 2008
ในเบื่องต้นผมขอแนะนำให้รู้จัก Squid กันก่อนครับ
Squid เป็น Open Source Software ที่ให้บริการ Proxy caches ซึ่ง Squid สามารถติดตั้งให้ทำงานใน 3 รูปแบบหลักดังนี้
1. Standard Proxy Cache
ใช้สำหรับเก็บ cache ของ static web pages จำพวก html และรูปภาพ โดยทั่วไปมักจะถูกใช้งานใน network ภายในองค์กร โดยที่ web pages ต่างๆ ที่ถูกเรียกผ่าน local network เป็นครั้งที่สอง web browser จะแสดงผล web pages นั้นผ่าน proxy cache แทนที่ไปดึงข้อมูลจาก web server มาแสดงผล (ประหยัด bandwidth และเพิ่มความเร็วในการแสดงผล)
2. Transparent Cache
ความสามารถหลักๆ เหมือนกับการติดตั้งแบบ standard proxy cache จะแตกต่างกันที่การติดตั้งแบบ transparent cache ไม่จำเป็นต้องปรับแต่ง web browser ให้สามารถใช้งาน proxy cache โดยที่ transparent cache จะทำหน้าที่คอยกรอง HTTP traffic (on port 80) แล้วตรวจสอบว่า request นั้นมีอยู่ใน cahce หรือไม่ ถ้าไม่มีก็จะทำการส่งต่อไปยัง web server ของ web pages นั้น (สำหรับ Linux การใช้งาน transparent cache จะใช้ควบคู่ไปกับ iptables ในการกรอง HTTP traffic)
3. Reverse Proxy Cache
สำหรับ reverse proxy cache จะทำหน้าที่แตกต่างกับ standard และ transparent caches โดยที่ reverse proxy cache จะทำหน้าที่ลดภาระของ web server แทนที่การลด network bandwidth ของฝั่ง client กล่าวคือ reverse proxy cache ถูกติดตั้งอยู่หน้า web server (ระหว่าง internet และ web server) คอยจัดการ traffic ที่เกิดขึ้นทั้งหมดก่อนจะถึง web server ป้องกัน traffic ที่เพิ่มขึ้นโดยไม่พีงประสงค์ (ซึ่งอาจจะโดนโจมตีจาก hacker เป็นต้น) อีกทั้งยังลดภาระของ web server อีกทางนึง

คลิกที่นี่เพื่อดูส่วนที่เหลือ »
Tags: centos, HTTP traffic, httpd-accelerator, Implement, Proxy, Reverse Proxy, Squid, transparent cache
Posted in CentOS, FreeBSD, debian, ubuntu | 2 Comments »
Posted by กวิน ชัยเลิศ on Thursday, July 3rd, 2008
ไม่ยากใช่ไหมครับหากต้องการยกเลิก screen saver บน X window แต่สำหรับ text mode (linux console) ผมคิดว่าหลายๆ คนยังไม่เคยยกเลิก blank screen หรือกำลังหาทางยกเลิกมันอยู่ สำหรับผมแล้วการยกเลิก blank screen บน linux console นั้นมีประโยชน์มากครับ ยกตัวอย่างเช่น เราสามารถทำงานไปพร้อมๆ กันกับการ monitor ดู error หรือ log จากอีกจอนึง (กรณีมีจอ monitor มากกว่าหนึ่งจอ) โดยที่ไม่ต้องคอยกดคีย์บอร์ดหรือเลื่อนเมาส์เพื่อให้ linux console แสดงผลอยู่ตลอดเวลา
สำหรับวิธีการนั้นก็ไม่ได้ยุ่งยากเลยครับ แค่ใช้คำสั่ง setterm เท่านั้น
setterm -blank 0 -powersave off -powerdown 0 < /dev/console > /dev/console 2>&1
หากต้องการยกเลิก blank screen ทุกครั้งหลังจาก start linux ให้ทำการเพิ่มคำสั่งดังกล่าวในไฟล์ /etc/rc.local เพียงเท่านี้ก็ไม่ต้องคอยกดคีย์บอร์ดหรือเลื่อนเมาส์ทุกๆ 5 นาทีแล้วครับ
Tags: blank screen, centos, concole, debian, linux console, setterm, ubuntu, X window
Posted in CentOS, Operating System, debian, ubuntu | No Comments »
Posted by กวิน ชัยเลิศ on Saturday, June 21st, 2008
มาทำความรู้รักกับ PXE กันก่อนครับ
PXE หรือ Preboot eXecution Environment เป็น Open Standard ที่พัฒนาขึ้นโดย Intel ซึ่ง PXE นี้จะยอมให้ Computer ต่างๆ (Server, PC, Laptop, Notebook ที่ BIOS ลองรับ PXE Booting) สามารถ boot ผ่าน network ได้ไม่ต้องง้อ floppy, cd หรือ dvd กันเลยทีเดียว (มันสุดยอดจริงๆ ครับ)
มาลุยกันเลยครับ
Server : CentOS 5.1 + dhcp + tftp-server + httpd + syslinux
Client : Ubuntu 8.04
เอาเป็นว่าทุกๆ ท่านติดตั้ง CentOS ไว้เป็นที่เรียบร้อย ทีนี้ก็เป็นขั้นตอนการติดตั้ง PXE Server ละครับ
แปลงร่างเป็น root
ติดตั้ง dhcp, tftp-server, httpd และ syslinux
yum install dhcp tftp-server httpd syslinux
เตรียม install files (ผมเลือกติดตั้ง Ubuntu 8.04)
>>วิธี mount iso image บน linux
wget http://ftp.science.nus.edu.sg/linux/ubuntu-ISO/8.04/ubuntu-8.04-server-i386.iso
mkdir -p /var/www/html/mirror/ubuntu/8.04
mount -o loop ubuntu-8.04-server-i386.iso /var/www/html/mirror/ubuntu/8.04
cp -fr /var/www/html/mirror/ubuntu/8.04/install/netboot/* /tftpboot
คลิกที่นี่เพื่อดูส่วนที่เหลือ »
Tags: centos, debian, dhcp, httpd, install, intel, Linux, network booting, network install, open standard, PXE, syslinux, tftp-server
Posted in CentOS, Operating System, debian, ubuntu | 2 Comments »