Navigation

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

รวมคำสั่งชุด maatkit สำหรับ Ubuntu Server

รวมคำสั่งชุด maatkit สำหรับ Ubuntu Server

maatkit เป็นคำสั่งสำหรับเอาไว้จัดการ Database replication อย่างง่าย ไว้สำหรับ ทำ automate repetitive task,
ตรวจสอบการทำงาน, ตรวจสอบความถูกต้องของข้อมูล ในการทำ database replication, บลา บลา บลา

วันศุกร์ที่ 5 สิงหาคม พ.ศ. 2554

Postfix วิธีการ pipe mail ที่ได้รับ ไปยัง command ต่างๆ

Environment ที่ใช้ทดสอบนะครับ ใช้ Ubuntu 10.04.3, Postfix, Dovecot เป็นหลัก สิ่งที่ต้องการคือ เมื่อมีคนส่ง e-mail มาที่ test@example.com แล้ว ให้ postfix ทำการ pipe email นั้นเข้าสู่โปรแกรม /home/myuser/testperl ซึ่งเป็น perl script ที่ผมเขียนรอไว้ก่อนหน้านี้แล้ว

ทั้งนี้ ตัว postfix ผม config ตัว virtual domains, virtual mailbox ที่ติดต่อกับ mysql server เอาไว้ด้วยนะครับ

เริ่มจาก

  • เข้าไปแก้ไข /etc/postfix/main.cf

ที่บรรทัด smtpd_recipient_restrictions เพิ่มคำสั่ง check_recipient_access เข้าไป

smtpd_recipient_restrictions =

# bypass checks on outgoing mail
permit_mynetworks

# reject if not full email address
reject_non_fqdn_recipient
# next line rejects if the account/domain does not exist
# ALSO prevents OPEN RELAY - if missing RELAY is OPEN!!
# MUST appear before the check_recipient_access
reject_unauth_destination

# perform filter access by recipient name
check_recipient_access hash:/usr/local/etc/postfix/script_filter


  • เพิ่ม /etc/postfixscript_filter

test@example.com FILTER support:dummy


  • # postmap script_filter จะมีไฟล์ script_filter.db เพิ่มขึ้นมา
  • เข้าไปแก้ master.cf

support  unix - n n - - pipe
flags=Rq user=www
argv=/home/myuser/testperl $(sender)$(recipient)

โดยใน perl script จะได้ argument 1 = sender และ argument 2 = receiver

แค่นี้ ระบบก็เรียบร้อยพร้อมใช้งานแล้ว ยิ้ม


reference: http://www.zytrax.com/tech/survival/postfix.html#pipe

วันเสาร์ที่ 18 ธันวาคม พ.ศ. 2553

ยินดีต้อนรับสู่ ntseries's blog คร้าบ

อยู่ดีๆ ก็มีอารมณ์อยากเขียนบล็อคเล่นๆ เลยมาเปิดกับ Blogger อิอิ
แล้วจะมีอะไรดีๆมาแบ่งปันกันอย่างแน่นอนคร้าบ :)