หน้าเว็บ

แสดงบทความที่มีป้ายกำกับ server แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ server แสดงบทความทั้งหมด

วันอังคารที่ 3 พฤศจิกายน พ.ศ. 2552

VMWare Server 2 – RuntimeFault: Database temporarily unavailable or has network problems

If you add a new User (New Permission) to the VMWare Server 2 via the VMware Infrastructure Web Access you may get the message “The server response included one or more errors” with the details “RuntimeFault: Database temporarily unavailable or has network problems”.

vmerr


To fix this you first have to stop the VMWare management service:

/etc/init.d/vmware-mgmt stop


Now open the file “/etc/vmware/hostd/authorization.xml” and change the value of ‘’ to 50 for example.


After that change you can start the VMWare management service again:

/etc/init.d/vmware-mgmt start


Now you can relogin into the VMware Infrastructure Web Access and add the new user. (If you get the error again, change the value of again to a higher value)


Thanks : mogilowski.net

วันศุกร์ที่ 30 ตุลาคม พ.ศ. 2552

Introduction to Cybozu Share360

What is Cybozu® Share360®?

As a sixth-generation product from industry-leader Cybozu, Share360 is a groupware suite with applications like Scheduler, WebMail, Cabinet, Announcements, Project, Web Forms and more. Share360 provides the applications your need to effectively communicate and coordinate your office or group.

Cybozu Share360 is Affordable Groupware

Share360 saves you money with up-front pricing which costs you hundreds of dollars less per user. With affordable upgrades, one-time payment and no hidden costs or annual fees, Share360 groupware offers an immediate value. Our 60-day no-obligation free trial (no money down!) allows you to run a fully-functional version of Share360 for your evaluation.

Cybozu Share360 is Accessible Groupware

Share360 applications can be set up to run on your intranet or on the Internet, allowing users to access their accounts quickly and easily. Share360 Sync for Palm OS®, Sync for Pocket PC and Share360 Outlook Sync allow you to take critical data with you while you're on the go.

Cybozu Share360 is Hassle-Free Groupware

environment
*1
[Share360] must be installed only in one server machine.
*2
SMTP Server and POP3 Server are necessary to use WebMail.

Share360 is easy to download and install and even easier to maintain. There are no necessary client installations, so once you have Share360 up and running, it will be available to all of your users. You can run Share360 on Windows, Linux or FreeBSD (you may migrate between operating systems free of charge), or even arrange for pre-installed packaged solutions or hosted solutions by Hitachi Software.


Share360 includes all of the following:

Address Book
Announcements
Cabinet
Memos
Notes
Phone Messages

Project**
Scheduler
ToDo List
Time Sheet
Web Forms**
WebMail


Download your free 60-day trial now!


Thanks : share360.com

วันพุธที่ 28 ตุลาคม พ.ศ. 2552

Installing PHP5 and Apache on Ubuntu

Installing PHP5 and Apache on Ubuntu

Easy way to get PHP and Apache for running on Ubuntu.


From a command shell, you will run the following commands:

sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

sudo /etc/init.d/apache2 restart


Note that if apache is already installed you can omit the first line. Your web files will now be found in /var/www/

Thanks : howtogeek.com


Why Your Company Should Virtualize With Top 5 Reasons to Adopt

Why Your Company Should Virtualize

Virtualizing your IT infrastructure lets you reduce IT costs while increasing the efficiency, utilization, and flexibility of your existing assets. Around the world, companies of every size benefit from VMware virtualization. Thousands of organizations—including all of the Fortune 100—use VMware virtualization solutions. See how virtualizing 100% of your IT infrastructure will benefit your organization.

Top 5 Reasons to Adopt Virtualization Software

  1. Get more out of your existing resources: Pool common infrastructure resources and break the legacy “one application to one server” model with server consolidation.
  2. Reduce datacenter costs by reducing your physical infrastructure and improving your server to admin ratio: Fewer servers and related IT hardware means reduced real estate and reduced power and cooling requirements. Better management tools let you improve your server to admin ratio so personnel requirements are reduced as well.
  3. Increase availability of hardware and applications for improved business continuity: Securely backup and migrate entire virtual environments with no interruption in service. Eliminate planned downtime and recover immediately from unplanned issues.
  4. Gain operational flexibility: Respond to market changes with dynamic resource management, faster server provisioning and improved desktop and application deployment.
  5. Improve desktop manageability and security: Deploy, manage and monitor secure desktop environments that users can access locally or remotely, with or without a network connection, on almost any standard desktop, laptop or tablet PC.
Thanks : vmware.com

วันจันทร์ที่ 26 ตุลาคม พ.ศ. 2552

Introduction to Wamp Server

Apache, MySQL, PHP on Windows


WampServer is a Windows web development environment. It allows you to create web applications with Apache, PHP and the MySQL database. It also comes with PHPMyAdmin to easily manage your databases.

WampServer installs automatically (installer), and its usage is very intuitive. You will be able to tune your server without even touching the setting files.

WampServer is the only packaged solution that will allow you to reproduce your production server. Once WampServer is installed, you have the possibility to add as many Apache, MySQL and PHP releases as you want.

WampServer also has a trayicon to manage your server and its settings.




Includes :
- Apache 2.2.11
- MySQL 5.1.36
- PHP 5.3.0



Installing


Double click on the downloaded file and just follow the instructions. Everything is automatic. The WampServer package is delivered whith the latest releases of Apache, MySQL and PHP.

Once WampServer is installed, you can add other releases by downloading them on this website. They will then appear in the WampServer menu and you will be able to switch releases with a simple click.
Each release of Apache, MySQL and PHP has its own settings and its own files (datas for MySQL).

Functionalities


WampServer's functionalities are very complete and easy to use so we won't explain here how to use them.

With a left click on WampServer's icon, you will be able to:
- manage your Apache and MySQL services
- switch online/offline (give access to everyone or only localhost)
- install and switch Apache, MySQL and PHP releases
- manage your servers settings
- access your logs
- access your settings files
- create alias

With a right click :
- change WampServer's menu language
- access this page

How to start


When you install WampServer, a "www" directory is created (generally c:\wamp\www). Create a directory inside for your project and put your PHP files in it.
Click on the link "Localhost" in the WampServer menu or open your browser and open the http://localhost address.




Add Apache, MySQL and PHP releases


WampServer allows you to install almost all the existing releases of Apache, PHP and MySQL so you can reproduce exactly the settings of your production server.
To add a new release, donwload it here and install it.

Then click on the WampServer menu and activate the release that you want to use.



Wait until the WampServer icon become white again and start to work.


Downloads


WampServer is an open source project, free to use (GPL licence). If you think our work deserves it and you want to help us, you can make a donation with paypal.



Apache 2.2.11
PHP 5.3.0
MySQL 5.1.36
Phpmyadmin

size: 16Mo

Thanks : wampserver.com

วันอังคารที่ 20 ตุลาคม พ.ศ. 2552

Introduction to Ultra Monkey

Ultra Monkey: High Availability and Load Balancing Solution for Linux

[Monkey]


Overview

Cluster Network Services
Ultra Monkey is a project to create load balanced and highly available network services. For example a cluster of web servers that appear as a single web server to end-users. The service may be for end-users across the world connected via the internet, or for enterprise users connected via an intranet.


Diagram: Sample Ultra Network

1. An end-user sends a packet to the virtual service
2. Ultra Monkey selects a server and forwards the packet
3. The server replies
4. Ultra Monkey forwards this reply back to the end-user

Flexible
Ultra Monkey makes use of the Linux operating system to provide a flexible solution that can be tailored to a wide range of needs. From small clusters of only two nodes to large systems serving thousands of connections per second.


Open Source Working with Your Network

Use Any Operating System
While the Ultra Monkey software itself runs on Linux, it is able to provide clustering for virtually any network services running on an operating system that can communicate using TCP or UDP. This means almost any operating system, including Windows™, Solaris™ and of course Linux itself.

Supports a Wide Range of Protocols
Ultra Monkey supports a wide range of protocols, with native health checks for: Web, Mail, FTP, News, LDAP and DNS. Other protocols can be suported using a non-native health check or by adding a custom health check.

Open Source
Ultra Monkey is open source. It makes use of software from various open source projects including The Linux Virtual Server and Heartbeat. Members of the Ultra Monkey project actively contribute to the open source projects whose software is used. Horms, the Ultra Monkey project lead, is one of the core members of the development teams for both Heartbeat and The Linux Virtual Server.


Easy to Install and Maintain

Download, Install, Configure, Project Complete!

Supported Distribitions
Ultra Monkey provides binary packages for a selected list of distributions. Source packages are also available. At this time the following distributions are supported:

  • Debian Woody (Stable 3.0)
  • Debian Sid (Unstable/Testing)
  • Fedora Core 1
  • Red Hat Enterprise Linux 3.0
  • Red Hat 9
  • Red Hat 8.0
  • Red Hat 7.3

Updates
The Ultra Monkey team tracks software packages and releases updates for security or other critical bugs. This includes the kernel as Ultra Monkey provides a kernel patched with The Linux Virtual Server and other related patches. Announcements of these updates packages are available in the News Archive.

Documentation
Ultra Monkey also provides concise documentation in English and Japanese to allow system administrators to easily install and configure an Ultra Monkey cluster. The documentation is available online at www.ultramonkey.org and ultramonkey.jp. Ultra Monkey does not however place restrictions on the way that the underlying software and Linux itself is used, allowing users to customise the system to their needs.


Key Features

Download

The current release is Ultra Monkey 3 which has been built and tested on Debian Sarge and Red Hat Enterprise Linux 3.0. It includes comprehensive documentation on the software included, the technologies used and how to configure a highly available and/or load balanced network. more....

The previous release, 2.0.1, is also available, though new deployments are incouraged to use Ultra Monkey 3. more....

Miscellaneous

The history lists all releases of Ultra Monkey.

More Information

For more information please see the Ultra Monkey web site.


Thanks : ultramonkey.org/

วันพฤหัสบดีที่ 15 ตุลาคม พ.ศ. 2552

What is AWStats?

What is AWStats

AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. This log analyzer works as a CGI or from command line and shows you all possible information your log contains, in few graphical web pages. It uses a partial information file to be able to process large log files, often and quickly. It can analyze log files from all major server tools like Apache log files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C log format) and a lot of other web, proxy, wap, streaming servers, mail servers and some ftp servers.
Take a look at this comparison table for an idea on features and differences between most famous statistics tools (AWStats, Analog, Webalizer,...).
AWStats is a free software distributed under the GNU General Public License. You can have a look at this license chart to know what you can/can't do.
As AWStats works from the command line but also as a CGI, it can work with all web hosting providers which allow Perl, CGI and log access.


Example :
1. Demo for web server log files
2. Static demo for ftp log files
3. Static demo for mail log files


Features

A full log analysis enables AWStats to show you the following information:
* Number of visits, and number of unique visitors,
* Visits duration and last visits,
* Authenticated users, and last authenticated visits,
* Days of week and rush hours (pages, hits, KB for each hour and day of week),
* Domains/countries of hosts visitors (pages, hits, KB, 269 domains/countries detected, GeoIp detection),
* Hosts list, last visits and unresolved IP addresses list,
* Most viewed, entry and exit pages,
* Files type,
* Web compression statistics (for mod_gzip or mod_deflate),
* OS used (pages, hits, KB for each OS, 35 OS detected),
* Browsers used (pages, hits, KB for each browser, each version (Web, Wap, Media browsers: 97 browsers, more than 450 if using browsers_phone.pm library file),
* Visits of robots (319 robots detected),
* Worms attacks (5 worm's families),
* Search engines, keyphrases and keywords used to find your site (The 115 most famous search engines are detected like yahoo, google, altavista, etc...),
* HTTP errors (Page Not Found with last referrer, ...),
* Other personalized reports based on url, url parameters, referer field for miscellanous/marketing purpose,
* Number of times your site is "added to favourites bookmarks".
* Screen size (need to add some HTML tags in index page).
* Ratio of Browsers with support of: Java, Flash, RealG2 reader, Quicktime reader, WMA reader, PDF reader (need to add some HTML tags in index page).
* Cluster report for load balanced servers ratio.

AWStats also supports the following features:
* Can analyze a lot of log formats: Apache NCSA combined log files (XLF/ELF) or common (CLF), IIS log files (W3C), WebStar native log files and other web, proxy, wap or streaming servers log files (but also ftp or mail log files). See AWStats F.A.Q. for examples.
* Works from command line and from a browser as a CGI (with dynamic filters capabilities for some charts),
* Update of statistics can be made from a web browser and not only from your scheduler,
* Unlimited log file size, support split log files (load balancing system),
* Support 'not correctly sorted' log files even for entry and exit pages,
* Reverse DNS lookup before or during analysis, support DNS cache files,
* Plugin for country detection from IP location (use geoip country database or client domain name),
* Plugin for city detection from IP location (use geoip city database),
* Plugins for US/Canadian Region , ISP and/or Organizations reports (require non free third product geoipregion, geoipisp and/or geoiporg database)
* WhoIS links,
* A lot of options/filters and plugins can be used,
* Multi-named web sites supported (virtual servers, great for web-hosting providers),
* Cross Site Scripting Attacks protection,
* Several languages. See AWStats F.A.Q. for full list.
* No need of rare perl libraries. All basic perl interpreters can make AWStats working,
* Dynamic reports as CGI output.
* Static reports in one or framed HTML/XHTML pages, experimental PDF export,
* Look and colors can match your site design, can use CSS,
* Help and tooltips on HTML reported pages,
* Easy to use (Just one configuration file to edit),
* Analysis database can be stored in XML format for XSLT processing,
* A Webmin module,
* Absolutely free (even for web hosting providers), with sources (GNU General Public License),
* Available on all platforms,
* AWStats has a XML Portable Application Description.

Requirements:
To use AWStats, you need the following requirements:
* Your server must log web access in a log file you can read.
* You must be able to run perl scripts (.pl files) from command line and/or as CGI (Perl 5.007003 or higher required to run AWStats 6.9 or higher).
If not, you can solve this by downloading last Perl version at ActivePerl (Win32) or Perl.com (Unix/Linux/Other).
See AWStats F.A.Q. to have examples of supported OS and Web servers.

Download : Here!

Thanks : awstats.sourceforge.net

What is Jetty ?

What is Jetty ?

Programming Language:
Java

Description:
Jetty is a 100% Java HTTP Server and Servlet Container. This means that you do not need to configure and run a seperate web server (like Apache) in order to use java, servlets and JSPs to generate dynamic content. Jetty is a fully featured web server for static and dynamic content. Unlike separate server/container solutions, this means that your web server and web application run in the same process, without interconnection overheads and complications. Furthermore, as a pure java component, Jetty can be simply included in your application for demonstration, distribution or deployment. Jetty is available on all Java supported platforms.

Author: Greg Wilkins and the Jetty Dev. Team

What do you think are its best features?

It's focused design and evolution. Jetty has always been and will always be an HTTP component that can be reused in an application. It does not try to be an application server itself (although JettyPlus is a distro bundle with application server tendencies).

I like to say "put Jetty in your application rather than put your application in Jetty". Of course some of the "applications" Jetty has been put into have been application servers such as JBoss, JOnAS and Geronimo.

The design of Jetty is very easy to comprehend and we get lots of good feedback about the quality of the code.

Jetty is not currently the fastest servlet server, but it does have a small footprint and very good (and improving) performance.


Homepage: http://jetty.mortbay.org/jetty/index.html


Example : Zimbra server


Thanks : osdir.com

วันอังคารที่ 13 ตุลาคม พ.ศ. 2552

How To Use iptables for Linux Firewalls

How To Use iptables

You can start, stop, and restart iptables after booting by using the commands:
# service iptables start
# service iptables stop
# service iptables restart


To get iptables configured to start at boot, use the chkconfig command:.
# chkconfig iptables on

You can determine whether iptables is running or not via the service iptables status command. Fedora Core will give a simple status message. For example
# service iptables status

iptables Won't Start
# touch /etc/sysconfig/iptables
# chmod 600 /etc/sysconfig/iptables
# service iptables start

Example : Allowing WWW And SSH Access To Your Firewall
#---------------------------------------------------------------
# Allow previously established connections
# - Interface eth0 is the internet interface
#---------------------------------------------------------------

iptables -A OUTPUT -o eth0 -m state --state ESTABLISHED,RELATED \
-j ACCEPT

#---------------------------------------------------------------
# Allow port 80 (www) and 22 (SSH) connections to the firewall
#---------------------------------------------------------------

iptables -A INPUT -p tcp -i eth0 --dport 22 --sport 1024:65535 \
-m state --state NEW -j ACCEPT
iptables -A INPUT -p tcp -i eth0 --dport 80 --sport 1024:65535 \
-m state --state NEW -j ACCEPT

And More at linuxhomenetworking.com

How to Disable SELinux ?

How to Disable SELinux

SELinux หรือ Security Enhanced Linux ซึ่งเป็นระบบรักษาความปลอดภัยแบบเข้มข้น
ออกแบบและพัฒนาโดยสำนักงานความมั่นคงแห่งชาติสหรัฐ (NSA)

SELinux ทำให้เรื่องที่คอนฟิกง่าย ๆ กลายเป็นยุ่งยากขึ้นถนัดตา เนื่องจากมีการเช็คความถูกแบบละเอียดมาก

จะแก้ไขผ่าน Cmd หรือ Gui ก็แล้วแต่ถนัดครับ
nano /etc/sysconfig/selinux หรือ vi /etc/sysconfig/selinux แล้วแต่ถนัด

เสร็จแล้วแก้ค่าจาก
SELINUX=enforcing
เป็น
SELINUX=disabled

แล้วก็ reboot server 1 ครั้ง

Thanks : thaiadmin.org

วันศุกร์ที่ 9 ตุลาคม พ.ศ. 2552

DNS Server On Fedora Core 5

การติดตั้ง DNS Server ด้วย Fedora Core 5

การติดตั้ง DNS Server เพื่อใช้งานในเครือข่ายองค์กร และเครือข่ายอินเตอร์เน็ต ....

การติดตั้ง DNS Server ด้วย Fedora Core 5

1. ตรวจสอบ BIND packet ด้วยคำสั่ง ดังตัวอย่างนี้

[ root@kk ~ ]# rpm -qa bind
bind-9.3.2-4.1

ในการทดลองนี้ ได้ติดตั้งโปรแกรม BIND ไว้แล้วคือ bind-9.3.2-4.1 ซึ่งเป็นเวอร์ชั่น 9.3.2-4.1

2. หากยังไม่ได้ติดตั้งโปรแกรม BIND สามารถดาวน์โหลดได้ที่ http://fedora.redhat.com/download/ ซึ่งต้องดาวน์โหลดเป็นไฟล์ rpm และเป็น Fedora Core 5 หรือสูงกว่า เมื่อดาวน์โหลดเสร็จแล้ว ทำการติดตั้งด้วยคำสั่ง ดังตัวอย่างนี้

[ root@kk ~ ]# rpm -ivh bind-9.3.2-4.1.rpm

3. เพิ่มชื่อโดเมน และกลุ่ม IP address ที่ต้องการ ลงไปในไฟล์ named.conf ดังตัวอย่างนี้

3.1 ใช้คำสั่ง vi เพื่อแก้ไขไฟล์ named.conf ดังตัวอย่างนี้

[ root@kk ~ ]# vi /etc/named.conf

3.2 กดปุ่ม insert หรือ กด i เพื่อแทรกและแก้ไขข้อความ

3.3 จากนั้นเพิ่มกลุ่มโดเมนและ กลุ่มไอพีแอดเดรส ดังตัวอย่างนี้

zone "kk.koogle.com" IN {
type master;
file "koogle.com.zone";
allow-update { none; };
};

zone "0.168.192.in-addr.arpa" IN {
type master;
file "192.168.0.zone";
allow-update { none; };
};

3.4 บันทึกไฟล์ named.conf ด้วยคำสั่ง ดังนี้

3.4.1 กดปุ่ม Esc

3.4.2 ตามด้วยเครื่องหมาย : และ wq!

3.5 สร้างไฟล์ ossthailand.com.zone และไฟล์ 192.168.0.zone ดังตัวอย่างนี้

3.5.1 เข้าไปยังไดเรคเทอรี่ /var/named/chroot/var/named ดังตัวอย่างนี้

[ root@kk ~ ]# cd /var/named/chroot/var/named/

3.5.2 สร้างไฟล์ koogle.com.zone โดยการก๊อบบี้จากไฟล์ localhost.zone ดังตัวอย่างนี้

[ root@kk named ]# cp localhost.zone koogle.com.zone

3.5.3 สร้างไฟล์ 192.168.0.zone โดยการก๊อบบี้จากไฟล์ localhost.zone ดังตัวอย่างนี้

[ root@kk named ]# cp localhost.zone 192.168.0.zone

3.6 แก้ไขไฟล์ koogle.com.zone ดังตัวอย่างนี้

$TTL 86400
@ IN SOA kk.koogle.com. root.kk.koogle.com (
2007022201 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS kk.koogle.com
koogle.com. IN NS kk.koogle.com
koogle.com. IN MX 5 mail.koogle.com

kk IN A 192.168.0.7
data IN A 192.168.0.1

www IN CNAME kk
ftp IN CNAME kk

3.7 แก้ไขไฟล์ 192.168.0.zone ดังตัวอย่างนี้

$TTL 86400
@ IN SOA kk.koogle.com. root.kk.koogle.com. (
2007022201 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS kk.koogle.com

1 IN PTR data.koogle.com
7 IN PTR kk.koogle.com

3.8 เปิดการใช้งานโปรแกรม BIND ด้วยคำสั่ง ดังตัวอย่างนี้

[ root@kk named ]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]

3.9 ทดสอบ Forward mapping ด้วยโปรแกรม BIND โดยคำสั่ง dig ดังตัวอย่างนี้

[ root@kk ~ ]# dig kk.koogle.com

3.9.1 โดยแสดงรายการดังนี้

; <<>> DiG 9.3.2 <<>> kk.koogle.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55458
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;kk.koogle.com. IN A

;; ANSWER SECTION:
kk.koogle.com. 86400 IN A 192.168.0.7

;; AUTHORITY SECTION:
koogle.com. 86400 IN NS kk.koogle.com.koogle.com.

;; Query time: 4 msec
;; SERVER: 192.168.0.7#53(192.168.0.7)
;; WHEN: Tue Mar 6 00:55:10 2007
;; MSG SIZE rcvd: 85

3.10 ทดสอบการทำงานโปรแกรม BIND ด้วยคำสั่ง nslookup ดังตัวอย่างนี้

[ root@kk ~ ]# nslookup
> kk.koogle.com <------- ใส่ชื่อโดเมนที่ต้องการตรวจสอบ
Server: 192.168.0.7
Address: 192.168.0.7#53
Name: cs.ossthailand.com
Address: 192.168.0.7


Thanks : kom.homelinux.org

How To Configure Dynamic DNS On Fedora

1 Installation of Packages

Fedora Core 4 contains a DNS (Bind) and DHCP (dhcp) packages in its CDs. You can install it from the Fedora Core 4 CDs or download it from the internet using following command.

yum –y install bind bind-chroot bind-utils bind-libs caching-nameserver dhcp

where

bind ----- DNS Server Package
bind-chroot ----- DNS runs in chroot (jail) environment.
bind-libs ----- Libraries needed in using bind, bind-utils
bind-utils ----- Contains utilities like nslookup, host, dig etc.
caching-nameserver ----- give caching capabilities to store records in cache.
dhcp ----- Dynamic Host Configuration Protocol Package.
2 Configuring BIND (DNS)

You need to tell BIND that it is okay to allow other applications to update it. I added the following to my BIND configuration, everything else was left as stock Fedora Core 4. Here is my local zone details, suitably modified. Here I let BIND know which domains it can update; in my case I only have one domain to deal with. I am also loading the shared secret key at this stage. My DHCP server and DNS server are on the same box, so here I am only allowing localhost to perform the update. The file rndckey is a file containing a shared secret, so that BIND knows that it is an approved application sending instructions.

vi /etc/named.conf

controls {
inet 127.0.0.1 allow {localhost; } keys { "rndckey"; };
};
// Add local zone definitions here.
zone "example.com" {
type master;
file "example.com.zone";
allow-update { key "rndckey"; };
notify yes;
};
zone "0.168.192.in-addr.arpa" {
type master;
file "0.168.192.in-addr.arpa.zone";
allow-update { key "rndckey"; };
notify yes;
};

include "/etc/bind/rndc.key";

The secret key is created at the installation time. No need to do anything here but….
Note: If your DHCP and DNS servers are on separate machines you need to copy the file between them. Both machines should use the same file i.e. /etc/rndc.key.

2.1 Zone Files

Set up your zone databases as normal. You do not need to do anything fancy. Because our DHCP server will update zone files as the new IP allocated to our workstation.

vi /var/named/chroot/var/named/example.com.zone

$TTL 86400
@ IN SOA @ root (
50 ; serial
28800 ; refresh (8 hours)
7200 ; retry (2 hours)
604800 ; retire (1 week)
86400 ; ttl (1 day)
)
IN NS server
server IN A 192.168.0.1

vi /var/named/chroot/var/named/0.168.192.in-addr.arpa.zone

$TTL 86400
@ IN SOA @ root (
50 ; serial
28800 ; refresh (8 hours)
7200 ; retry (2 hours)
604800 ; retire (1 week)
86400 ; ttl (1 day)
)
IN NS server
1 IN PTR server.example.com.

Now make shortcuts of these files in the /var/named directory with the same name.

cd /var/named
ln –s /var/named/chroot/var/named/example.com.zone example.com.zone
ln –s /var/named/chroot/var/named/0.168.192.in-addr.arpa.zone 0.168.192.in-addr.arpa.zone
3 Configuring DHCP Server

By default the DHCP server shipped in Fedora Core 4 does not do dynamic DNS update. You simply need to enable it. Below are the options I selected for my system. My dhcp configuration is as follows:

vi /etc/dhcpd.conf

authoritative;
include "/etc/rndc.key";
# Server configuration:


server-identifier server;
ddns-domainname "example.com.";
ddns-rev-domainname "in-addr.arpa.";
ddns-update-style interim;
ddns-updates on;
ignore client-updates;


# This is the communication zone

zone example.com. {
primary 127.0.0.1;
key rndckey;
}

default-lease-time 21600; # 6 hours
max-lease-time 43200; # 12 hours


# Client configuration:

option domain-name "example.com.";
option ip-forwarding off;

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.200;
option routers 192.168.0.1; # default gateway
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option domain-name-servers 192.168.0.1;

zone 0.168.192.in-addr.arpa. {
primary 192.168.0.2;
key rndckey;
}

zone localdomain. {
primary 192.168.0.2;
key rndckey;
}

}

Now execute the following change permission commands to enable named user to write the zone files whenever an name with IP updating is required.

chmod 770 /var/named/chroot/var/named
chmod 770 /var/named

Now start the services of dns and dhcp with the following command:

service named start
service dhcp start

Go to your client computers and enable them to take an IP from a DHCP server. With the following command check if your client computer name is updated in DNS. It will resolve your name with the newly allocated IP.

nslookup yourcomputername.example.com

Good Luck with your newly created Dynamic DNS Server.

Thansk : howtoforge.com

วันพฤหัสบดีที่ 8 ตุลาคม พ.ศ. 2552

Zimbra on https Server

One day I want to use zimbra on https (by default its use on http)
you can do with this instruction

1. log in to zimbra

su – zimbra

2. change to https

zmtlsctl https

3. restart zimbra

zmcontrol stop
zmcontrol start

4. You can access zimbra web mail by https://youurl.com

Firewall configuration for Zimbra server

Example Configuration Files

RedHat Advanced Server

The following iptables configuration file will block all ports on a clustered zimbra server except those used by zimbra, the cluster suite, ssh, and snmp. This assumes that your local network is 10.10.3.0/255.255.255.0.

/etc/sysconfig/iptables



# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# enable ssh and snmp
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 161 -j ACCEPT -s 10.10.3.0/24
# enable zimbra ports
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 110 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 143 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 389 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 465 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 993 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 995 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 7071 -j ACCEPT -s 10.10.3.0/24
# enable cluster communications
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 41966 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 41967 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 41968 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 41969 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 50006 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 50007 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 50008 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 50009 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21064 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 6809 -j ACCEPT -s 10.10.3.0/24
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 14567 -j ACCEPT -s 10.10.3.0/24
# reject everything else
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT


Thanks : wiki.zimbra.com

Zimbra Collaboration Mail Server



#การเตรียมความพร้อม

#add HOST record ของ zimbra server ใน DNS --> mail.example.com
#add MX record ของ zimbra server ใน DNS

#Hardware
#Memory Minimum 1GB
#Harddisk Minimum 5GB
#Linux OS

#Download Zimbra Installation Package กันก่อนครับ
#ที่นี่ http://www.zimbra.com/community/downloads.html
#ก็แล้วแต่ว่า OS เป็นอะไรของผมเป็น CenOS5 x86_64 ครับเลยใช้ของ Redhat ครับ
#เปิด terminal
#root user
wget -c http://h.yimg.com/lo/downloads/5.0.16_GA/zcs-5.0.16_GA_2921.RHEL5_64.20090429051405.tgz
#รอ download ให้เสร็จพักใหญ่ ~ 472MB
tar zxvf zcs-5.0.16_GA_2921.RHEL5_64.20090429051405.tgz
cd zcs-5.0.16_GA_2921.RHEL5_64.20090429051405

#Remove MTA Service ก่อนเลยครับ Redhat/CentOs จะใช้ sendmail
service sendmail stop #stop sendmail service
chkconfig --del sendmail #remove sendmail service

#เริ่มติดตั้ง
# --platform-override เป็นการบังคับให้ติดตั้งกับ CentOS ได้ครับ
./install.sh --platform-override
#... จะมี error เกี่ยวกับ library dependency compat-libstdc++-296 compat-libstdc++-33 libtool-ltdl ประมาณนี้ต้องติดตั้ง package เพิ่มเติม
yum install -y compat-libstdc++-296 compat-libstdc++-33 libtool-ltdl
#ลองอีกครั้ง
./install.sh --platform-override
#ตอบคำถามตามที่ installer แจ้งมา ผมใช้ตาม default เลยครับ
#Install zimbra-ldap [Y]
#Install zimbra-logger [Y]
#Install zimbra-mta [Y]
#Install zimbra-snmp [Y]
#Install zimbra-store [Y]
#Install zimbra-apache [Y]
#Install zimbra-spell [Y]
#Install zimbra-proxy [N]

#You appear to be installing packages on a platform different
#than the platform for which they were built

#This platform is CentOS5
#Packages found: zimbra-core-5.0.16_GA_2921-RHEL5.20090429051405.x86_64.rpm

#This may or may not work

#Install anyway? [N] Y

#The system will be modified. Continue? [N] Y

#จะมี Menu แสดงรายละเอียด config ต่างๆสิ่งที่ต้องแก้ไขคือ
#Time zone
#Admin password
#แล้ว apply รอจนเสร็จ

#archive tools support
yum install unrar arj unarj arc lha cabextract zoo lzop freeze tnef

#เปิด firewall
#root user
vim /etc/sysconfig/iptables
#webmail http port
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
#admin port
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 7071 -j ACCEPT
#webmail https port
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

#restart iptables
service iptables restart

#เรียบร้อยครับสามารถใช้งานได้ ด้วย browser เพื่อ setup ต่อ
#Admin
https://mail.example.com:7071
#ที่เหลือก็แล้วแต่ครับว่ากันเองได้ลย

----------------------------------------------------------------------------------------------------------------------
#การ relay e-mail ไปที่ ISP เพื่อให้ส่ง mail ออกไปภายนอกได้
#zimbra user
su - zimbra
zmprov ms mail.example.com zimbraMtaRelayHost relay.your-isp-smtp.com
echo relay.your-isp-smtp.com ispusername:isppassword > /opt/zimbra/conf/relay_password
postmap hash:/opt/zimbra/conf/relay_password
postconf -e smtp_sasl_password_maps=hash:/opt/zimbra/conf/relay_password
postconf -e smtp_sasl_auth_enable=yes
postconf -e smtp_cname_overrides_servername=no
postconf -e smtp_use_tls=yes
postconf -e smtp_sasl_security_options=noanonymous
postfix reload

#ติดตั้ง fetchmail เพื่อดึง mail จากภายนอก
#root user
chown zimbra:zimbra /opt/zimbra
#zimbra user
su - zimbra
#สร้าง .fetchmailrc ไว้ที่ /opt/zimbra/

vim .fetchmailrc
### DOMAINPOP SETTING ###
set no bouncemail
set postmaster postmaster@example.com
set logfile /opt/zimbra/extlog/fetchmailrc.log
poll pop3.your-isp.com with protocol POP3, with options uidl
localdomains example.com
no dns
envelope "Envelope-to"
user "pop3user" there with password "pop3password" is *
here
with options rewrite fetchall

#สร้าง fetchmail log file
mkdir /opt/zimbra/extlog/
touch /opt/zimbra/fetchmailrc.log

#root user
#add fetchmail cronjob
crontab -e -u zimbra
# add MAILTO at 1 st line in crontab 's zimbra file
MAILTO=admin@example.com
# add this last line ดึงทุกๆ 3 นาที
0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * fetchmail -v -v > /dev/null 2>&1

#logrotate add /etc/logrotate.d/zimbra
/opt/zimbra/extlog/fetchmailrc.log {
daily
missingok
notifempty
create 0660 zimbra zimbra
compress
size 10240k
rotate 7
}

#zimbra user
su - zimbra
#enable http/https
zmtlsctl both # as zimbra

#zimlet deploy
zmzimletctl deploy /opt/zimbra/zimlets-extra/com_zimbra_collector.zip
zmzimletctl deploy /opt/zimbra/zimlets-extra/com_zimbra_contactcleaner.zip
zmzimletctl deploy /opt/zimbra/zimlets-extra/com_zimbra_birthdayreminder.zip
zmzimletctl deploy /opt/zimbra/zimlets-extra/com_zimbra_dnd.zip
zmzimletctl deploy /opt/zimbra/zimlets-extra/com_zimbra_email2doc.zip
zmzimletctl deploy /opt/zimbra/zimlets-extra/com_zimbra_emailreminder.zip
zmzimletctl deploy /opt/zimbra/zimlets-extra/com_zimbra_coloredemails.zip

#add users
zmprov createAccount mailuser@example.com userpassword displayName 'Firstname Surname' givenName Firstname sn Surname company 'your company'

#สร้าง Distrubitionlist
zmprov cdl everyone@example.com
zmprov cdl list2@example.com
#add user to list
zmprov adlm everyone@example.com mailuser@example.com

#email ailas
zmprov aaa mailuser@example.com mailuseralias@example.com

#List alias
zmprov adla list2@example.com listalias@example.com

#stop zimbra
zmcontrol stop
#start zimbra
zmcontrol start
#เหนื่อย เข้าใช้งานได้แล้ว
http://mail.example.com/zimbra/
#หรือ
https://mail.example.com/zimbra/

#แหล่งข้อมูลที่สำคัญให้ศึกษา
http://wiki.zimbra.com/index.php?title=Category:Installation


Thanks : นายเทิ่ง

วันพุธที่ 7 ตุลาคม พ.ศ. 2552

problem thai language with Mysql

ปัญหาภาษาไทยกับ กับ Mysql


วิธีแก้ 1 กำหนด Database ให้ใช้ tis620

แก้ไขไฟล์ config ของ MySQL โดยการกำหนดค่าดังนี้
CODE
[mysqld]
default-character-set=tis-620

บน Linux จะอยู่ที่ etc/my.cnf
บน Windows จะอยู่ที่ windows/my.ini
restart MySQL อีกครั้งหนึ่ง ตรวจสอบให้แน่ใจว่า default character เป็น tis620 แล้ว
ตัวอย่าง การตรวจสอบ ด้วยคำสั่ง s ใน mysql client บน Windows
QUOTE
mysql> s
--------------
mysql Ver 14.12 Distrib 5.0.18, for Win32 (ia32)

Connection id: 2
Current database:
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.0.18
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: tis620
Db characterset: tis620
Client characterset: latin1
Conn. characterset: latin1
TCP port: 3306
Uptime: 30 sec

Threads: 1 Questions: 3 Slow queries: 0 Opens: 0 Flush tables: 1 Open table
s: 3 Queries per second avg: 0.100
--------------


ตัวอย่าง การตรวจสอบ ด้วยคำสั่ง s ใน mysql client บน Linux
QUOTE
mysql Ver 14.7 Distrib 4.1.7, for redhat-linux-gnu (i386)

Connection id: 3
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 4.1.7
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: tis620
Client characterset: tis620
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 5 sec

Threads: 1 Questions: 5 Slow queries: 0 Opens: 11 Flush tables: 1 Open tables: 0 Queries per second avg: 1.000
--------------


นอกจากนี้เราสามารถใช้ MySQL Client tool อื่นๆ สำหรับตรวจสอบได้เช่นกัน

ตัวอย่างค่า default เริ่มแรก
user posted image

เมื่อปรับค่า default เป็น tis620
user posted image



ดังนั้น ตัวแปลดังกล่าว ควรจะมีค่าตังนี้
QUOTE
- character_set_client = tis620
- character_set_connection = tis620
- character_set_database = tis620
- character_set_results = tis620
- character_set_server = tis620
- character_set_system = utf8
- collation_connection = tis620_thai_ci
- collation_database = tis620_thai_ci
- collation_server = tis620_thai_ci


character set กับ collation ??

character set คือรูปแบบของการจัดเก็บข้อมูล เราสามารถดูรูปแบบที่ MySQL สนับสนุนการใช้งานได้จาก คำสั่ง SHOW CHARACTER SET;

collation คือรูปแบบของการจัดเรียงและเปรียบเทียบ รูปแบบการจัดเรียงที่มักใช้กันบ่อยๆ มักลงท้ายด้วย ci ,cs, bin (เรียงตามลำดับ) เราสามารถดูรายชื่อ collation ที่สนับสนุนได้จาก SHOW COLLATION;

ci, cs, bin ?? มีความหมายดังนี้
ci = case-insensitive จัดเรียงตามตัวอักษร มองตัวอักษรใหญ่ และเล็กมีความสำคัญเท่ากัน โดยปกติมักจะใช้ collation แบบ ci
cs = case sensitive จัดเรียงโดยให้ความสำคัญกับอักษรตัวใหญ่ มากกว่าตัวเล็ก เช่น Z จะมาก่อน a
bin = binary ใช้สำหรับการเปรียบเทียบ





2. บอกให้ mysql รู้ถึงรูปแบบของภาษาที่ต้องการใช้ ผ่าน sql command
เราสามารถใช้คำสั่ง SET เพื่อกำหนดค่าตัวแปลของ MySQL ได้
ดังนั้น ก่อนที่จะ insert, update เราต้องบอกให้ MySQL ทราบถึงรูปแบบของภาษาที่ใช้ ยกตัวอย่างเช่น

CODE
mysql_query("SET NAMES 'tis620' ");
mysql_query("SELECT * FROM TEST");



(UPDATE - 2006.02.08)

ยังมีอีกวิธีหนึ่งคือ แนบคำสั่งไปกับประโยค SQL เลย เช่น

CODE
mysql_query("SELECT * FROM TEST ORDER BY idRec COLLATE tis620_thai_ci");


Thanks : Patrickz 2.0

Links
MySQL : Chapter 10. Character Set Support
เมื่ออักษรภาษาไทยกลายเป็น ?????? (phpconcept.com)

วันจันทร์ที่ 28 กันยายน พ.ศ. 2552

Zimbra Mail on Fedora Core 5

บทความนี้ได้ทำการคัดลอกมาจากคุณ อดิศร ขาวสังข์

ตัวอย่างการติดตั้ง Zimbra Mail บน Fedora Core 5


Zimbra Components

สถาปัตยกรรมของ Zimbra เป็นการรวบรวม Open Source Software โดยใช้โปรโตคอลมาตรฐาน ซึ่ง third-party software ดังรายการข้างล่างถูก bundle เข้าไปอยู่ใน Zimbra software และซอฟต์แวร์ทุกตัวจะถูกติดตั้งในระหว่างกระบวนการติดตั้งของ Zimbra Software
ซึ่ง Components เหล่านี้ ได้ถูกทดสอบและถูกคอนฟิกให้ทำงานกับซอฟต์แวร์ชุดนี้แล้ว
  • Apache Tomcat, the web application server that Zimbra software runs in.
  • Postfix, an open source message transfer agent (MTA) that routes mail messages to the
    appropriate Zimbra server.
  • OpenLDAP software, an open source implementation of the Lightweight Directory Access
    Protocol (LDAP) that provides user authentication.
  • MySQL database software.
  • Lucene, an open-source full featured text index and search engine.
  • Anti-virus and anti-spam open source components including:
    • ClamAV, an anti-virus scanner that protects against malicious files.
    • SpamAssassin and DSPAM, mail filters that attempt to identify spam.
    • Amavisd-new, which interfaces between the MTA and one or more content checkers.
  • James/Sieve filtering, used to create filters for email.

หมายเหตุ มี POP และ IMAP มาให้แล้วด้วยครับ

ความต้องการของระบบ
Zimbra Mail มีสองเวอร์ชันให้เลือกคือ Open Source Edition และ Network Edition Trail ซึ่งความต้องการของ Server ที่จะติดตั้งค่อนข้างจะสูงไปนิดดังนี้
(แต่สำหรับการทดลองของผู้เขียนเพื่อการทำบทความครั้งนี้ใช้ PC Server มี RAM แค่ 512 MB)



สำหรับข้อมูลเพิ่มเติมสามารถดูได้จากเว็บไซต์ www.zimbra.com

ข้อดีของ Zimbra mail ในมุมมองของผู้เขียนเอง

  1. ลดขั้นตอนของการติดตั้ง Mail Server เพราะติดตั้งโปรแกรมแค่ชุดเีดียวก็ได้ครบทุกอย่าง
  2. ในการติดตั้งมีการติดตั้ง POP3 และ IMAP ให้ด้วย
  3. มี Webmail อยู่ในตัวไม่ต้องติดตั้งโปรแกรม Webmail อื่น ๆ เพิ่มอีก
  4. ในส่วนของการบริหารจัดการของ Admin มี Web-based Administration console ที่สะดวกซึ่งมีความสามารถต่าง ๆ เ่ช่น
    1. สามารถบริการจัดการ user account เช่น เพิ่ม/ลบ/แก้ไข ผ่าน Web Interface ได้อย่างสะดวก
    2. สามารถจัดการโดเมนและ Server ได้ เช่นสามารถบริหารจัดการให้ Mail Server เครื่องเดียวรองรับการทำงานเป็น Mail Server ของหลายโดเมนได้
    3. สามารถคอนฟิก MTA, POP และ IMAP ได้
    4. สามารถมอนิเตอร์สถานะและ performance statistis ของ Server ได้
  5. มี คำสั่งแบบ command line ที่ีสามารถใช้ควบคุมการทำงานของ Mail Server รวมถึงการจัดการ Account เพิ่มเติมเข้ามา นั่นคือคำสั่ง zmcontrol และ zmprov (provisioning) ซึ่งต้องรันบน user ที่เป็น zimbra

ข้อเสียของ Zimbra mail ในมุมมองของผู้เขียนเอง

  1. ต้องใ้ช้ Server ที่สเปคสูง
  2. การใช้งานช้ากว่า Webmail อื่น ๆ เช่น Squirrelmail

เตรียมพร้อมก่อนติดตั้ง

ในที่นี้ผู้เขียนขอยกตัวอย่างการติดตั้ง Mail Server บนเครื่อง ๆ เดียวให้กับโดเมนสองโดเมนคือ

  • โด เมน itwizard.info ซึ่งเป็นโดเมนที่มีอยู่จริง กล่าวคือมีการจดทะเบียนโดเมนไว้กับ Internic และเซ็ตค่าของ Mail Server (MX) ไ้ว้อย่างถูกต้อง
  • โด เมน adisorn.net ซึ่งเป็นโดเมนที่ไม่มีอยู่จริง เพียงแต่เป็นการเพิ่มชื่อโดเมนนี้ และข้อมูล Mail Server (MX) ไว้บน DNS Server ขององค์กรที่ผู้เขียนทำงานอยู่เพื่อการทดลองเท่านั้น

ซึ่งเมื่อรันคำสั่ง host บน Server ที่จะติดตั้ง zimbra เพื่อตรวจชื่อ host และ Mail Server (MX) จะได้ดังรูปที่ 1


รูปที่ 1

ทั้ง นี้ผู้เขียนได้ตั้งชื่อของ Server ที่จะติดตั้ง zimbra ที่ส่วน DNS ของ Network Configuration เป็น mail.itwizard.info ดังรูปที่ 2 และที่แท็บ Hosts ของรูปที่ 2 ผู้เีขียนไม่ได้ตั้งชื่อเพิ่มเติมใด ๆ ซึ่งถ้าเราเพิ่มชื่อเข้าไปในแท็บ Hosts จะส่งผลให้มีการเพิ่มชื่อ Host ในไฟล์ /etc/hosts แต่ในที่นี้ไม่มีการเพิ่มชื่อแต่อย่างใด ดังนั้นในไฟล์ /etc/hosts ก็มีแต่ชื่อที่เป็น Default คือ localhost เท่านั้น แต่ถ้าใครจะเพิ่มชื่อในแท็บ Hosts หรือไฟล์ /etc/hosts แทนก็ได้เช่นกันครับ


รูปที่ 2

ขั้นตอนการติดตั้ง

  1. ดาวน์ โหลดโปรแกรม zimbra จากเว็บของ zimbra (http://www.zimbra.com/community/downloads.html) ให้ตรงกับ Linux Distribution ของตัวเอง ซึ่งของผู้เขียนเลือก Fedora Core 5 (.tgz) (ณ เวลาที่ทำบทความนี้ zimbra ยังไม่ Support Fedora ที่เวอร์ชั้นสูงกว่านี้)
  2. แตกไฟล์ที่ดาวน์โหลดมาด้วยคำสั่ง tar ดังนี้ :
    #tar xvfz zcs-4.5.4_GA_763.FC5.tgz

  3. เข้าไปยังไดเร็กทอรี่ zcs แล้วติดตั้ง zimbra ด้วยคำสั่ง install.sh ดังรูปที่ 3


    รูปที่ 3

  4. ให้ทำการกดปุ่มใด ๆ ตามคำแนะนำแล้วจะได้ดังรูปที่ 4


    รูปที่ 4

    จากรูปที่ 4 ในขั้นตอนการตรวจสอบโปรแกรมที่จำเป็ี่นต้องติดตั้งไว้ก่อน (Checking for prerequisites..) ปรากฎว่าทุกโปรแกรมมีอยู่ครบแล้ว แต่ในกรณีที่โปรแกรมที่จะต้องใช้งานไม่ได้ติดตั้งไว้ก่อน การติดตั้งก็จะถูำกยกเลิกไปก่อน และมีการรายงานว่าโปรแกรมตัวไหนที่ขาดบ้าง ซึ่งถ้าเจอกรณีแบบนี้ก็ให้แก้ปัญหาด้วยการติดตั้งโปรแกรมที่จำเป็นดังกล่าว ก่อน เช่นถ้าไม่มีโปรแกรมที่ชื่อ gmp ก็สามารถติดตั้งด้วยการใช้คำสั่ง yum เป็น :
    #yum install gmp

    หรือจะติดตั้งด้วยวิธีอื่นก็ขึ้นอยู่กับความถนัดของแต่ละคนนะครับ สำหรับผู้เขียนแล้ว เจอว่าต้องติดตั้งโปรแกรมเพิ่มเติม 2 ตัวครับแต่ไม่ได้ capture ภาพไว้ให้ดู

  5. จาก นั้นให้เลือก Program Package ที่จะติดตั้ง ซึ่งค่า Default เป็น 'Y' ซึ่งถ้าต้องการติดตั้งก็ทำได้ด้วยการกดปุ่ม Enter หรือพิมพ์คำว่า 'Y' แ่ต่ถ้าไม่ต้องการติดตั้งโปรแกรมตัวไหนก็ให้เลือกเป็น 'N' โดยส่วนของผู้เขียนเลือกติดตั้งทั้งหมดดังรูปที่ 5


    รูปที่ 5

  6. จาก นั้นให้ตอบว่า Y เืมื่อมีคำถามว่า The system will be modified. ดังรูปที่ 6 และ zimbra จะมองชื่อ host ที่เราได้ตั้งชื่อไว้ (mail.itwizard.info) เป็นชื่อโดเมนและพยายาม Resolve หา MX ของโดเมน mail.itwizard.info ซึ่งไม่มีอยู่ในข้อมูลของ DNS Server จึงทำให้เกิด error และแนะนำให้เราเปลี่ยนชื่อโดเมน ก็ให้ตอบ 'Y' และเปลี่ยนชื่อโดเมนให้ตรงก้บที่ได้ออกแบบไว้ในตอนต้น ดังรูปที่ 6


    รูปที่ 6

  7. จากนั้นจะเข้าสู่ Store configuration ดังรูปที่ 7 ให้ทำการเลือกข้อ 4 เพื่อกำหนดรหัสผ่านของ Admin


    รูปที่ 7

  8. จากนั้นให้เลือก r เพื่อกลับสู่เมนู่ก่อนหน้านี้ แล้วจะมีคำเตือนให้กดปุ่ม a เพื่อ apply ก็ให้ทำตามดังรูปที่ 8 ครับ


    รูปที่ 8

  9. เื่มื่อ มีคำถามว่า Notify Zimbra of your installation ? ก็อาจจะตอบ Yes หรือ No ก็ได้ครับ ตรงนี้เป็นการเลือกว่าจะส่งข้อมูลการติดตั้งกลับไปยัง Zimbra หรือไม่ ไหน ๆ ก็ใช้ของเขาฟรีแล้วส่งข้อมูลกลับไปบอกเขาหน่อยก็น่าจะดี


    รูปที่ 9

  10. จากนั้นก็จะแจ้งว่าการคอนฟิกสมบูรณ์ดังรูปที่ 10


    รูปที่ 10

ตรวจสอบการใช้งาน

  1. เรียก ใช้งานในสถานะ Admin ได้เป็น https://hostmame:7071/zimbraAdmin ในที่นี้คือ https://mail.itwizard.info:7071/zimbraAdmin จะได้ผลดังรูปที่ 11แ้ล้วให้ป้อน user เป็น admin และรหัสผ่านตามที่ได้กำหนดในขั้นตอนที่ผ่านมา


    รูปที่ 11

  2. เมื่อ ป้อน Username และ Password ถูกต้องก็จะได้ผลดังรูปที่ 12 ซึ่งจะเห็นว่า Service ทุกตัวไม่เจอปัญหาใด ๆ (โชคดีไป ถ้าโชคไม่ดีบางตัวอย่าง Start ไม่ได้นะครับ) โดย User ที่เป็น admin สามารถใช้งานทั้งในสถานะ admin และสถานะ user ทั่วไป


    รูปที่ 12

  3. ให้ ทำการเพิ่ม Account ใหม่เข้าไปซึ่งในที่นี้เพิ่มชื่อเป็น adisorn.k แล้วทดลองเข้าใช้งานในสถานะผู้ใช้งานทั่วไป โดยการเข้าใช้งานในสถานะผู้ใช้ทั่วไปก็ให้พิมพ์ชื่อ Host ผ่าน Browser ได้ดังรูปที่ 13


    รูปที่ 13

  4. เมื่อ เข้าระบบได้แล้วลองทดสอบส่งเมล์ไปยัง Mail ของ CAT TELECOM ดังรูปที่ 14 และที่ CAT TELECOM สามารถรับเมล์ได้ดังรูปที่ 15 และเมื่อ เมล์ของ CAT TELECOM ตอบกลับมา ที่ Zimbra mail ก็สามารถรับได้ดังรูปที่ 16


    รูปที่ 14 ส่งเมล์จาก Zimbra ไปยัง CAT TELECOM


    รูปที่ 15 เมล์ของ CAT TELECOM สามารถรับเมล์จาก Zimbra mail ได้


    รูปที่ 16 Zimbra mail สามารถรับเมล์จาก CAT TELECOM ที่ตอบกลับมาได้

การเพิ่มโดเมนใหม่และทดสอบการใช้งาน

  1. Login เ้ข้าสู่ระบบในสถานะของ Admin จากนั้นให้ทำการเพิ่มโดเมนใหม่เข้าไปซึ่งในที่นี้ชื่อว่า adisorn.net ดังรูปที่ 17


    รูปที่ 17

  2. ให้ ทำการป้อนชื่อ Virtual Host เพื่อให้สามารถเรียกใช้งาน Web Server ได้ีอีกชื่อซึ่งในที่นี้คือ mail.adisorn.net นั่นหมายถึงว่าถ้าผู้ใช้งานที่เป็นสมาชิกของโดเมน itwizard.info การเรียกใช้งานก็ให้เรียกเป็น http://mail.itwizard.info ส่วนผู้ใช้ที่เป็นสมาชิกของโดเมน adisorn.net ก็ให้เรียกใช้งานเป็น http://mail.adisorn.net ซึ่งจะเป็นการเีรียกใช้งานไปยัง Web Server ตัวเดียวกัน


    รูปที่่ 18

  3. และในที่นี้ผู้เขียนเลือกเพื่อสร้าง domain level document space ดังรูปที่ 19


    รูปที่ 19

  4. ทำการเพิ่ม Account ที่เป็น Admin ให้กับโดเมน adisorn.net โดยกำหนดให้มีสถานะเป็น Administrator ดังรูปที่ 20


    รูปที่ 20

  5. จากนั้นจะได้ Account ที่ชื่อ admin@adisorn.net ดังรูปที่ 21


    รูปที่ 21

  6. เปิดหน้าต่างสำหรับ admin ของโดเมน adisorn.net แล้วทำการป้อนชื่อ user ที่เป็น admin ดังรูป 22


    รูปที่ 22

  7. เมื่อ เข้าสู่ระบบในสถานะ admin ของโดเมน adisorn.net ได้แล้วให้ทำการเพิ่ม Account ทั่วไปชื่อว่า adisorn.k@adisorn.net อีกหนึ่ง account เพื่อใช้สำหรับการทดสอบ ซึ่งเมื่อเพิ่มแล้วจะได้ผลดังรูปที่ 23


    รูปที่ 23

  8. จาก นั้นให้ Login เข้าสู่ระบบของโดเมน adisorn.net ในนามของ account ทั่วไปแล้วทดสอบส่งเมล์ไปยังโดเมน cattelecom และ itwizard ดังรูปที่ 24


    รูปที่ 24

  9. เมื่อ เข้าสู่ระบบของโดเมน itwizard.info และ cattelecom.com จะเห็นว่าสามารถรับเมล์จากโดเมน adisorn.net ได้ดังรูปที่ 25 และ 26 ตามลำดับ และเมื่อมีการตอบกลับจากโดเมน itwizard.info ก็สามารถรับได้ดังรูปที่ 27


    รูปที่ 25


    รูปที่ 26


    รูปที่ 27

ทดลองใ้ช้งาน POP3 บน Zimbra Mail ผ่าน MS Outlook
จริง ๆ แล้ว IMAP ก็สามารถใช้งานได้นะครับเพียงแต่ผู้เขียนไม่ได้ Capture ภาพมาให้ดูกัน

  1. เซ็ตค่าของ MS Outlook ชี้ไปยัง Zimbra Mail ซึ่งในที่นี้ทดลองกับโดเมน itwizard.info ให้ตรงกับความเป็นจริงดังรูปที่ 28


    รูปที่ 28

  2. ทำการส่งเมล์บน MS Outlook ไปยังโดเมน cattelecom.com ดังรูปที่ 29


    รูปที่ 29 ส่งเมล์บน Outlook ไปยังโดเมน cattelecom.com

  3. ที่ webmail ของ cattelecom สามารถรับเมล์จาก Zimbraได้ดังรูปที่ 30 โดยที่ไม่ต้องเซ็ตค่าของ POP บน zimbra mail เพิ่มเติมใด ๆ (มันง่ายอะไรอย่างนี้)


    รูปที่ 30 ที่ webmail ของ cattelecom.com สามารถรับเมล์จาก Outlook ผ่าน Zimbra mail ได้

คำสั่งแบบ command line ของ Zimbra

เมื่อ ติดตั้ง Zimbra mail แล้ว บนเครื่องที่ติดตั้งสามารถใช้คำสั่งแบบ command line เพื่อควบคุมและบริหารจัดการกับ Zimbra mail ได้
  1. บน Server ที่เป็น Zimbra mail ให้เปลี่ยนสถานะของตัวเองเป็น user --> zimbra โดยใช้คำสั่ง su - zimbra ดังรูปที่ 31 และให้พิมพ์คำสั่ง zmcontrol ดู จะเห็นว่าเราสามารถใช้คำสั่ง zmcontrol เพื่อควบคุมการทำงานของ zimbra mail ได้ เช่นใช้คำสั่ง zmcontrol status เพื่อดูสาถานะการทำงานของ Zimbra


    รูปที่ 31 ตัวอย่างการใช้งานคำสั่ง zmcontrol

  2. นอกจากนั้นยังมี zmprov (provisioning) สำหรับใช้งานเพื่อ provisioning zimbra mail ได้อีกดังรูปที่ 32


    รูปที่ 32

  3. เช่น เราสามารถใช้คำสั่ง zmprov ca (create account) และ zmprov ma (modify account) เพื่อเพิ่มและแก้ไข Account ของ zimbra mail ได้ดังรูปที่ 33


    รูปที่ 33

วันพุธที่ 16 กันยายน พ.ศ. 2552

Why is SELinux ?

สุดยอดระบบรักษาความปลอดภัย Red Hat Enterprise Linux 2007-06-06
พุทธพร คณีกุล, System Engineer, RHCT, RHCE

ช่าง เทคนิคทั้งหลายคงไม่มีใครไม่รู้จัก เจ้าหมวกแดง Redhat เป็นแน่ มาดูสุดยอดความปลอดภัยที่มีอยู่ในระบบปฏิบัติการเครือข่ายตัวนี้กันครับ ...(วิทยากรรับเชิญจาก www.lcc.in.th)

ถ้า พูดถึงระบบรักษาความปลอดภัยของ OS Linux ละก็ หลายๆ คนก็คงทราบกันดีอยู่แล้วว่า Linux เป็น OS ตัวหนึ่งที่มีโปรแกรมพื้นฐานทางด้าน Security ที่ดีมาก นั่นคือมี Firewall ที่ติดมากับตัว OS เลย โดยที่เราไม่จำเป็นต้องลงโปรแกรมเพิ่มเติมแต่อย่างใด โปรแกรมที่ทำหน้าที่เป็น Firewall ใน Linux นี้คือโปรแกรม iptables ซึ่งสามารถอ่านรายละเอียดเพิ่มเติมได้ที่ www.netfilter.org

ซึ่ง โปรแกรม iptables นี้มีความสามารถเป็นได้ทั้ง stateful packet filtering และ stateless packet filtering นอกจากนี้ยังสามารถทำงานเป็นตัวแปลง Network address หรือ Port address ได้ด้วย (NAT / NAPT) สิ่งที่ iptables สามารถทำได้ก็คือการกลั่นกรองแพ็คเกจที่วิ่งอยู่ในเครือข่าย โดยตรวจสอบจาก Header ของแพ็คเกจนั้นๆ ว่า มี Address ต้นทางและปลายทางไปที่ไหน แพ็คเกจนั้นวิ่งไปหา Application อะไร ที่ port อะไร ซึ่งเราสามารถเขียน Rule ในการกำหนดพฤติกรรมของของแพคเกจพวกนี้ได้ ว่าจะอนุญาตให้มีการวิ่งผ่านที่ Firewall มั้ย หรือว่าจะมีการเปลี่ยนแปลง address ต้นทางของแพคเกจก่อนจึงค่อยส่งออกไปยังข้างนอก เป็นต้น

นอก เหนือจาก iptables ที่ทำหน้าที่เป็น Firewall ซึ่งมีอยู่ใน Linux ทุกๆ Distribution แล้ว ใน RHEL5 ยังมีระบบรักษาความปลอดภัยอีกอย่างนึงที่ชื่อว่า SELinux ที่มีมาใน Linux Kernel 2.6 เป็นต้นมาคอยทำหน้าที่ป้องกันอีกชั้นหนึ่งด้วย

SELinux ย่อมาจาก Security-Enhanced Linux แปลตรงๆ ก็หมายความว่าเป็น Linux ที่เพิ่มเติมความสามารถในเรื่องระบบรักษาความปลอดภัยให้มากขึ้นกว่าเดิม ซึ่ง SELinux นี้เป็นผลงานการวิจัยของ National Security Agency ของประเทศสหรัฐอเมริกา ที่พัฒนาระบบรักษาความปลอดภัยขึ้นมาใช้เป็นการภายใน เพื่อความคุมในการรักษาความลับของเอเจนซี่

SELinux แตกต่างจากระบบรักษาความปลอดภัยแบบเดิม เช่น Firewall, Password หรือระบบอื่นๆ อย่างระบบรักษาความปลอดภัยแบบอื่น เช่น File permission หรือว่า User Account Password นั้น จะเรียกว่าเป็นระบบ Discretionary Access Control (DAC) ซึ่งระบบแบบนี้ทุกๆ Object (ไฟล์ หรือ ไดเรคทอรี่) ต่างก็ต้องมีเจ้าของ (Owner) สิทธิในการเข้าถึง Object นั้นๆ ขึ้นอยู่กับว่าเป็น User ระดับไหน และผู้ใช้ (User)ไม่ว่าจะเป็น User ธรรมดาหรือว่า Root จะอนุญาตให้คนอื่นๆ เข้าถึงไฟล์ของตนได้โดยคำสั่ง chmod

สิ่ง ที่ SELinux แตกต่างก็คือ SELinux เป็นระบบที่เรียกว่า Mandatory Access Control (MAC) ซึ่งหมายความว่าการ Access เข้าใช้งาน Object ใดๆ ก็ตามในระบบ จะขึ้นอยู่กับ Policy ของระบบเป็นหลัก โดยไม่สนใจว่า Ownership ของ Object นั้นๆ จะเป็นของใครก็ตาม Kernel จะเป็นตัวควบคุม Policy โดยรวม

ผู้ใช้งานในระบบ User ธรรมดา หรือว่าแม้แต่ Root ก็ตาม ไม่สามารถอนุญาตให้ User คนอื่นๆ เข้าใช้งาน Object นั้นๆ ได้ ถ้ามันขัดกับ Policy โดยรวมของระบบ

การใช้ระบบรักษาความปลอดภัยแบบ MAC นี้ จะต้องทำความเข้าใจใน Concept ของเรื่องนี้กันใหม่ เพราะเมื่อ User พบกับ Error เรื่องของ Permission violation ที่ถูกควบคุมโดย SELinux แล้วละก็ User ก็มักจะแก้ปัญหาโดยการเช็คที่ Ownership ของไฟล์ และเช็คเรื่อง Permission ในการ Read, Write ,Execute ของไฟล์หรือไดเร็คทอรี่นั้นๆ แต่ว่าถึง User จะเปลี่ยน Ownership และ Permission ของ Object นั้นให้ถูกต้องแล้ว แต่ก็ยังพบว่าไม่สามารถ Access ไฟล์นั้นได้ ทั้งนี้ก็เพราะว่า Ownership และ Permission ของไฟล์ และไดเรคทอรี่นั้นไม่ใช่สิ่งที่ SELinux นำมาพิจารณา หากแต่เป็นเรื่องของ Policy ต่างหาก

ตัวอย่างที่สามารถอธิบายเรื่องนี้ได้ดีที่สุดก็คือ สมมุติว่าคุณมี Server อยู่ 1 ตัวที่รันเว็บไซต์ขายของด้วย HTTP server และในนั้นก็มีการเชื่อมต่อกับฐานข้อมูล MySQL ที่เก็บข้อมูลของสินค้าในร้านคุณ (รวมถึงข้อมูลบัตรเครดิตด้วย) ถ้าเกิดว่า Apache ที่รันเป็น Web server นั้นเกิดมีช่องโหว่ด้านระบบรักษาความปลอดภัยจนทำให้เกิดมี Hacker เจาะเข้ามาได้ ถามว่าอันตรายจะเกิดขึ้นแต่ส่วนของ Web server ใช่มั้ย? ตอบได้เลยว่าไม่ใช่ครับ

สมมุติว่า Hacker สามารถแฮคก์จนได้ Root shell ขึ้นมา ในระบบที่ไม่มี SELinux นั้น Root สามารถเข้าถึงข้อมูลบัตรเครดิตที่อยู่ใน Database ได้ เมื่อ hacker ได้เจาะเข้ามาได้ทาง Web server ละก็ ระบบทั้งหมดก็ตกอยู่ในอันตรายแล้ว แต่ถ้าเป็นระบบเดียวกันที่มีการป้องกันด้วย SELinux นั้น แม้ว่า Hacker สามารถเจาะเข้ามาทาง Web server ได้แล้ว แต่ว่าจะไม่สามารถเจาะเข้าไปที่ส่วนของ Database หรือส่วนอื่นๆ ของระบบได้ ถึงแม้ว่า Hacker นั้นจะได้ Root shell ก็ตาม

SELinux จะอนุญาตให้โพรเซสของ HTTP ติดต่อกับ Database ผ่านทาง Named pipe เท่านั้น หรืออีกความหมายหนึ่งคือ ถ้ามี SELinux แล้ว คุณไม่เชื่อใจใน Application (เพราะว่ามันอาจจะมีบั๊กหรือมีรูรั่วของระบบรักษาความปลอดภัยหรืออาจจะถูก Compromise ได้) แต่คุณไว้วางใจใน SELinux policy แทน

ระบบรักษาความ ปลอดภัยของ SELinux เปรียบเทียบได้กับระบบระบายน้ำของเรือหรือว่าเรือดำน้ำ ซึ่งท้องเรือจะมีการกั้นห้องหลายๆ ห้อง เพื่อคอยกั้นน้ำที่รั่วเข้ามาในเรือ เมื่อมีน้ำรั่วเข้ามาในห้องไหน น้ำก็จะท่วมแค่ห้องนั้นห้องเดียว จะไม่ส่งผลกระทบไปถึงห้องอื่นๆ
SELinux = Red Hat Enterprise Linux
SELinux ไม่ใช่เป็นกลุ่มของแพคเกจที่ติดตั้งเพิ่มเติมในภายหลัง แต่ว่าเป็นสิ่งที่รวมมาอยู่ในตัวของ Kernel เลย ดังนั้นเมื่อคุณใช้งาน RHEL5 นั่นก็คือคุณใช้งาน SELinux แล้ว

ก่อนอื่นขออธิบายคำศัพท์ 2 คำที่จะพูดถึงต่อไปนั่นคือ System Space และ User Space System Space ก็คือโปรแกรมใดๆ ก็ตามที่ถูกรันขึ้นมาในระหว่างขั้นตอนการบู๊ตระบบ เช่น crond, named หรือว่า Service อื่นๆ เช่น httpd, mysqld เป็นต้น ส่วนคำว่า User Space ก็คือโปรแกรมใดๆ ก็ตามที่ถูกรันโดย Logged-in user

สิ่ง ที่ RHEL5 เพิ่มมาใน SELinux ในเวอร์ชันนี้ก็คือ เพิ่มการควบคุมดูแลโพรเซสมากกว่า 200 โพรเซส (ซึ่งใน RHEL4 นั้นจะมีแค่ 15 Service เท่านั้นที่ถูกดูแลโดย SELinux) ดังนั้นจึงบอกได้ว่า ใน RHEL5 นี้มีระบบรักษาความปลอดภัยที่มากขึ้นกว่าเดิมเป็นอย่างมาก นอกจากนี้ SELinux ใน RHEL5 ยังมีความถูกต้องแม่นยำมากขึ้นในการควบคุมดูแลการทำงานของ Service ต่างๆ เป็นเรื่องที่ยากมากที่ System space ใน RHEL5 จะถูก Compromised หรือเกิด Error ที่เป็นสาเหตุมาจาก SELinux policy ไม่สามารถจัดการกับ Service ต่างๆ เหล่านั้นได้

ส่วน User Space application ก็จะถูกล็อคในรีลีสตัวต่อไปของ RHEL ซึ่ง Logged-in user ยังคงสามารถรันโปรแกรมที่ไม่ถูกจำกัดขอบเขตโดย SELinux policy ได้

มี ข้อควรจำอยู่ 2 ข้อเกี่ยวกับ User space ใน RHEL5 อย่างแรกก็คือ คำว่า Logged-in user หมายถึง User ที่เข้ามาใช้งานในระบบโดยผ่าน 3 โปรแกรมคือ login, sshd หรือ xdm เท่านั้น ซึ่งจะแตกต่างจากการที่ระบบโดน Hack เข้ามา (เช่น การแฮ็คก์เข้ามาทาง http) แล้วมาเปิด Shell ขึ้น

การแฮ็คก์ เข้ามาแบบนี้จะถูกสกัดโดย SELinux ซึ่งจะจัดการเหมือนเป็นโพสเซสหนึ่งของ Httpd อย่างที่ 2 คือ แม้ใน User space ที่ไม่ถูก SELinux จำกัด แต่ว่า SELinux จะป้องกันปัญหาเรื่องการโจมตีแบบ Buffer overflow โดยทำการตรวจสอบ Executable memory เมื่อมีการ Overflow เกิดขึ้นจะมีการเขียน Memory มากกว่าที่กำหนดไว้ใน Buffer และจะทำให้เกิด Executable code ไปเขียนข้อมูลทับได้

แต่ SELinux จะทำการตรวจสอบ Memory อยู่ตลอดเวลาว่าข้อมูลที่ถูกเขียนไปนั้น จะไม่มีวันเปลี่ยนสภาพให้กลายเป็น Executable code

นอก จากนี้ใน RHEL5 ยังมีเครื่องมือสำหรับปรับแต่งให้เราสามารถกำหนด Policy ของ SELinux ที่ใช้งานง่ายให้ด้วย นั่นคือรันคำสั่ง System-config-selinux ที่เป็นโหมดกราฟฟิก ก็จะมีหน้าต่างขึ้นมาซึ่งเราสามารถปรับแต่ง Policy ของแต่ละ Service ได้อย่างง่ายดาย

Conclusion
ทุกวันนี้ภัยที่คอย คุกคาม Computer และ Server ของคุณมีอยู่มากมาย ซึ่งบางอย่างอาจจะทำให้ข้อมูลที่มีค่าของคุณต้องเสียหายได้ในพริบตา ดังนั้นการมีระบบรักษาความปลอดภัยแบบเดิมๆ อาจจะไม่เพียงพอ ดังนั้น SELinux ใน RHEL5 จึงเป็นสิ่งที่คุณควรคจะติดตั้งและใช้งานมันทุกครั้งที่รันเครื่องในระบบ Production จริง เพราะตอนนี้ SELinux มีการใช้งานที่ง่ายมากขึ้น และยังมีความปลอดภัยมากขึ้นกว่าแต่ก่อนอีกด้วย

อย่าลืมเติม IQ ให้ตัวเองอยู่เสมอกับ ByNature นะครับ

Thanks : narong

วันพุธที่ 2 กันยายน พ.ศ. 2552

Pfsense + Squid + squidGuard + lightsquid

ติดตั้ง Pfsense + Squid + squidGuard + lightsquid

บันทึกฉบับนี้เขียนถึงการติดตั้งและคอนฟิกซ์ Squid ทำงานร่วมกับ squidGuard (เป็นตัวกรองเว็บ) และ lightsquid (เป็นตัวเก็บสถิติ)

หลัง จากติดตั้งและคอนฟิกซ์ pfSense เรียบร้อยแล้ว ทำการเพิ่ม add-on ที่จำเป็น ในที่นี้คือ proxy server ที่มีความสามารถสูง คือ Squid และโปรแกรมเสริมสำหรับ Squid ในการกรองเนื้อหาที่ไม่พึงประสงค์ (content filter) คือ squidGuard ที่ช่วยให้การบล็อกเว็บทำได้ง่ายขึ้นเยอะเลย

การ เพิ่ม package ของ Squid และ squidGuard ให้เข้าไปที่เมนู System -> Packages แล้วติดตั้งทั้ง 2 โปรแกรม แล้วทำการคอนฟิกซ์ สำหรับกรณีของผมทำดังนี้
1.Squid ไปที่เมนู Service -> Proxy Server

Proxy server: General settings

Proxy Interface : LAN
Allow user on interface : check
Transparent proxy : check
Do NOT proxy Private Address Space (RFC 1918) : check
Enabled logging : check (โปรแกรมจะเลือกที่เก็บ log ให้ คือ /var/squid/log)
Proxy port : 3128 (หรือ 8080 ก็ได้)

(นอกนั้นว่างไว้...)
กด Save

Proxy server: Cache management
Hard disk cache size : 10000 MB. (ตอนแรกโปรแกรมกำหนดให้ 100 MB. ทั้งนี้ผมเพียงทดสอบเท่านั้น)
Hard disk cache location : โปรแกรมตั้งให้เป็น /var/squid/cache
Memory cache size : 180 (RAM 512 / 3 = 170.66 ผมเลือก 180 อิๆ...)

(นอกนั้นว่างไว้...)
กด Save

2.squidGuard ไปที่เมนู Service -> Proxy Content Filter

Proxy Content filter SquidGuard: General settings
Enable : check กด Aply
Blacklist : check (เป็นการเรียกใช้ไฟล์ blacklist ที่บรรจุเว็บที่ต้องการบล็อกไว้ ซึ่งจะเก็บไว้ที่ /var/db/squidGuard/)


(นอกนั้นว่างไว้...)
กด Save



Proxy Content filter SquidGuard: Default

Default destination : เลือก deni เป็นบางอัน...หรือจะทั้งหมดก็ได้ แต่อันสุดท้ายต้องเป็น Allow


Not to allow IP addresses in URL : check
Enable log : check (ไม่ check ก็ได้ เป็นการบันทึก log)

แค่นี้เองเหรอ...ทำไมมันง่ายจังหว่า..???

หมายเหตุ // work around
เรา สามารถเก็บสถิติการใช้งานโดยเพิ่ม lightsquid เข้าไป โดยเมื่อได้ลองใช้ดูแล้วพบว่ามีบันทึกที่ค่อนข้างใช้ได้ และมีข้อสังเกตุดังนี้
  • หากเราไปตั้งค่าให้ rotate squid log มันจะเพิ่มคำสั่งใน crontab อัตโนมัติ...
    สำหรับผมได้ตั้งค่าให้ rotate ทุกวันศุกร์ ปรากฎว่าใน crontab จะมีบรรทัดเพิ่้มเข้ามาดังนี้...

    0 0 * * */1 root /usr/local/sbin/squid -k rotate > /dev/null

    รูปแบบ
    #minute hour mday month wday who command

    ผลคือ lightsquid ไม่ยอมทำงานในวันถัดไป ต้องกด refresh ในหน้า lightsquid แฮะ....

  • ลองแก้ crontab ให้แบ็คอัพ access.log (ใช้คำสั่ง cp /var/squid/log/access.log /home/shared/$DATE-access.log
    แต่ในการบู๊ตเครื่องครั้งต่อไป pfsense จะลบบรรทัดที่เราเพิ่มใน crontab ทิ้งไป ตอนนี้ยังหาวิธีการอยู่
  • ลอง เอาคำสั่ง rotate จาก lightsquid ออก และกำลังรอดูผล...ปรากฎว่า ต้องกด refresh เหมือนเดิม...(ถ้าไม่ถึงชั่วโมง lightsquid จะไม่บันทึกผล โดยกรนีนี้ตั้งค่าให้เก็บ log ทุก 1 ชั่วโมง ผลคือ หากมีคำสั่ง rotate พอเปิดเครื่อง จะไม่เก็บ access.log แต่พอเอาคำสั่ง rotate ออก มันเริ่มเก็บทันที ...ยังแปลกใจอยู่...)
  • ลองเอาคำสั่ง cache_swap_low 90, cache_swap_high 95 ออก (cache_swap_low 90 เริ่มเก็บ cache เมื่อพื้นที่ 90 % ของ disk cache ที่ตั้งไว้, และเก็บจนถึง 95 % ของ disk cache) เดาว่าคำสั่งนี้อาจทำให้ squid ไม่ยอมเก็บ cache เพราะเราตั้ง cache ไว้ที่ 1000 MB. แต่ตอนนี้ใช้พื้นที่ไปเพียง 500 MB. คือ 50 % จึงยังไม่ถึง cache_swap_low ที่ตั้งไว้ 90 %
  • รอดูผล...access.log เริ่มเก็บแล้ว....
สรุป
  • การเก็บ log ด้วย lightsquid ต้อง เอา cache_swap, rotate ออก ...???

Thanks : Hoke

วันอังคารที่ 1 กันยายน พ.ศ. 2552

Serial Attach SCSI (SAS)

ทุกวันนี้บริษัทต่างๆ ต้องเผชิญกับปัญหาข้อมูลที่ต้องจัดเก็บนั้นมีขนาดใหญ่ขึ้นอย่างทวีคูณกว่าในอดีตที่ผ่านมา และแอพพลิเคชันใหม่ๆ นั้นก็มีความต้องการใช้ทรูพุตที่สูงมากขึ้น ในขณะเดียวกันก็ต้องการความเสถียรในการใช้งานสูงด้วย รวมถึงกฎหมายใหม่ๆ ที่มีการกำหนดให้มีระยะเวลาในการจัดเก็บข้อมูลมากขึ้น เช่น กฎหมายเกี่ยวกับอาชญากรรมคอมพิวเตอร์ที่เพิ่งประกาศเมื่อวันที่ 17 มิถุนายน 2550 ที่ผ่านมาและมีผลบังคับใช้ในวันที่ 18 กรกฎาคม 2550 นั้นมีการกำหนดให้บริษัทต้อง จัดเก็บข้อมูลจราจรเป็นเวลา 90 วัน และทางการสามารถร้องขอให้จัดเก็บเพิ่มเป็น 1 ปีก็ได้ เป็นต้น ทำให้การเก็บข้อมูลมีปริมาณมากขึ้นตลอดเวลา
ในขณะที่งบประมาณทางด้านไอทีนั้น ถูกควบคุม และ จำกัดมากขึ้น ทำให้อินเทอร์เฟซ SCSI แบบเดิม ๆ ไม่สามารถตอบโจทย์ในการจัดเก็บข้อมูลที่เพิ่มความต้องการมากขึ้นอย่างรวดเร็วได้ ทำให้หลายๆ บริษัทหันไปพิจารณาโซลูชันของการใช้อินเทอร์เฟซแบบ Fiber Channel (FC) แต่ก็ต้องแลกประสิทธิภาพกับเงินที่ต้องจ่ายเพิ่มมากขึ้น หรือการใช้อินเทอร์เฟซแบบ Serial ATA (SATA) แทนก็ต้องแลกราคาที่ลดลงกับประสิทธิภาพที่ลดลงด้วยเช่นกัน ดังนั้น Serial Attached SCSI (SAS) จึงเป็นคำตอบที่จะมาแทนที่เทคโนโลยีเดิมๆ เพราะสามารถช่วยทั้งเรื่องประสิทธิภาพและงบประมาณ

เปรียบเทียบอินเทอร์เฟซแบต่างๆ
เพื่อให้ผู้อ่านเห็นภาพมากขึ้น จึงได้แบ่งเรื่องที่ใช้เป็นเกณฑ์ในการเปรียบเทียบอินเทอร์เฟซแบบต่างๆ เป็น 4 ส่วนคือ ประสิทธิภาพในการใช้งานสูง, มีความเสถียรสูง, สามารถขยายได้ง่าย และ งบประมาณต่ำ โดยอินเทอร์เฟซแต่ละแบบมีคุณสมบัติดังนี้

1. SCSI ถือเป็นอินเทอร์เฟซที่เด่นในเรื่องประสิทธิภาพในการใช้งานและมีความเสถียร มากที่สุดในปัจจุบัน แต่ราคานั้นค่อนข้างสูงและขยายได้ไม่สะดวก
2. SATA ถือเป็นอินเทอร์เฟซที่ราคาถูกที่สุดในปัจจุบัน นิยมใช้กับการแบ็กอัพแบบ Disk-to-Disk แต่ไม่เหมาะกับงานที่ต้องการเรื่องประสิทธิภาพและเสถียรภาพในการใช้งาน
3. Fiber Channel ถือเป็นอินเทอร์เฟซที่มีประสิทธิภาพในการใช้งานสูง, มีความเสถียรสูง, สามารถขยายได้ง่าย มักนิยมใช้กับ NAS แต่ก็มีข้อเสียที่ราคาสูงมาก
4. SAS ถือเป็นคำตอบที่สามารถตอบโจทย์ทั้ง 4 ข้อได้ รวมถึงสามารถใช้ร่วมกับฮาร์ดดิสก์ที่เป็น SATA ได้ด้วย (สำหรับข้อมูลที่ไม่ค่อยมีการเปลี่ยนแปลงมากนัก) ทำให้ประหยัดมากขึ้นอีก

เพิ่มความเร็วในการทำงาน
สำหรับบริษัทที่มีปัญหาความเร็วในการทำงานของไอโอของ SCSI HBA อันเป็นเหตุทำให้เซิร์ฟเวอร์รันแอพพลิเคชันได้ช้าลง หรือในช่วงที่มีปริมาณทราฟฟิกสูง ๆ อาจทำให้เกิดไทม์เอาท์ได้ วิธีการแก้ปัญหานี้ที่หลาย ๆ บริษัทนำมาใช้ก็คือการกระจายแอพพลิเคชันไปรันบนเซิร์ฟเวอร์หลาย ๆ ตัว แต่ด้วยอินเทอร์เฟซแบบ SAS HBA กับเซิร์ฟเวอร์เดิม โดยไม่ต้องมีการลงทุนซื้อเซิร์ฟเวอร์ใหม่เพิ่มเติม แต่ความเร็วในการรับส่งข้อมูลของ SAS HBA ที่สูงถึง 3 Gbps ซึ่งสูงกว่าการรับส่งข้อมูลของ SCSI แบบเดิมที่ 320 Mbps เกือบสิบเท่า ทำให้ประหยัดต้นทุนในการเพิ่มความเร็วในการทำงานอย่างมาก
โดย SAS HBA ช่วยลดทรูพุตที่เป็นคอขวดของไอโอที่เชื่อมต่อภายในกับอุปกรณ์จัดเก็บข้อมูล หรือ Direct-Attached Storage (DAS) ทำให้ขยายจำนวนอุปกรณ์จัดเก็บข้อมูลเพิ่มสูงสุดถึง 16,000 จุดต่อเซิร์ฟเวอร์ตัวเดียว
แต่อย่ามัวแต่ดีใจกับข้อดีทั้งหลายที่กล่าวไปในเบื้องต้นเท่านั้น ข้อเสียก็มีเช่นกัน เช่น SAS HBA ไม่อนุญาตให้ใช้ N-Port ID Virtualization (NPIV) ทำให้ผู้ดูแลระบบจะต้องตั้งชื่อ SAS HBA หนึ่งชื่อต่อหนึ่งเซิร์ฟเวอร์ และหากคุณต้องการใช้ network-attach SCSI หรืออุปกรณ์จัดเก็บข้อมูลที่เป็น FC ร่วมกับ SAS HBA คุณจะต้องใช้บริดจ์ หรือ เราท์เตอร์ ช่วยให้ SAS HBA สามารถสื่อสารกับอุปกรณ์จัดเก็บข้อมูลแบบดั้งเดิมได้

ลดต้นทุนด้วยการใช้ร่วมกับดิสก์ไดร์ฟแบบ SATA
SAS อนุญาตให้ผสมผสานดิสก์ไดร์ฟที่มีอินเทอร์เฟชเป็น Serial Attached SCSI และ Serial ATA เพื่อประหยัดต้นทุน และประสิทธิภาพ โดยใช้ดิสก์ไดรฟ์ที่เป็น SATA สำหรับข้อมูลที่ไม่มีการเปลี่ยนแปลงข้อมูลบ่อยนักเพราะราคาดิสก์ไดรฟ์ ถูกกว่า แต่สำหรับข้อมูลที่ต้องการความรวดเร็วและความน่าเชื่อถือในการเรียกใช้งาน ให้ใช้ดิสก์ไดรฟ์ที่เป็น SAS แทน

จากตัวอย่างในรูปที่ 3 เป็นการเชื่อมต่อ SAS HBA เพื่อขยายดิสก์ภายนอกจากเดิมที่มีดิสก์แบบ SATA ภายในเซิร์ฟเวอร์เพียง 4 ลูก ทำให้มีประสิทธิภาพสูงกว่าการเชื่อมต่อภายนอกแบบ SATA โดยตรงและขยายจำนวนดิสก์ไดรฟ์ที่ใช้งานได้จำนวนมากขึ้นตัวอย่างการใช้วิธี การเชื่อมต่อแบบนี้ได้แก่ data warehouse, databases, decision support

จากตัวอย่างในรูปที่ 4 เป็นการเชื่อต่อโดยใช้ SAS Expander เพื่อขยายจำนวนดิสก์ภายนอก ซึ่งสามารถขยายได้สูงถึง 16,000 ลูก ในขณะที่ประสิทธิภาพในการเชื่อมต่อเทียบเท่ากับ drive แบบ FC/SCSI ทีเดียว ตัวอย่างการใช้วิธีการเชื่อมต่อแบบนี้ได้แก่ data warehouse, databases, transaction processing, decision support

จากตัวอย่างในรูปที่ 5 เป็นการเชื่อมต่อโดยใช้ FC Switch เข้ามาช่วยในการทำ multi-pathing และ failover ทำให้มีความน่าเชื่อถือของระบบมากขึ้นเหมาะสำหรับระบบที่ไม่ต้องการให้เกิด การล้มเหลวขึ้นในระบบ ตัวอย่างการใช้วิธีการเชื่อมต่อแบบนี้ได้แก่ data warehouse, databases, transaction processing, decision support


ความปลอดภัยในการใช้งาน
การทำโซนนิ่งและการรักษาความปลอดภัยบนอุปกรณ์จัดเก็บข้อมูลเป็นอีกฟังก์ชัน หนึ่งที่เป็นพื้นฐานการใช้งาน SAS ในทุกวันนี้ เพื่อให้มั่นใจว่า SAS HBA สามารถทำถึงได้เฉพาะ LUN ที่ได้รับอนุญาตเท่านั้น ผู้ดูแลระบบจะต้องกำหนด LUN ให้กับพอร์ตใน SAS array เพื่อควบคุมการเข้าถึง LUN โดยการพาร์ทิชัน หรือ LUN masking บน SAS Storage array และการทำโซนนิ่งบน SAS expanders
โดย SAS expanders มี 2 ประเภทคือ edge expanders และ fan-out expanders
1. edge expander จะปลั๊กเข้ากับพอร์ต SAS บนเซิร์ฟเวอร์ ซึ่งจะสามารถสนับสนุนเพิ่มได้มากถึง 128 ชุด โดยจำกัดระยะทางไม่เกิน 8 เมตร
2. fan-out expander จะเพิ่มความสามารถในการทำการเราท์ติ้งและฟีเจอร์รวมถึงราคาด้วย แต่ก็ยังคงสนับสนุนได้แค่ 128 ชุด เช่นกัน

แต่อย่างไรก็ตามควรที่จะจำกัดจำนวนของโซนบน SAS expanders ไม่ให้เกินสามเพราะ expanders จะเป็นผู้ตัดสินชี้ขาดว่าจะให้ข้อมูลไหลไปยังอุปกรณ์จัดเก็บข้อมูลตัวใดที่ ต่ออยู่กับมัน แม้ว่าในปัจจุบัน จำนวนและความสามารถในการสร้าง SAS โซนนั้นจะถูกจำกัดใน fan-out expanders และ hybrid expander (ผสมระหว่าง fan-out และ edge) ซึ่งจะมีการปรับปรุงในสเป็คของ SAS-2 ที่กำลังพัฒนากันอยู่ต่อไป

บทสรุป
แม้ว่าบริษัทผู้ผลิตอุปกรณ์จัดเก็บข้อมูลหลาย ๆ บริษัทเริ่มย้ายการผลิตอุปกรณ์จากไอโอที่เป็น SCSI ไปเป็น SAS HBA ในการเชื่อต่อภายใน เช่นบริษัท EMC มีนโยบายที่จะลดการผลิตอุปกรณ์จัดเก็บข้อมูลที่มีการเชื่อมต่อแบบ SCSI ในปัจจุบัน และจะเลิกผลิตในปี 2008 แต่ถึงกระนั้นก็ตามยังมีปัจจัยที่สำคัญที่ทำให้ SCSI ยังคงความนิยมอยู่ในปัจจุบัน ได้แก่
1. อุปกรณ์จัดเก็บข้อมูลและเทปไดรฟ์ที่เป็นมาตรฐาน SAS ยังคงอยู่ในแล็ป หรือ เพิ่งจะเริ่มทยอยเข้าสู่ตลาดในปัจจุบัน
2. อุปกรณ์ที่เป็น Parallel SCSI HBA นั้นเติบโตอย่างเต็มที่ และลูกค้ามั่นใจเรื่องเสถียรภาพในการทำงาน
3. อุปกรณ์จัดเก็บข้อมูลรุ่นเก่า ๆ จำนวนมากสามารถใช้อินเทอร์เฟซแบบ SCSI เท่านั้น
ดังนั้นแม้เทคโนโลยีใหม่จะก้าวหน้าเพียงใด หากในบริษัทของคุณยังมีดิสก์ไดรฟ์ที่เป็นมาตรฐานเก่าและยังไม่พร้อมจะปรับ เปลี่ยนในวันนี้ ก็ขอให้ศึกษาและเลือกเทคโนโลยีที่เหมาะสมกับบริษัทของคุณก่อนจะตัดสินใจใดๆ นะครับ

Thanks : สุรชาติ พงศ์สุธนะ