วันอังคารที่ 11 พฤษภาคม พ.ศ. 2553

การจัดการ ZimbraMtaMyNetworks

เนื่องจากเซิร์ฟเวอร์เปลี่ยนไอพีใหม่ ทำให้ต้องเปลี่ยนแปลงค่า MyNetworks ใน postfix
ก่อนอื่นตรวจสอบค่าเก่าก่อนโดยใช้คำสั่ง

zimbra@mail:~$ postconf mynetworks
mynetworks = 127.0.0.0/8,192.168.0.0/24,192.168.1.0/24,xxx.xxx.xxx.0/25

จากนั้นเปลี่ยนแปลงค่าโดย

zimbra@mail:~$ zmprov modifyServer mail.osdev.co.th zimbraMtaMyNetworks 'Network ค่าใหม่ที่ต้องการเปลี่ยน'
zimbra@mail:~$ postfix reload
postfix/postfix-script: refreshing the Postfix mail system

เป็นอันเรียบร้อย ^^

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

เซต Relay Host บน Zimbra

วันนี้เจอปัญหาว่าเมลเซิร์ฟเวอร์นั้นส่งเมลออกได้บางโดเมน แต่ก็มีอีกหลายโดเมนที่ไม่สามารถส่งออกได้

ทีมงานก็ช่วยกันทดสอบโดยลองไปใช้ smtp ของที่อื่น ก็ส่งออกได้ปกติ จึงจำเป็นต้องเซต server

ให้ส่ง Relay mail ไปใช้ smtp ตัวที่ใช้ได้ก่อน ซึ่งวิธีเซตบน Zimbra นั้นก็ทำตามนี้

http://wiki.zimbra.com/index.php?title=Outgoing_SMTP_Authentication

ต่อไปนี้เป็นขั้นตอนที่ทำจริง

การจะเซต Relay host ทำบน Admin UI ก็ได้โดยไปที่ server เลือกแทป MTA แล้วเซตตรง

Relay MTA for external delivery ให้เป็น smtp ที่ต้องการ Relay

แต่ถ้าไม่เข้าไปจะใช้คอมมานด์ที่เดียวก็ได้ แต่ต้องให้ user เป็น zimbra ก่อนแล้วก็ใช้คำสั่ง

zimbra@mail:~$ zmprov ms mail.example.com zimbraMtaRelayHost relayserver.com:port_num


แต่ถ้า smtp นั้นมีการ Authen ก็ต้องทำต่อตามนี้

1. สร้างไฟล์ relay_password ใน /opt/zimbra/conf ก่อน

zimbra@mail:~$ touch /opt/zimbra/conf/relay_password

2. ใส่ smtp server, user, password ในไฟล์ /opt/zimbra/conf/relay_password

zimbra@mail:~$ echo mail.example.com username:password > /opt/zimbra/conf/relay_password


ลองใช้คำสั่ง cat /opt/zimbra/conf/relay_password ต้องได้


mail.example.com username:password


3. hash ไฟล์

zimbra@mail:~$ postmap hash:/opt/zimbra/conf/relay_password


4. ทดสอบความถูกต้อง ซึ่ง คำตอบต้องได้ username:password:

zimbra@mail:~$ postmap -q relayserver.com /opt/zimbra/conf/relay_password


5. แก้ไขคอนฟิกไฟล์ postfix ให้ใช้ password ใหม่


zimbra@mail:~$ postconf -e smtp_sasl_password_maps=hast:/opt/zimbra/conf/relay_password

6. คอนฟิก postfix ให้ใช้ SSL authen

zimbra@mail:~$ postconf -e smtp_sasl_auth_enable=yes


7. zimbra@mail:~$ postconf -e smtp_cname_overrides_servername=no

8. zimbra@mail:~$ postfix reload

ถ้าใช้ TLS ให้ใช้

zimbra@mail:~$ postconf -e smtp_use_tls=yes

zimbra@mail:~$ postfix reload


แต่ทำแล้วก็ยังติดปัญหา ดูใน log file เจอแบบนี้

Jan 22 13:54:27 mail postfix/smtp[31651]: 0585014E81F9: to=, relay=relayserver.com[xxx.xxx.xxx.xxx]:25, delay=5.1, delays=0.01/0.01/5.1/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server relayserver.com[xxx.xxx.xxx.xxx]: no mechanism available)

ให้แก้โดย

zimbra@mail:~$ postconf -e smtp_sasl_security_options=noanonymous

zimbra@mail:~$ postfix reload


จบกระบวนท่า แค่นี้ก็ relay host ได้แล้ว ไปเชค log เพื่อความแน่ใจอีกรอบนะเจ้าคะ

อ่อ log ก็ดูได้ใน /var/log/zimbra.log จ้า

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

show progress ระหว่างใช้คำสั่ง dd

เวลาใช้คำสั่ง dd ก็จะไม่รู้ว่ามันทำงานไปถึงไหนแล้ว

เช่น dd if=/dev/sda of=/dev/sdb

พอ enter ปุ๊บมันก็จะเงียบไม่บอกกล่าวอะไร

ให้เปิดอีก terminal แล้วสั่ง kill -USR1 `pgrep ^dd`

จะเห็นแบบนี้ ^-^

5588081+0 records in
5588080+0 records out
2861096960 bytes (2.9 GB) copied, 131.32 s, 21.8 MB/s




อ้างอิง http://blog.christophersmart.com/2009/11/28/checking-the-progress-of-dd/

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

เปลี่ยน default domain Zimbra

ปกติเวลาลง Zimbra เสร็จ default จะนำชื่อเครื่องมาเป็นโดเมน

เช่น @mail.example.com แต่ถ้าต้องการให้เป็น @example.com

สามารถแก้ไขได้ที่ส่วนของ Zimbra Admin โดยไปที่

Global Setting ที่แท็บ General Information เปลี่ยน

default domain จาก mail.example.com เป็น example.com

แค่นี้ก็เป็นอันเสร็จ เวลา login ก็ไม่ต้องใส่ user@example.com ใส่แค่ชื่อ user ก็เข้าได้ ชิล ชิล ^-^

วันพฤหัสบดีที่ 3 ธันวาคม พ.ศ. 2552

วิธีแก้ user password expiry

โดยปกติจะมีการเตือนสำหรับ user password expiry ใน 90 วันหลังจากวันที่มีการสร้าง user
ถ้าต้องการให้ user คนใดไม่ให้ password expire ให้ใช้คำสั่ง chage -M 99999 anchalee เป็นต้น หรือแก้ในไฟล์ /etc/shadow เช่น anchalee:$1$OJ.PbnIV$mADdB2do0h8gyu4qiLQWC.:13712:0:99999:7:::

ถ้าต้องการให้ user ที่ add ทุกคนไม่มีวัน password หมดอายุให้แก้ที่ไฟล์ /etc/login.defs
แก้ไขตรง PASS_MAX_DAYS 90 เป็น PASS_MAX_DAYS 99999

pfsense 1.2.2 -> captive portal ไม่ redirect ไปหน้า login

สิ่งแวดล้อม : load balance + captive portal

อาการ : เปิด load balance และ captive portal จะไม่เข้าส่วนของหน้า login แต่จะสามารถใช้งานผ่าน port 80 ได้ แต่ port อื่นไม่สามารถใช้งานได้ ถ้าต้องการเข้าหน้า login ต้องเข้าเองโดยผ่าน URL : http://ip-address:8000 ถึงจะเข้าหน้า login ได้ แต่ถ้าลองปิด load balance จะเข้าหน้า login ปกติ

วิธีแก้ :
1. backup config ก่อน
2. download http://mirror.optus.net/pub/pfSense/updates/pfSense-Full-Update-1.2.3-RC3.tgz
3. ไปที่ System -> Firmware -> Manual Update แล้ว คลิก “Enable firmware upload” -> คลิก “Browse” -> เลือก .tgz file -> คลิก “Upgrade Firmware”
4. reboot

พอเสร็จเรียบร้อยอาการที่ว่าก็จะหายเป็นปลิดทิ้ง