วันอังคารที่ 28 กรกฎาคม พ.ศ. 2552

Step By Step - Alfresco authentication ldap with Zimbra

หลังจากที่มีการติดตั้ง Zimbra ไว้แล้ว ทีนี้เราจะใช้ User เดียวกันกับ zimbra ให้มา login ใน Alfresco สามารถทำได้โดย
1. Copy ไฟล์ ldap-authentication-context.xml.sample โดย เข้าไปที่ /opt/alfresco/tomcat/shared/classes/alfresco/extension

root@alfresco:~# cd /opt/alfresco/tomcat/shared/classes/alfresco/extension
root@alfresco:/opt/alfresco/tomcat/shared/classes/alfresco/extension# cp ldap-authentication-context.xml.sample ldap-authentication-context.xml


2. Copy ไฟล์ ldap-authentication.properties จากไดเรคทอรีเดียวกัน

root@alfresco:/opt/alfresco/tomcat/shared/classes/alfresco/extension# cp ldap-authentication.properties.sample ldap-authentication.properties


3. แก้ไขไฟล์ ldap-authentication.properties โดยระบุ Username
ตรวจสอบ BaseDN ของ zimbra โดยไปที่เครื่อง zimbra และใช้ คำสั่ง ldapsearch -x

root@zimbra:~# su - zimbra
zimbra@zimbra:~$ ldapsearch -x

# local
dn: dc=local
dc: local
objectClass: dcObject
objectClass: organization
o: local domain

# osdev.local
dn: dc=osdev,dc=local
zimbraMailStatus: enabled
zimbraId: e8cfcc00-df85-407c-b913-b5495a9aad05
dc: osdev
zimbraDomainName: osdev.local
zimbraDomainType: local
objectClass: dcObject
objectClass: organization
objectClass: zimbraDomain
o: osdev.local domain

# people, osdev.local
dn: ou=people,dc=osdev,dc=local
ou: people
objectClass: organizationalRole
cn: people
......
....
..


root@alfresco:/opt/alfresco/tomcat/shared/classes/alfresco/extension# nano ldap-authentication.properties

#ldap.authentication.userNameFormat=%s
ldap.authentication.userNameFormat=uid=%s,ou=people,dc=osdev,dc=local


4. ระบุ Hostname และ Port ของ ldap
สามารถตรวจสอบ URL ได้โดยไปที่เครื่อง zimbra

zimbra@zimbra:~$ zmlocalconfig -s |grep ldap
//สังเกตุตรงส่วน ldap_master_url
ldap_connect_pool_prefsize = 0
ldap_connect_pool_timeout = 120000
ldap_connect_timeout = 30000
ldap_deref_aliases = always
ldap_host = zimbra.osdev.local
ldap_is_master = true
ldap_log_level = 49152
ldap_master_url = ldap://zimbra.osdev.local:389
ldap_nginx_password = bBsKhElLf
ldap_port = 389


นำ URL มาใส่ในส่วน ldap.authentication.java.naming.provider.url ในไฟล์ ldap-authentication.properties

ldap.authentication.java.naming.provider.url=ldap://zimbra.osdev.local:389


5. เปลี่ยนจาก DIGEST-MD5 เป็น simple

#ldap.authentication.java.naming.security.authentication=DIGEST-MD5
ldap.authentication.java.naming.security.authentication=simple


6. ระบุ user dn(ตรวจสอบเหมือนข้อ 3) สำหรับเข้าถึง ldap พร้อมพาสเวิร์ด

#ldap.authentication.java.naming.security.principal=reader
ldap.authentication.java.naming.security.principal=uid=admin,ou=people,dc=osdev,dc=local

# The password for the default principal (only used for LDAP sync)
ldap.authentication.java.naming.security.credentials=password


7. บันทึกไฟล์ property
8. stop service alfresco และทำการ start อีกครั้ง

วันพุธที่ 24 มิถุนายน พ.ศ. 2552

Centralize-Log Server On Ubuntu

หลังจากติดตั้ง Ubuntu 8.04.2 LTS(รวม dns, ssh-server, LAMP)
1. จัดการระบบเน็ตเวิร์คเบื้องต้น(ต้องสามารถใช้งานอินเทอร์เน็ตได้)
1.1 แก้ไขไฟล์ /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

1.2 ทดสอบการใช้งาน Internet โดยใช้คำสั่ง ping

admins@logserver:~$ ping google.com
PING google.com (74.125.127.100) 56(84) bytes of data.
64 bytes from pz-in-f100.google.com (74.125.127.100): icmp_seq=1 ttl=241 time=284 ms
64 bytes from pz-in-f100.google.com (74.125.127.100): icmp_seq=2 ttl=241 time=283 ms

2. update ระบบ

admins@logserver:~$ sudo apt-get update

3. เปิดการทำงาน Packet Forwarding ที่ /etc/sysctl.conf

admins@logserver:~$ sudo vi /etc/sysctl.conf
เอา comment(#) ข้างหน้า net.ipv4.ip_forward=1

โหลดค่าการทำงานโดย

admins@logserver:~$ sudo sysctl -p


4. ติดตั้ง ntp พร้อมคอนฟิก /etc/ntp.conf และตรวจสอบ

admins@logserver:~$ sudo aptitude install ntp

ตรวจสอบ Time zone

admins@logserver:~$ ls -l /etc/localtime
-rw-r--r-- 1 root root 178 2009-06-22 14:52 /etc/localtime
admins@logserver:~$ sudo ln -sf /usr/share/zoneinfo/Asia/Bangkok /etc/localtime
admins@logserver:~$ ls -l /etc/localtime
lrwxrwxrwx 1 root root 32 2009-06-23 17:07 /etc/localtime -> /usr/share/zoneinfo/Asia/Bangkok

แก้ไขไฟล์ /etc/ntp.conf

เพิ่ม server 192.168.1.1 เพื่อ sync เวลากับเครื่อง 192.168.1.1

server 192.168.1.1
server time.navy.mi.th #กันเหนียว
server time1.nimt.or.th #กันเหนียว
server clock.nectec.or #กันเหนียว

เริ่มการทำงานของ ntpd

admins@logserver:~$ sudo /etc/init.d/ntp start


5. ติดตั้ง rsyslog, rsyslog-mysql, phpmyadmin

admins@logserver:~$ sudo aptitude install rsyslog rsyslog-mysql phpmyadmin


6. ปิดการทำงานของ syslogd

admins@logserver:~$ cd /etc/rc2.d
admins@logserver:/etc/rc2.d$ mv S10sysklogd _s10sysklogd


7. ติดตั้ง stunnel(สร้างการเชื่อมต่อแบบ ssl), openssl

admins@logserver:~$ sudo aptitude install openssl stunnel


8. สร้าง certificate โดยใช้ openssl

admins@logserver:~$ cd /etc/stunnel/
admins@logserver:/etc/stunnel$ openssl req -new -x509 -days 3650 -nodes -out stunnel.pem -keyout stunnel.pem


9. สร้างคอนฟิกไฟล์สำหรับ stunnel พร้อม start service

admins@logserver:~$ sudo vi /etc/stunnel/syslog-server.conf
พิมพ์
cert = /etc/stunnel/stunnel.pem
debug = 7
[rsyslogd]
accept = 60514
connect = 61514

แก้ไฟล์ /etc/default/stunnel4

ENABLE=1
FILES="/etc/stunnel/syslog-server.conf"


เริ่มการทำงานโดย

admins@logserver:~$ sudo /etc/init.d/stunnel4 start

แก้ไขไฟล์ /etc/default/rsyslog


RSYSLOGD_OPTIONS="-m 0 -r -t 61514"

เริ่มการทำงานของ rsyslog โดย

admins@logserver:~$ sudo /etc/init.d/rsyslog start


10. แก้ไขคอนฟิกไฟล์ /etc/rsyslog.conf เพื่อเพิ่ม Module MySQL พร้อม start service

admins@logserver:~$ sudo vi /etc/rsyslog.conf
เพิ่ม
$ModLoad ommysql
*.* :ommysql:127.0.0.1,Syslog,root,password

$template DynaFile,"/var/log/mylogs/%HOSTNAME%.%$DAY%%$MONTH%%$YEAR%.log"
*.* -?DynaFile


11. ตรวจสอบโดยให้เครื่อง client ลองส่ง log เข้าใน syslog
เซตให้ Pfsense ส่ง log มาที่ logserver

12. ติดตั้ง phplogcon โดยดาวน์โหลด source พร้อมคอนฟิก

admins@logserver:~$ wget http://www.phplogcon.org/Downloads-req-getit-lid-56.phtml
admins@logserver:~$ cd /var/www
admins@logserver:/var/www$ sudo tar xvfz phplogcon-2.6.3.tar.gz
admins@logserver:/var/www$ sudo mv phplogconf-2.6.3 phplogcon
admins@logserver:/var/www$ sudo chown -R www-data.www-data /var/www/phplogcon

เข้าสู่หน้าเวบโดย http://192.168.1.10/phplogcon/src จากนั้นทำการติดตั้ง

ต้องการติดตั้งใหม่ทำได้โดยลบ config.php ใน /var/www/phplogcon/src

วันจันทร์ที่ 22 มิถุนายน พ.ศ. 2552

แก้ปัญหา dns ไม่เวิร์กก่อน redirect ไปหน้า login ใน Pfsense

ปัญหา : เข้าเวบบางเวบแล้วไม่ redirect ไปหน้า login ขึ้น Error

สมมุติฐาน : dns ไม่สามารถ resolve ชื่อเวบนั้น ๆ ได้

วิธีแก้ไข : ไปที่ Services -> Captive Portal ไปที่แท็บ Allowed IP Address แล้วเพิ่ม dns ของ ISP หรือ dns server ลงไป

วันพุธที่ 17 มิถุนายน พ.ศ. 2552

ส่ง squid log จาก pfsense ให้เข้า syslog

ไปที่ Services -> Proxy server
เพิ่ม Custom Options


จากนั้นตรวจสอบโดยไปที่ Status -> System Logs ดูในแท็บ Portal Auth จะมี access.log ของ squid วิ่งอยู่ค่า ^-^


สำหรับ squid 2.7 ถ้าใส่แบบเดิมจะขึ้น error แบบนี้

“Cannot open ‘syslog’ for writing. The parent directory must be writeable by the user ‘proxy’”

ให้ใส่ตรง Custom Options เป็น access_log syslog:daemon common

ที่มา : http://www.implementer.co.th/wordpress/syslog-squid-pfsense-proble/

ทำให้ rsyslog เก็บลง mysql

ทำบน Ubuntu 8.04 ค่า แต่ต้องติดตั้งแล้วก็คอนฟิก rsyslog เรียบร้อยนะคะ แล้วเราต้องการให้ rsyslog เก็บ log ลงฐานข้อมูล MySQL ทำได้โดย
1. sudo aptitude install rsyslog-mysql
2. sudo nano /etc/rsyslog.conf
3.เพิ่ม

$ModLoad ommysql // โหลดโมดูล
*.* :ommysql:database-server,database-name,database-userid,database-password //ทำให้ rsyslog เขียนลงฐานข้อมูล แก้ไข database-server,database-name,database-userid,database-password ให้ถูกต้องตามที่ตั้งไว้ เช่น
*.* :ommysql:127.0.0.1,Syslog,syslogwriter,password


4. restart service โดย sudo /etc/init.d/rsyslog restart
5. ตรวจสอบโดยใช้ PHPMyAdmin หรือ PHPLogcon ค่า

วันอังคารที่ 9 มิถุนายน พ.ศ. 2552

สำหรับศึกษา Pfsense

ช่วงนี้แอดมินสุดสวยต้องหาเครื่องมือสำหรับจัดการ ADSL Load balance และเก็บ log ตาม พรบ. ได้ในตัว เลยศึกษาเจ้า Pfsense ซะหน่อย มาดูแหล่งกันก่อนดีกว่านะคะ
ของไทย
www.linuxthai.org
http://www.laontalk.com เวบนี้ชอบเพราะมีวีดีโอสอนด้วย ^-^
แค่สองเวบก็เกินพอ

สำหรับเวบต้นฉบับ
http://www.pfsense.com/

จับคู่ชื่อและเวอร์ชันของ Ubuntu

เหตุการณ์
A : เอ๊ะ Ubuntu ที่ชื่อ Hardy นี่เวอร์ชันไรนะ
B : (ระลึกชาติ) 8.04 ค่ะ(ตอบเสียงแข็ง) เอ๊ะ ใช่ป่าวนะ ชักไม่แน่ใจ....

ก็เลยทำไว้เล่น ๆ กันลืมค่า ^-^

Version Name
6.10 Edgy
7.04 Feisty Fawn
7.10 Gutsy Gibbon
8.04 Hardy Heron
8.10 Intrepid Ibex
9.04 Jaunty Jackalope