2012年9月24日 星期一
httpd 使用 mod_jk 時設 no-cache 的方式
<LocationMatch "^.*$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header unset Etag
Header unset Last-Modified
Header always set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header always set Pragma "no-cache"
Header always set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</LocationMatch>
不可以用 filesMatch
因為用 mod_jk 的時候 apache 並不是真的去找檔案。
2012年9月7日 星期五
Linux iptables
列出所有 rule
iptables -L -n
iptables-save
刪除某條規則
......
-A INPUT -j ACCEPT
......
可以
iptables -D INPUT -j ACCEPT
存檔
/etc/init.d/iptables save
see /etc/sysconfig/iptables
iptables -L -n
iptables-save
刪除某條規則
......
-A INPUT -j ACCEPT
......
可以
iptables -D INPUT -j ACCEPT
存檔
/etc/init.d/iptables save
see /etc/sysconfig/iptables
2012年9月6日 星期四
CENTOS minimal NFS
預設沒有
yum -y install nfs-utils nfs-utils-lib
# /etc/init.d/rpcbind start設定開機時啟動
# chkconfig --level 3 rpcbind on
自己安裝
然後要記得開 rpcbind
然後要記得開 rpcbind
# /etc/init.d/rpcbind start設定開機時啟動
# chkconfig --level 3 rpcbind on
使用 logrotate 處理 log rotate
使用 yum 安裝 logrotate
設定檔在 /etc/logrotate.conf ,
不同的設定檔放在 /etc/logrotate.d/ tomcat
原廠推荐的三種處理 catalina.out 的方式之一
(不過log.properties 裡面已經設定 daily rotate了)
* tomcat 要用 copytruncate 的方式
daily 每天整理,其他還有 weekly, monthly, yearly
missingok 允許 log 檔不存在
nomissingok 不允許 log 檔不存在,會丟出錯誤 (預設)
rotate 7 保留 7 次的分割
size 1M 大小超過 1M 就執行分割,單位可以是 1024, 100k, 4M, 1G
dateext 用日期來建立分割檔名,而非流水號
dateformat -%Y%m%d 日期格式
compress 壓縮分割,預設用 gzip (預設)
nocompress 不壓縮分割
delaycompress 延後壓縮直到下一次 rotate
notifempty 如果 log 是空的就不執行
copytruncate 以[複製清空]的方式分割 log,這樣可以用不到 postrotate 設定
mail xxx@address 將分割內容用 mail 寄出
prerotate/endscript 分割前要執行的指令
postrotate/endscript 分割後要執行的指令
Ref
http://jax-work-archive.blogspot.tw/2012/09/ubuntu-logrotate-apache-log.html
http://blog.jsdan.com/3616
設定檔在 /etc/logrotate.conf ,
不同的設定檔放在 /etc/logrotate.d/ tomcat
原廠推荐的三種處理 catalina.out 的方式之一
(不過log.properties 裡面已經設定 daily rotate了)
* tomcat 要用 copytruncate 的方式
daily 每天整理,其他還有 weekly, monthly, yearly
missingok 允許 log 檔不存在
nomissingok 不允許 log 檔不存在,會丟出錯誤 (預設)
rotate 7 保留 7 次的分割
size 1M 大小超過 1M 就執行分割,單位可以是 1024, 100k, 4M, 1G
dateext 用日期來建立分割檔名,而非流水號
dateformat -%Y%m%d 日期格式
compress 壓縮分割,預設用 gzip (預設)
nocompress 不壓縮分割
delaycompress 延後壓縮直到下一次 rotate
notifempty 如果 log 是空的就不執行
copytruncate 以[複製清空]的方式分割 log,這樣可以用不到 postrotate 設定
mail xxx@address 將分割內容用 mail 寄出
prerotate/endscript 分割前要執行的指令
postrotate/endscript 分割後要執行的指令
Ref
http://jax-work-archive.blogspot.tw/2012/09/ubuntu-logrotate-apache-log.html
http://blog.jsdan.com/3616
2012年5月3日 星期四
CENTOS 使用 OpenLDAP PAM
參見
yum install openldap-servers openldap-clients nss-pam-ldapd
** 單純 client 只要 openldap-clients nss-pam-ldapd 就可以了
cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
vi /etc/openldap/ldap.conf
加入URI ldap://127.0.0.1
BASE o=XXX, c=XXX
cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
slappasswd
New password:
Re-enter new password:
{SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
vi /etc/openldap/slapd.conf
:%s/dc=my-domain/dc=mycompany/g
rootpw {SSHA}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
vi /root/root.ldif
rm -rf /etc/openldap/slapd.d/*
slapadd -n 2 -l /root/root.ldif
slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
chown -R ldap:ldap /var/lib/ldap
chown -R ldap:ldap /etc/openldap/slapd.d
chkconfig slapd on
service slapd start
日後若變更 slapd.conf 內容, 則:
rm -rf /etc/openldap/slapd.d/*
slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
chown -R ldap:ldap /etc/openldap/slapd.d
service slapd restart
***** CENTOS6 要求 LDAP 要 TLS
vim /etc/sysconfig/authconfi
FORCELEGACY=yes
***** geocs 無法使用中文
主因是schema中定義
attributetype ( 1.3.6.1.1.1.1.2 NAME 'gecos'
DESC 'The GECOS field; the common name'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
只要改成attributetype ( 1.3.6.1.1.1.1.2 NAME 'gecos'
DESC 'The GECOS field; the common name'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
就可以了。依照RFC 2252原本的gecos定義1.3.6.1.4.1.1466.115.121.1.26是IA5 String,改成1.3.6.1.4.1.1466.115.121.1.15的Directory String。
RFC中6.10. Directory String提到Directory String是使用UTF-8編碼的字串。但是6.15. IA5 String指出IA5 String只能使用字串本身的編碼,也就是ASCII 0-127。可參考維基上的IA5STRING。
Ref
*****
DB_KEYEXIST: Key/data pair already exists (-30995)
rm -rf /var/lib/ldap/*
warning - no DB_CONFIG file found in directory /var/lib/ldap: (2).
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
*****
(1) Geographic naming,例:suffix "o=組織名稱, c=國家名稱簡寫"
(2) Domain-based Naming,例:suffix "dc=組織名稱(簡稱), dc=網路域名"
*****
(1) Geographic naming,例:suffix "o=組織名稱, c=國家名稱簡寫"
(2) Domain-based Naming,例:suffix "dc=組織名稱(簡稱), dc=網路域名"
RFC 2253 LDAPv3 Distinguished Names
dn: distinguished name
cn: common name
l: locality name
st: state or provinceName
o: organizationalName
ou: organizationalUnitName
c: countryName
street: streetAddress
dc: domain component
uid: user id
cn: common name
l: locality name
st: state or provinceName
o: organizationalName
ou: organizationalUnitName
c: countryName
street: streetAddress
dc: domain component
uid: user id
訂閱:
文章 (Atom)