Pank: April 2004 Archives

豆漿Linux

user-pic
Vote 0 Votes

國內推出的 distrubution

http://www.doochun.org

下載
ftp://ftp.doochun.org/
ftp://ftp.tku.edu.tw/pub/Linux/distributions/DooChun/doochun-0.1/

Linux QoS: tc cbq

user-pic
Vote 0 Votes

http://www.usinglinux.org/doc/translations/zh/Adv-Routing-HOWTO.txt
http://www.fanqiang.com/a1/b1/20010811/0705001103_b.html
http://www.fanqiang.com/a1/b1/20020109/07100042_b.html
http://www.study-area.org/tips/cbq.htm
http://www.study-area.org/tips/cbq_init/cbq_init.htm

postfix relocated

user-pic
Vote 0 Votes

format
username new location Taichung

add this line to main.cf
relocated_maps = hash:/etc/postfix/relocated

to take effect
postmap /etc/postfix/relocated
postfix reload

then mail to username, system will sned a returned mail said

User has moved to new location Taichung

ClamAV

user-pic
Vote 0 Votes

http://www.clamav.netdownload http://prdownloads.sourceforge.net/clamav

command line scan tool
/usr/local/bin/clamdscan
command line scan tool, use with clamd, scan speed fast
/usr/local/bin/clamscan
virus pattern update tool
/usr/local/bin/freshclam
clamav daemon
/usr/local/sbin/clamd
lib
/usr/local/lib/libclamav.so.1 -> libclamav.so.1.0.4
/usr/local/lib/libclamav.so.1.0.4
config
/usr/local/etc/freshclam.conf
/usr/local/etc/clamav.conf
virus pattern
/usr/local/share/clamav/daily.cvd
/usr/local/share/clamav/main.cvd

use clamassassin for mail scan
http://drivel.com/clamassassin/

To pass your mail through clamassassin, add the following command to your
procmail rc file:

:0fw
| /usr/local/bin/clamassassin

If you installed the program elsewhere, change the path. The above will
scan the mesage for viruses and add the headers X-Virus-Status and
X-Virus-Report as appropriate. Procmail then continues processing the
message as normal. Nothing else will happen unless you add additional
rules to sort or discard detected viruses. To do this, you might do the
following:

:0:
* ^X-Virus-Status: Yes
IN.virus


ps. http://monkey.org/openbsd/archive/misc/0310/msg00002.html
The following are the open source antivirus solution:

(a) Open Antivirus
http://www.openantivirus.org

(b) Clam AV
http://clamav.elektrapro.com

(c) Trophie
http://www.vanja.com/tools/trophie/
(based on Trend Micro Virus scanning engine library)

(d) Sophie
http://www.vanja.com/tools/sophie/
(based on Sophos SAVI AV interface)

Google 改 UTF-8 編碼

user-pic
Vote 0 Votes

Google 最近改用 UTF-8 編碼
以前可以用
http://www.google.com/search?q=XXX 查詢
現在直接用這樣使用中文會有亂碼

現在要改成
http://google.com/search?hl=zh-TW&ie=Big5&q=%s
or (搜尋繁體中文)
http://google.com/search?hl=zh-TW&ie=Big5&lr=lang_zh-TW&q=%s
有用 MyIE2 的人可以到設定中心/快速搜尋裡面修改 * 的對應

DNS wildcard setting

user-pic
Vote 0 Votes

*.test IN A 140.117.53.147

就這麼簡單
試過 bind, maradns 都可以適用

MSN 6.2 fix

user-pic
Vote 0 Votes

Patch program for version 6.2.x download
Patch program for version 6.x all version download

// Multi-Open
Find 0F 85 9C 00 00 00 6A
Edit 90 E9 -- -- -- -- --

// No-Ad set 1/3
/*
Find E8 ?? FD FF FF 53 68
Edit 90 90 90 90 90 -- --
*/
Find FD FF FF 53 68
Edit 90 90 90 -- --
再往前推 2 bytes, change to 90

// No-Ad set 2/3
Find 3B CB 74 07 6A 01 E8 (3 found, but only change 1st one)
Edit -- -- EB -- -- -- --

// No-Ad set 3/3
Find 74 21 57 57
Edit EB -- -- --

Clear MBR in linux

user-pic
Vote 0 Votes

MBR 長度是前 446 bytes, 把它清空就是相當於 fdisk/mbr

dd if=/dev/zero of=/dev/hda bs=446 count=1

postfix anti-spam

user-pic
Vote 0 Votes

dump, restore

user-pic
Vote 0 Votes

backup:
dump -0ua -f {dumpfile} {device}

restore:
restore -r -f {dumpfile}
restore -i -f {dumpfile}
(-i interactive)

mktemp, mkstemp

user-pic
Vote 0 Votes

template 最後要是 XXXXXX
mktemp 有安全性問題, 不要使用, man mktemp BUG 段, 需使用 mkstemp


char temp[]="/tmp/temp-XXXXXX";
mkstemp(temp);

線上電視

user-pic
Vote 0 Votes

# fdisk -l /dev/hdb

Disk /dev/hdb: 3228 MB, 3228696576 bytes
16 heads, 63 sectors/track, 6256 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 6256 3152992+ a5 FreeBSD

# ls -l /dev/ide/host0/bus0/target1/lun0/
total 0
brw------- 1 root root 3, 64 1月 1 1970 disc
brw------- 1 root root 3, 65 1月 1 1970 part1
brw------- 1 root root 3, 69 1月 1 1970 part5
brw------- 1 root root 3, 70 1月 1 1970 part6

# mount -t ufs -o ufstype=44bsd,ro /dev/hdb1 /mnt

ref. http://lists.debian.org/debian-user/2002/debian-user-200205/msg04381.html

poptop

user-pic
Vote 0 Votes

http://www.poptop.org/

tar zxvf pptpd-1.1.4-b4.tar.gz
cd pptpd-1.1.4-b4
./configure&&make&&make install

edit /etc/pptpd.conf
# localip 是 server 的內部 IP
localip 192.168.0.2
# remoteip 配給 vpn client 的 IP
remoteip 192.168.0.20-30
pidfile /var/run/pptpd.pid

if have firewall, add
iptables -A INPUT -p gre -j ACCEPT
iptables -A INPUT -p tcp --dport 1723 -j ACCEPT

/etc/ppp/chap-secrets
#帳號 servername 密碼 IP
test pank.org 1111 *

以上設定完成

windows 在新增 VPN 連線後
[內容]-[安全性]->要求資料加密 的選項不要打勾

Softether

user-pic
Vote 0 Votes

http://www.softether.com/

前幾個月有看到這個軟體, 當時沒有很注意, 剛剛翻了翻相關文件,
這真是劃時代的軟體, 經由虛擬 hub , 可以連到 firewall 下的電腦,
firewall 下的電腦, 連上虛擬 hub 後, 再也不受到任何現制.
令人振奮亦令人震驚!
衍生問題是系統安全性的問題, 舉個例子: 只要有人在公司內部裝這個軟體供外面連入,
外面的人就可以直接穿過 firewall 對公司內部電腦進行存取.

linux 版 virtual hub 安裝方法
ref. http://www.softether.com/jp/linux/
wget http://www.softether.com/jp/download/se_101_linux.zip
unzip se_101_linux.zip
gcc se_hub.a -lpthread -lssl -lcrypto -o se_hub
./se_hub &
(ca.crt, ca.key 需在 se_hub 同一個目錄)

管理
telnet localhost 8023
第一次會讓你設定密碼, 爾後請輸入密碼登入
------------------------------------------------------------
SoftEther Virtual HUB Administration Console 1.00

Copyright (C) 1997-2004 Daiyuu Nobori, All Rights Reserved.
------------------------------------------------------------

http://www.softether.com/

Note: Please use Microsoft Telnet Client (telnet.exe).

Please enter Administrator Password.

Password :


ref. http://shoppingguide.ithome.com.tw/special/special2004-05-25-002.html
利用弱點稽核軟體,檢查哪些主機有安裝SoftEther;防火牆可以從連結的主機那裡偵測到標示「SoftEther Protocol」的字串,了解哪些人正在使用SoftEther;SoftEther的作者表示,未來將開發檢查區域網路內是否有人在使用SoftEther的軟體。

古坑咖啡

user-pic
Vote 0 Votes

大潤發最近農產品特賣會有賣,
買了幾盒(129/盒)
還不錯, 喝起很順口
http://www.kuper.com.tw/

平時也可到古坑鄉農會訂購

FTP client file size limit

user-pic
Vote 0 Votes

現在動不動就是上 G 的檔案, 很多軟體都會出現這個問題
無法處理 size > 2147483647 的檔案(long integer)
剛剛用 ncftp 試圖要傳一個 2.8G 的檔, 就掛了

Solution:
1. 抓官方 binary distributions
2. 自行 make with -D_LARGEFILE_SOURCE

bind - delegate a sub domain

user-pic
Vote 0 Votes

sub IN NS ns.sub.pank.org.
ns.sub IN A 61.220.92.130

Email format RFC 822

user-pic
Vote 0 Votes

RFC # 822
STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES

http://www.ietf.org/rfc/rfc0822.txt

NCTU's NTP server

user-pic
Vote 0 Votes

140.113.1.1

fetchyahoo & yahoopops

user-pic
Vote 0 Votes

http://fetchyahoo.sourceforge.net/
需安裝下列 RPM (以 mdk 9.2 為例)
perl-Crypt-SSLeay-0.49-1mdk.i586.rpm
perl-IO-stringy-2.108-4mdk.noarch.rpm
perl-MailTools-1.58-1mdk.noarch.rpm
perl-MIME-tools-5.411-4mdk.noarch.rpm

Usage:
fetchyahoo --username=username --password=password --spoolfile=/var/mail/username

http://yahoopops.sourceforge.net/
台灣 yahoo 不能收, 必須英文 YAHOO 的個人設定網頁登入,再編輯你的會員資料,將你的使用語言改成 English-US 後儲存設定
或用下面這個修正(for windows)
http://myweb.hinet.net/home5/daemon9/YahooPOPs-0.5-tw.htm

for windows
在 Mail Client 把 SMTP server 設成 localhost, pop

for linux
YAHOOPOPS_PORTNUMBER 5058
YAHOO_SMTP_PORT 5059
在 Mail Client 把 SMTP server 設成 localhost, port 為 5058

Pure Project

user-pic
Vote 0 Votes

Share the pure power - PureBASIC open source website
http://pureproject.reelmedia.org

VB, ASP open source website
http://www.pscode.com/

Postfix-SMTP-AUTH-TLS-Howto

user-pic
Vote 0 Votes

http://www.projektfarm.com/en/support/howto/postfix_smtp_auth_tls.html
大部分的分件都沒有提到 TLS 需要 patch, 這篇文章寫得滿仔細的

以下是整理過的步驟

取得檔案( 原文中有些 URL 已無效)
wget http://www.openssl.org/source/openssl-0.9.7c.tar.gz
wget ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.18.tar.gz
wget ftp://ftp.aet.tu-cottbus.de/pub/postfix_tls/related/postfix/postfix-2.0.18.tar.gz
wget ftp://ftp.aet.tu-cottbus.de/pub/postfix_tls/pfixtls-0.8.16-2.0.18-0.9.7c.tar.gz

解壓檔案
tar zxf openssl-0.9.7c.tar.gz
tar zxf cyrus-sasl-2.1.18.tar.gz
tar zxf postfix-2.0.18.tar.gz
tar zxf pfixtls-0.8.16-2.0.16-0.9.7b.tar.gz

編譯 openssl
cd openssl-0.9.7c
./config
make
make install

編譯 cyrus-sasl-2
cd ../cyrus-sasl-2.1.18
./configure --enable-anon --enable-plain --enable-login --with-saslauthd=/var/run/saslauthd --with-pam --with-openssl=/usr/local/ssl --with-plugindir=/usr/local/lib/sasl2 --enable-cram --enable-digest
make
make install

[ -d /usr/lib/sasl2 ] && mv /usr/lib/sasl2 /usr/lib/sasl2_orig
ln -s /usr/local/lib/sasl2 /usr/lib/sasl2
printf "pwcheck_method:saslauthd\nmech_list: plain login digest-md5\n" > /usr/local/lib/sasl2/smtpd.conf

編譯 postfix (含 tls patch)
cd ../postfix-2.0.18
useradd postfix
groupadd postdrop
patch -p1 < ../pfixtls-0.8.16-2.0.18-0.9.7c/pfixtls.diff
make makefiles CCARGS="-DHAS_SSL -DUSE_SASL_AUTH -I/usr/local/include/sasl -I/usr/local/ssl/include" AUXLIBS="-L/usr/local/ssl/lib -L/usr/local/lib -R/usr/local/lib -lsasl2 -lssl -lcrypto"
make
make install
cp /etc/postfix/aliases /etc/
newaliases
mkdir -p /var/spool/postfix/etc
cd /etc
cp localtime services hosts resolv.conf /var/spool/postfix/etc
mkdir -p /var/spool/postfix/var/run/saslauthd
chmod 755 /var/spool/postfix/var/run/saslauthd
ln -s /var/spool/postfix/var/run/saslauthd /var/run/saslauthd

產生 certificate files for TLS
cd /etc/postfix
openssl req -new -x509 -nodes -out smtpd.pem -keyout smtpd.pem -days 3650

編輯 /etc/postfix/main.cf 加入下列
# SASL
smtpd_sasl_auth_enable=yes
smtpd_recipient_restrictions=permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_security_options=noanonymous
broken_sasl_auth_clients=yes
# TLS
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /etc/postfix/smtpd.pem
smtpd_tls_cert_file = /etc/postfix/smtpd.pem
smtpd_tls_CAfile = /etc/postfix/smtpd.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom

啟動 postfix 及 saslauthd
postfix start
saslauthd -a shadow

測試
telnet localhost 25

220 pank.idv.tw ESMTP Postfix
ehlo 0
250-pank.idv.tw
250-PIPELINING
250-SIZE 10485760
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN DIGEST-MD5
250-AUTH=LOGIN PLAIN DIGEST-MD5
250-XVERP
250 8BITMIME

看起來正常, 再測試認證, 使用者名稱 pank, 密碼 test
取得編碼後字串 printf 'pank\0pank\0test' | mmencode
得到 cGFuawBwYW5rAHRlc3Q=
(使用這個方法測試時, 用數字 0-7 開頭的密碼會認證錯誤, 原因不明.
而事實上, 使用上述密碼在 smtp auth 上是沒問題的)

telnet localhost 25

220 pank.idv.tw ESMTP Postfix
ehlo 0
250-pank.idv.tw
250-PIPELINING
250-SIZE 10485760
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN DIGEST-MD5
250-AUTH=LOGIN PLAIN DIGEST-MD5
250-XVERP
250 8BITMIME
auth plain cGFuawBwYW5rAHRlc3Q=
235 Authentication successful

已正常運作

若是 failed, 就看 log 查原因

ref. Postfix/TLS - A TLS extension for POSTFIX

Sticky bit

user-pic
Vote 0 Votes

http://www.study-area.net/linux/system/linux_fs.htm

1﹐則為檔案設上一個特殊標籤﹕sticky bit (黏著位元)﹐當這個標籤打開的時候﹐只有檔
案的擁有者才能刪除這個檔案(root 除外)﹐其它使用者就算具有 w 的權限﹐也只能修改檔
案的內容﹐而不能將檔案刪除。如果一個目錄具有這個位元﹐那麼其下所建立的檔案﹐也具
有這個屬性。

./configure --with-virtualchroot
此參數讓 link 不受 chroot 的限制, 好用
http://www.pureftpd.org/README

--with-virtualchroot: usually, when an user is chrooted (-A and -a
options), it's impossible to go out of his home directory. Enabling that
feature makes it possible: symbolic links are always followed, even if they
are pointing to directories not located in the user's home directory. This
is very useful for having shared directories (for instance, have a symbolic
link to /var/incoming in every home directory) .
This feature isn't enabled by default.

./configure --with-sysquotas
使用系統 quota

網路轉寄信件的力量

user-pic
Vote 0 Votes

不久前學長在 BBS post 一篇"阿寶上廁所被偷拍"的文章, 內容則是他家狗狗的照片
結果不知被誰轉出去, 變成網路上熱門轉寄的郵件
目前主機 log 顯示已被存取 71萬次!

====
阿寶上廁所被偷拍!!
應該是本人沒錯~~看看ㄅㄟ

http://denny.77bbs.com/bao.htm
====

chattr

user-pic
Vote 0 Votes

i 屬性 Immutable, 無法刪除或改變
a 屬性 Append only

ex.
chattr -R +i /bin /boot /etc /lib /sbin
chattr -R +i /usr/bin /usr/include /usr/lib /usr/sbin
chattr +a /var/log/messages /var/log/secure

國道全圖

user-pic
Vote 0 Votes

http://blog.elixus.org/acer/archives/000238.html

現在的問題比較簡單,mt對中文的支援似乎有問題,當我產生一個新的中文entry之後,如果想進行對這個entry編輯的動作,所有的中文都會變成亂碼。這對我這種經常對自己寫的文章修修改改的傢伙是相當不方便的,不知道有沒有什麼解決的辦法?
Posted by: johnnykao at December 2, 2002 11:29 PM from 140.135.196.35

在mt.cfg裡面,第198行前面的#去掉
變成 NoHTMLEntities 1
還有,第252行,改成 PublishCharset big5
(如果你用big5的話)或是UTF-8(如果你用UTF-8的話)

postfix transport

user-pic
Vote 0 Votes

例一
Server test.pank.org
MX 設到 tecoia.com.tw
Server tecoia.com.tw
mydestination 設上 test.pank.org
transport 檔設 test.pank.org smtp:[pank.org] ([] disable MX lookup)
postmap /etc/postfix/transport

信件就會先經過 tecoia.com.tw (可做過濾掃毒等動作), 再送到 test.pank.org

relay 的應用
bbs.fcu.edu.tw relay:[mail.nsysu.edu.tw]

要送到 someone@bbs.fcu.edu.tw 的信件, 會 relay 給 mail.nsysu.edu.tw

例二
所有的信送給上游 smtp, 除了本身及 server6.com.tw
server6.com.tw :
teco-ia.com.tw :
* :[ms1.hinet.net]

ps. 有異動需執行 postmap transport 及 postfix reload 動作

顯示昨天日期

user-pic
Vote 0 Votes

FreeBSD date -v -1d
Linux date -d yesterday

Microsoft Windows Memory Diagnostic
微軟出的免費記憶體測試工具, 可以做出 floppy 或 CD 開機測試片.
開機後會持續燒機測試, 直到按 X 鍵退出或關機.

About this Archive

This page is an archive of recent entries written by Pank in April 2004.

Pank: March 2004 is the previous archive.

Pank: May 2004 is the next archive.

Find recent content on the main index or look in the archives to find all content.