postfix+dovecot+sasl+activate direcotory (centos 6)

1. vi /etc/dovecot/conf.d/10-auth.conf
uncommand the following setting
#!include auth-ldap.conf.ext
as
!include auth-ldap.conf.ext

2.  vi  /etc/dovecot/conf.d/auth-ldap.conf.ext
auth_username_format = %Lu

passdb ldap {
args = /etc/dovecot/dovecot-ldap.conf.ext

}

userdb static {
args = uid=501 gid=501 home=/home/vmail/%u
}
3. vi /etc/dovecot/dovecot-ldap.conf.ext
hosts = ad_server_ip
base = dc=test,dc=com,dc=tw
ldap_version = 3
auth_bind = yes
ldap_version = 3
auth_bind_userdn = test%u
pass_filter = (&(objectclass=person)(uid=%u))

ps. uid and gid must the same with postfix  and directory in linux server
ex: create one user “vmail”
user id is 501 , gid is 501

4. postfix’s main.cf
virtual_mailbox_domains = $mydomain
virtual_mailbox_base = /home/vmail/
virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf
virtual_uid_maps = static:501
virtual_gid_maps = static:501
virtual_alias_maps = hash:/etc/aliases,ldap:/etc/postfix/ldap-aliases-inner.cf
#smtp auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
#additional param
message_size_limit = 40960000
smtpd_helo_required = yes
disable_vrfy_command = yes
strict_rfc821_envelopes = yes
bounce_queue_lifetime = 1d
maximal_queue_lifetime = 1d
data_directory = /var/db/postfix
header_checks = regexp:/etc/postfix/header_checks
smtp_host_lookup = native, dns

5. vi /etc/postfix/ldap-users.cf
server_host = ad_server_ip
search_base = dc=test,dc=com,dc=tw
version = 3
query_filter = (&(objectclass=*)(mail=%s))
result_attribute = samaccountname #Account from DC
result_format = %s/Maildir/
bind = yes
bind_dn = cn=ldap,cn=Users,dc=test,dc=com,dc=tw
bind_pw = ldappassword

6. vi //etc/sysconfig/saslauthd
# Directory in which to place saslauthd’s listening socket, pid file, and so
# on. This directory must already exist.
SOCKETDIR=/var/run/saslauthd

# Mechanism to use when checking passwords. Run “saslauthd -v” to get a list
# of which mechanism your installation was compiled with the ablity to use.
#MECH=pam
MECH=ldap

# Additional flags to pass to saslauthd on the command line. See saslauthd(8)
# for the list of accepted flags.
FLAGS=”-O /etc/postfix/saslauthd.conf -c -r”

7. vi /etc/postfix/saslauthd.conf
ldap_servers: ldap://ad_server_ip:389/
ldap_search_base: dc=test,dc=com,dc=tw
ldap_auth_method: bind
ldap_version: 3
ldap_bind_dn: cn=ldap,cn=Users,dc=test,dc=com,dc=tw
ldap_bind_pw: ldappassword
ldap_filter: (sAMAccountName=%u)

8. vi /etc/postfix/ldap-aliases-inner.cf
server_host = ad_server_ip
search_base = dc=test,dc=com,dc=tw
#scope = sub
query_filter = (memberOf:1.2.840.113556.1.4.1941:=CN=%s,OU=aliases_inner,DC=test,DC=com,DC=tw)
result_attribute = mail
result_format = %s
version = 3
bind = yes
bind_dn = cn=ldap,cn=Users,dc=test,dc=com,dc=tw
bind_pw = ldappassword


			
		

如何在CentOS 6 下安裝VPN SERVER(l2tp over ipsec with pre-shared key)

如何在CentOS 6 下安裝VPN SERVER(l2tp over ipsec with pre-shared key)

1. 安裝openswan, ppp , libpcap-devel
直接用CentOS裏面即可

2. 安裝xl2tpd(1.2.8)(http://www.xelerance.com/services/software/xl2tpd/)
解開後進入該目錄,執行
make
此時已經可以看到xl2tpd這個檔案了
cp xl2tpd /usr/local/sbin/
mkdir /etc/xl2tpd
cp examples/xl2tpd.conf /etc/xl2tpd/
cp examples/ppp-options.xl2tpd /etc/ppp/options.xl2tpd (這是給以下ppp使用的 sample)

3. 安裝rp-l2tpd (彌補xl2tpd 1.2.4 無法完整編譯)
http://sourceforge.net/projects/rp-l2tp/
下載後解開,進入該目錄,後執行
./configure
make
cp handlers/l2tp-control /usr/local/sbin/
mkdir /var/run/xl2tpd
ln -s /usr/local/sbin/l2tp-control /var/run/xl2tpd/l2tp-control

4. xl2tpd 設定
修改/etc/xl2tpd/xl2tpd.conf
ip range = 您希望對方可以得到哪些ip
local ip = server 對內ip
ex:
[lns default]
ip range = 192.168.0.11-192.168.0.13
local ip = 192.168.0.1
require chap = yes
refuse pap = yes
require authentication = yes
name = LinuxVPNserver
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes

5. 修改 /etc/ppp/options.xl2tpd
ms-dns = 內部ms dns的ip
ex:
ipcp-accept-local
ipcp-accept-remote
ms-dns 192.168.0.2
noccp
auth
crtscts
idle 1800
mtu 1410
mru 1410
defaultroute
debug
lock
proxyarp
connect-delay 5000

6. ipsec 設定(預先共用金鑰)

6.1 設定 psk (pre-shared-key)
vi /etc/ipsec.d/william.secrets
###############################
%any: PSK “your shared key”
server_ip: PSK “your shared key”
###############################

其中 server_ip 是您的server 對外ip,
“your shared key”是你的共用金鑰

6.2 vi /etc/ipsec.conf
#############################################
version 2.0 # conforms to second version of ipsec.conf specification

# basic configuration
config setup
# Debug-logging controls: “none” for (almost) none, “all” for lots.
# klipsdebug=none
# plutodebug=”control parsing”
# For Red Hat Enterprise Linux and Fedora, leave protostack=netkey
protostack=netkey
nat_traversal=yes
virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12
oe=off
# Enable this if you see “failed to find any available worker”
nhelpers=0

#You may put your configuration (.conf) file in the “/etc/ipsec.d/” and uncomment this.
#include /etc/ipsec.d/*.conf
conn L2TP-PSK-NAT
rightsubnet=vhost:%priv
also=L2TP-PSK-noNAT

conn L2TP-PSK-noNAT
authby=secret
pfs=no
auto=add
keyingtries=3
rekey=no
ikelifetime=8h
keylife=1h
type=transport
left=<你的對外ip>
leftprotoport=17/1701
right=%any
rightprotoport=17/%any

############################################
7. ppp 設定
vi /etc/ppp/chap-secrets
加上
william * test *

其中william 是帳號, test是密碼

8. 修改 /etc/rc.local , 加上

8.1 開啟nat,底下192.168.0.0是內部ip範圍(eth1是您的對外網卡)
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.0/24 -j MASQUERADE

8.2 允許ip_forward
echo “1” > /proc/sys/net/ipv4/ip_forward

8.3 確認server是否自動啟動, 或是加在/etc/rc.local
/etc/rc.d/init.d/ipsec start
/usr/local/sbin/xl2tpd -D &

9. 重開機(reboot),確認是否完備

ps.
1.要驗證ipsec 請執行
ipsec verify
要記得看log,有時候會遇到不預期的情形,此時就可以看log解決
/var/log/secure
/var/log/message
2. 若還有問題,請嘗試以下設定
vi /etc/sysctl.conf
#########################################################
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.all.log_martians = 0
net.ipv4.conf.default.log_martians = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.icmp_ignore_bogus_error_responses = 1
########################################################

測試環境
linux CentOS 6
kernel 2.6.32
—————————–
windows xp client

(一) 新增連線

1. 開始->設定->網路連線->新增連線精靈

2. 選擇連線到公司網路(使用指定撥號或是vpn)

3. 選擇虛擬私人網路連線

4. 輸入名稱(可以隨意選)

5. 輸入vpn server IP

(二) 修改設定

1. 找出此VPN連線的TCP/IP設定, 選進階設定, 拿掉”使用遠端網路的預設匣道”

2. 找出”預先共用金鑰”,然後輸入PSK(pre-shared key),請看上面步驟6的金鑰密碼
3. 若是xp, 請取消勾選”要求資料加密(如果沒有加密就中斷連線)”

這樣就可以了

日期 2011.07.18
william http://fromtw.blogspot.com

奇幻文學-被遺忘的國度(Forgotten Realms) 黑暗之途-崔斯特

被遺忘的國度(Forgotten Realms)最有名的兩位人物是:
人類牧師: 凱德立
黑暗精靈遊俠: 崔斯特

本書的主角崔斯特是個善良的黑暗精靈, 身懷絕技,當他舞弄雙刀時,幾近無敵.
不過因為極力想擺脫不堪的過去, 毅然決然從幽暗地域來到地表上.

到了地表之後,歷經一連串冒險以及伴隨著善良的義舉, 他贏得了許多朋友,
也留下了永傳後世的傳說.

崔斯特冒險小隊組合:

戰士-蠻族王者”沃夫加”
崔斯特的徒弟.

戰士– 秘銀之廳矮人王”布魯諾·戰錘”
第一個接納崔斯特好朋友.

弓箭手– 人類”凱蒂布莉兒”
矮人王的養女.

神偷-半身 人”瑞吉斯”
運氣超好的神偷.

黑豹-關海法
透過黑豹雕像,
崔斯特能從”星界”招喚來的生物.
天生不怕劇毒與任何法術影響,是崔斯特的老戰友.

遊俠-黑暗精靈”崔斯特”.
雙刀是他最得意的武器, 一把曰”閃光”, 另一把號”冰亡”,也是他的招牌戰鬥武器.
這也是我最喜歡的部分,有點像布袋戲的刀狂劍痴”葉小釵”,
不過葉小釵用的是刀與劍.

這樣的冒險組合在奇幻文學裡面是很奇特少見的-超強的戰鬥力.
光是戰士就有三位,
外加一隻黑豹, 雖沒有法師佈陣, 也沒有牧師後援,
但總是無堅不摧,戰無不勝.

戰鬥過程若遇到強力法師將如何呢?
答案是不受毒與法術影響的黑豹”關海法”, 負責衝去幹掉法師.

至於牧師的法術怎麼解決呢?
崔斯特會無視牧師加註身上的痛楚或是施法未完成之前,
迅速欺身幹掉他們.

解決掉惱人的法師與牧師之後,
其他人就等著被野蠻人與矮人砍殺.
一般來說就連”眼魔”, “惡魔”,”黑暗精靈”遇見都要退避三舍.

作者薩爾瓦多描述這些義氣風發的戰鬥總是令人血脈噴張, 大快朵頤.

不過薩爾瓦多最新著作”黑暗之途”三部曲, 人物設定卻趨於平凡與合理.
野蠻人”沃夫加”居然還會被普通衛士兩三隻給撲倒,面臨死劫.

對照以前的崔斯特設定,光是同族黑暗精靈不管是牧師,法師或是戰士,寧願死也不願被派去追捕這個叛逃的族民.

薩爾瓦多過往對這個團隊描述的豐功偉業,
到現在看來皆變成神話般的遙不可及.

早先著作”黑暗精靈”三部曲, 才是薩爾瓦多對崔斯特最佳的描寫啊.

藍牙罩門UUID

關於藍芽SDP UUID解釋
需要到 www.bluetooth.org  裡面尋找有關 Service Discovery Protocol訊息

https://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm

裡面提到 UUID分成BASE UUID 128bits 與 SHORT UUID(32bits, 16bits)

BASE UUID 格式如下:
00000000-0000-1000-8000-00805F9B34FB

SHORT UUID 再分成 UUID32(2的32次方) 與 UUID16(2的16次方)

UUID32 、UUID16 都是短款的格式

為了相容以往舊款 SDP UUI D格式
在BASE UUID前32bits即是UUID32 , 接下來16bits即UUID16

因此重看BASE UUID:
00000000-0000-1000-8000-00805F9B34FB
桃紅色加上綠色為UUID32, 綠色為UUID16

接下來我們想要使用程式註冊SPP, 透過serial port連線,
根據 www.bluetooth.org 的規範, 須將UUID改成
00001101-0000-1000-8000-00805F9B34FB

檔案傳輸FileZilla的一項功能

有些中小企業,員工與外界作ftp連線的時候
通常都是各自安裝ftp軟體, 然後連線.
但是站台一多,就顯得不好管理.
因此我們可以將預設站台放到固定一個目錄,
讓大家共用.
新版filezilla(3.x以後), 站台存在一個叫做sitemanager.xml的文件
將該文件改成fzdefaults.xml, 與filezilla.exe程式放在同一目錄.
如此一來,只要所有人統一遠端執行此filezilla.exe, 即可共用站台.

ps. 這有安全的風險.

1 ... 66 67 68 69 70 ... 73