วันจันทร์ที่ 23 สิงหาคม พ.ศ. 2553

ดูสถานะของ HW RAID ผ่าน Linux

วันนี้หลังจากติดตั้ง Linux Debian เรียบร้อยแล้ว สิ่งที่ตามมาคือเราจะรู้ได้อย่างไรว่า HW-RAID ของเรานั้นทำงานเป็นปกติดี

อันดับแรกก็ต้องตรวจสอบก่อนว่า เรามี HW รองรับหรือไม่

Server# dmesg |grep mpt
[ 2.174757] mptbase: ioc0: Initiating bringup
[ 3.369272] mptbase: ioc0: PCI-MSI enabled

เมื่อแน่ใจแล้วก็ติดตั้ง mpt-status (mpt-status - get RAID status out of mpt (and other) HW RAID controllers)

Server # aptitude install mpt-status

แต่เมื่อลองใช้งานดูปรากฏว่า ยังไม่มี device และยังไม่ได้โหลด module นี้ไว้ใน Kernel เลย
Server # mpt-status
open /dev/mptctl: No such file or directory
Try: mknod /dev/mptctl c 10 220
Make sure mptctl is loaded into the kernel

ดังนั้นก็เริ่มโหลดกัน

Server # mknod /dev/mptctl c 10 220
Server # modprobe mptctl

ดูหน่อยว่ามี module โหลดแล้วแน่
Server# dmesg |tail -n 3
[ 1786.460073] Fusion MPT misc device (ioctl) driver 3.04.06
[ 1786.460073] mptctl: Registered with Fusion MPT base driver
[ 1786.460073] mptctl: /dev/mptctl @ (major,minor=10,220)

Server# mpt-status

You seem to have no SCSI disks attached to your HBA or you have
them on a different scsi_id. To get your SCSI id, run:

mpt-status -p

Server# mpt-status -p
Checking for SCSI ID:0
Checking for SCSI ID:1
Found SCSI id=1, use ''mpt-status -i 1`` to get more information.

Server# mpt-status -i 1
ioc0 vol_id 1 type IM, 2 phy, 465 GB, state OPTIMAL, flags ENABLED
ioc0 phy 0 scsi_id 4 ATA ST3500514NS BB23, 465 GB, state ONLINE, flags NONE
ioc0 phy 1 scsi_id 2 ATA ST3500320NS BB12, 465 GB, state ONLINE, flags NONE


เท่านี้เราก็รู้ว่า RAID เราทำงานหรือยัง

สุดท้ายก็ต้องให้ mptctl โหลดตอน Boot

Server # vi /etc/modules

แล้วเพิ่ม mptctl เข้าไปอีก 1 บรรทัด

ที่มา http://linuxhostingsupport.net/blog/open-devmptctl-no-such-device-make-sure-mptctl-is-loaded-into-the-kernel

วันจันทร์ที่ 9 สิงหาคม พ.ศ. 2553

SMTP relay with authenticate


เวลาเราใช้ SPF ในการตรวจสอบที่มาของการส่ง email เราก็จะพบว่าต้องคอยไปเพิ่ม ip ของเครื่อง server ที่เราใช้ส่งอยู่บ่อยไป ดังนั้น มาวันนี้ก็ขอใช้ความรู้เรื่องการทำ authenticate relay smtp มาใช้งานดู ซึ่งสามารถใช้ได้กับ smtp ของ gmail ได้ด้วย (นี่ยิ่งทีเข้าไปใหญ่)

ก่อนอื่นเราต้องแน่ใจก่อนว่าเรามีการใช้งาน sasl ก่อน

# sudo apttitude install postfix libsasl2-2 ca-catificate libsasl2-modules








แล้วก็ต้องมาแก้ main.cf ตามมา โดยให้มีการกำหนดค่าสำคัญ ๆดังต่อไปนี้

[สร้างไฟล์ /etc/postfix/sasl_passwd.db]
Server # vi /etc/postfix/sasl_passwd
 # [smtp.mydomain.com]:25 user.name@mydomain.com:password
Server # chmod 400 /etc/postfix/sasl_passwd
Server # postmap /etc/postfix/sasl_passwd #เราก็จะได้ไฟล์ sasl_passwd.db ออกมาใช้งาน

[สร้างไฟล์เพื่อใช้สำหรับการตรวจสอบ certificate]
Server # cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | tee -a /etc/postfix/cacert.pem

[main.cf]
relayhost=[mail.mydomain.com]:25
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_tls_loglevel=1
smtp_sasl_security_options = noanonymous
smtp_sasl_local_domain =
broken_sasl_auth_clients = yes # ไว้สำหรับ MS Outlook ดีนักแล
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_authenticated_header = yes # สำหรับบอกว่า email นี้ได้ผ่านการตรวจสอบผู้ใช้แล้วนะ
smtp_tls_CAfile = /etc/postfix/cacert.pem # ไฟล์ Certificate

ที่มา : http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/