• Twitter
  • rss
  • facebook

緊隨 ROOTLAU.COM 的最新消息和資訊

如何改變VirtualBox VDI的UUID/ How to Change UUID of VDI files

(0)

Category : I.T.

先做好一個Windows XP的vdi,再複製一份VDI要分別做Office 2000和Office 2003的VM,出現UUID重覆的訊息,要如何處理呢?

“c:\Program Files\Oracle\VirtualBox\VBoxManage.exe” internalcommands sethduuid 檔案名稱

就這麼簡單,收工!

I made a Windows XP vm, copy the VDI file for other VM,alert “hard disk with UUID is already registered.”
You can do this way:

“c:\Program Files\Oracle\VirtualBox\VBoxManage.exe” internalcommands sethduuid [filename]

That’s it!

OpenLDAP-Postfix With SASL2 SMTP Auth 設定

(0)

Category : I.T., Linux

前言

談到 [E-Mail] 就不得不提一下這三個名詞 [MTA][MDA][MUA],關於 [E-Mail] 從使用者發信到收信如何運作可參考 [ twbsd.org - Wang, Chun-Pin 第十六章 郵件伺服器圖解] 了解。

  • MTAMail Transfer Agent:郵件轉送代理人,負責傳送、轉送郵件 (Relay),如:[Sendmail][Postfix][Qmail]
  • MDAMail Delivery Agent:郵件遞送代理人,負責把進來的郵件遞送、過濾到使用者信箱內,如:[Procmail][MailDrop]
  • MUAMail User Agent:郵件使用者代理人,使用者用來發信、收信的程式,如:[Outlook Express][SquirrelMail]

E-Mail 相關服務聆聽埠號 (Listen Port)

  • [SMTP]:25
    • SMTPs (SMTP Over SSL):465
  • [POP3]:110
    • POP3s (POP3 Over SSL):995
  • [IMAP]:143
    • IMAPs (IMAP Over SSL):993

實作環境

  • FreeBSD 6.1-STABLE
  • postfix-2.3.1,1
  • cyrus-sasl-saslauthd-2.1.22

安裝及設定

步驟1.安裝 Postfix 套件

切換至 Ports Tree 路徑安裝 postfix 套件

 #cd /usr/ports/mail/postfix      //切換至套件路徑
 #make install clean              //安裝 postfix 並勾選下列項目
 [X] PCRE      Perl Compatible Regular Expressions   
 [X] SASL2     Cyrus SASLv2 (Simple Auth. and Sec. Layer)   
 [X] TLS       Enable SSL and TLS support                    
 [X] BDB       Berkeley DB (choose version with WITH_BDB_VER)   
 [X] OPENLDAP  OpenLDAP maps (choose ver. with WITH_OPENLDAP_VER)

安裝途中將會尋問二個問題

 1.You need user "postfix" added to group "mail".Would you like me to add it [y]? y   //是否將 postfix 加入 mail 群組,此例回答 y
 2.Would you like to activate Postfix in /etc/mail/mailer.conf [n]? y                 //是否在 /etc/mail/mailer.conf 中啟動 Postfix,此例回答 y

安裝完後系統還會貼心的提醒說 如果使用 SASL 認證的方式,必須確定 postfix 這個代理使用者有權力讀取 sasldb 的檔案

 If you are using SASL, you need to make sure that postfix has access to read the sasldb file.
 This is accomplished by adding postfix to group mail and making the /usr/local/etc/sasldb* file(s) readable by group mail (this shouldbe the default for new installs).

步驟2.設定 Postfix 能讀取 SASL 設定檔

查看 SASL 設定檔知道其擁有人 (owner) 及群組 (groups) 為 cyrus 因此我們將 postfix 加入此群組 (cyrus) 內,以便屆時 postifx 服務能順利讀取 SASL 設定檔。

 #ls -l /usr/local/etc/sasldb*                    //查看 sasldb 權限
 -rw-r-----  1 cyrus  mail  16384  7 27 11:36 /usr/local/etc/sasldb2.db

修改群組 (group) 檔案將 postfix 加入 cyrus 群組

 #vi /etc/group                                   //修改群組檔案
 cyrus:*:60:postfix                               //將 postfix 加入 cyurs 群組內

步驟3.安裝 Cyrus-Sasl2-Saslauthd 套件

切換至 Ports Tree 路徑安裝 Cyrus-Sasl2-Saslauthd 套件

 #cd /usr/ports/security/cyrus-sasl2-saslauthd    //切換至套件路徑
 #make install clean                              //安裝 SASL2 套件

安裝完後系統仍貼心提醒你要使用 SASL 功能記得在 rc.conf 內加上 saslauthd_enable=”YES”

 To run saslauthd from startup, add saslauthd_enable="YES" in your /etc/rc.conf.

步驟4.檢查 /etc/master.passwd 及 /etc/group

由於安裝 postfix 時系統會新增 postfix 這個使用者及群組,但這樣的動作將會我們破壞我們在 OpenLDAP-PAM NSS 設定 這篇的設定,因此記得修改回來吧!! (否則將造成登入失敗)

修改系統使用者密碼及群組檔案,將認證部份導至 LDAP

 #vipw
 postfix:*:125:125::0:0:Postfix Mail System:/var/spool/postfix:/usr/sbin/nologin
 +:*::::::::                //確保此行在最後一行
 #vim /etc/group
 postfix:*:125:
 +:*:0:                     //確保此行在最後一行

步驟5.修改 /etc/rc.conf

修改 /etc/rc.conf 加入啟動相關服務設定,以便系統重新開機時能自動帶起 Postfix、SASL 服務,由於我們 [MTA] 採用 Postfix 所以記得將 Sendmail 服務關閉。

 #vi /etc/rc.conf
 sendmail_enable="NO"       //關閉 Sendmail
 postfix_enable="YES"       //啟動 Postfix 服務
 saslauthd_enable="YES"     //啟動 SASL 服務

關於 Sendmail 於 rc.conf 內設定 None、No、Yes 意義?

  1. None:將 Sendmail 完全關閉
  2. NO:Sendmail 只監聽 Localhost (127.0.0.1:25)
  3. YES:啟用 Sendmail

步驟6.建立 smtpd.conf

修改 SMTP 設定檔

 #vi /usr/local/lib/sasl2/smtpd.conf                        //修改 SMTP 設定檔
 pwcheck_method: saslauthd                                  //修改認證方法
 mech_list: plain login cram-md5 digest-md5                 //修改認證方式

步驟7.修改 postfix 設定檔 main.cf

修改 Postfix 設定檔 main.cf,以下僅列出基本設定 (即僅列出修改項目)

 myhostname = mail.weithenn.org
 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
 mynetworks_style = subnet
 mynetworks = 192.168.1.0/24, 127.0.0.0/8, 61.60.59.58/32   //指定 LAN 網段及 Public IP
 alias_maps = hash:/usr/local/etc/postfix/aliases           //預設使用 /etc/aliases
 home_mailbox = Maildir/                                    //採用 MailDir 方式收取 E-Mail

啟動 Authenticated Relay 功能

 broken_sasl_auth_clients = yes
 smtpd_sasl_auth_enable = yes
 smtpd_sasl_security_options = noanonymous
 smtpd_sasl_local_domain = $myhostname
 smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_relay_domains,
 smtpd_client_restrictions = permit_sasl_authenticated

步驟8.建立別名 (Aliases) 資料庫

建立 E-Mail 別名 (Aliases) 資料庫也就是產生 /usr/local/etc/postfix/aliases.db 檔案鍵入如下指令即可,或執行 newaliases 指令。

 #postalias /usr/local/etc/postfix/aliases

步驟9.停止/啟動相關服務

由於我們 [MTA] 採用 Postfix 所以在啟動 Postfix 服務以前記得先將 Sendmail 服務關閉。

 #/etc/rc.d/sendmail stop                     //停止 Sendmail 服務 
 Stopping sendmail_submit.
 #/usr/local/etc/rc.d/postfix start           //啟動 Postfix 服務
 postfix/postfix-script: starting the Postfix mail system
 #/usr/local/etc/rc.d/saslauthd start         //啟動 SASL 服務
 Starting saslauthd.

步驟10.測試 SMTP Auth 功能

Postfix 及 SASL 服務成功啟動後可依如下方式來測試 SMTP Authentication 機制是否作用了

 #telnet localhost 25                         //連結至本機 SMTP
 Trying ::1...
 Trying 127.0.0.1...
 Connected to localhost.weithenn.org.      
 Escape character is '^]'.
 220 mail.weithenn.org ESMTP Postfix          //若前述步驟未執行 postalias 將不會出現此行也就是 postfix 啟動但卻找不到 DB
 ehlo localhost                               //測試 SASL 機制 (此行為自行輸入)
 250-mail.weithenn.org
 250-PIPELINING
 250-SIZE 10240000
 250-VRFY
 250-ETRN
 250-AUTH LOGIN PLAIN DIGEST-MD5 CRAM-MD5     //主機回應 SMTP AUTH LOGIN 成功
 250-AUTH=LOGIN PLAIN DIGEST-MD5 CRAM-MD5     
 250-ENHANCEDSTATUSCODES
 250-8BITMIME
 250 DSN
 quit                                         //離開 (此行為自行輸入)
 221 2.0.0 Bye
 Connection closed by foreign host.

若使用的 [MUA] 為 Outlook Express 則請勾選 我的伺服器需要驗證 項目才能順利使用 Outlook Express 發送信件,如下圖所示

Outlook Express - 我的伺服器需要驗證

當 [MUA] 通過 SASL 驗證機制寄信成功 Maillog 訊息,類似如下

 Aug 26 13:57:42 ldap postfix/smtpd[51569]: 8722B5C3A: client=weithenn.lan.home[192.168.1.11], sasl_method=LOGIN, sasl_username=weithenn@weithenn.org



轉載自:http://www.weithenn.org/cgi-bin/wiki.pl?OpenLDAP-Postfix_With_SASL2_SMTP_Auth_%E8%A8%AD%E5%AE%9A#Heading15

网易免费企业邮 / 域名邮箱 IMAP 设置

(0)

Category : I.T.

网易免费邮箱(126、163、Yeah.net)在国内较早推出支持 IMAP 的免费邮箱,大家已非常了解,另外网易的免费企业邮 / 域名邮箱也是支持 IMAP 的,但网易免费企业邮的首页都没有推介和介绍,所以很多人不知道免费企业邮也有对这个功能的支持。

相关参数如下:

接收服务器 imap.ym.163.com,端口 993, 服务器要求安全连接(SSL 接收所有证书);发信服务器smtp.ym.163.com,端口 465 或者 994, 服务器要求安全连接(SSL)。

支持 IMAP 的邮件客户端有 Outlook Express (Windows)、Outlook 2003 (Windows)、Outlook 2007 (Windows)、Apple Mail 2、Apple Mail 3、Apple Mail 4、Windows Mail、Thunderbird 2、Thunderbird 3 等。

另外 Android、iPhone、黑莓手机、Palm webOS、Symbian、Windows Mobile 5、Windows Mobile 6、SnapperMail 等移动设备也支持 IMAP 收发邮件。

 

Restore file association settings and default icons to Windows XP

(0)

Category : I.T.

Go to Start/Run and type in:

regsvr32 shimgvw.dll or regsvr32 /i  shimgvw.dll

Added info:

Manually Edit: Right Click On image file. Choose Open With, then Choose Program. Select your favorite image viewer program. Check the “always use selected program” box Click OK.

To get a new copy:

EXPAND X:\i386\shimgvw.dl_ C:\Windows\system32\shimgvw.dll

http://www.tomshardware.com/forum/22592-45-restore-file-association-settings-default-icons

AVG 誤報 userenv.dll 為木馬病毒

(0)

Category : I.T.

AVG 大誤判

一早就連續接到幾通 AVG 抓到 c:\windows\system32\userenv.dll 有木馬的電話,本來接到第一通還問他昨天是不是有用隨身碟或是下載什麼程式,等到接到第二通、第三通就直覺應該是誤判,於是趕緊打開自己的電腦果然出現一樣的警示:

找到特洛伊木馬 Downloader.Generic8.8RZC

"AVG

出現這個請直接【忽略】就好,只是會一直出現很煩耶!

或者是這個,請不要按「移除所選的感染檔案」或是「移除所有未修復的感染檔案」,直接按【關閉】就好了。

"AVG

已經無法開機了怎麼辦?

如果你已經整台電腦掃毒然後 AVG 告訴你要重開機你也照辦了,那看到這篇就有一點太晚了,因為你的電腦應該已經無法開機了!

遇到這種情形也還不到重灌的地步,只要把被 AVG 防毒殺掉的 userenv.dll 補回去就正常了,但是你要有可以開機的光碟才能作這件事。

我是習慣用 XPE 來救,但是因為不是合法的版權所以不方便在這裡提供,請你自行用搜尋引擎找找看有沒有下載點,另外你也可以試試看用 Ubuntu Live CD 開機,然後將 userenv.dll 複製到 c:\windows\system32 即可。

沒有 userenv.dll 的話,這裡有提供 userenv.dll的壓縮檔 可以下載,這是WinXP SP3的版本,其他的請自行設法從別台電腦取得。

這個問題應該在新的病毒碼出來之後就會消失了,但就怕已經很多人已經中招無法開機了 XD

2009/09/18 10:30PM 更新

更新最新版的病毒碼之後這一次的誤報事件算是落幕了,請你檢查一下你的病毒琰是不是已經升級到 2380,如果還沒的話快手動更新一下就不會再出現誤判警告了。

"AVG

AVG 免費版防毒軟體:http://www.avgtaiwan.com

AVG 誤判官方討論串:http://forums.avg.com

userenv.dll 檔案下載:http://www.dll-files.com/dllindex/dll-files.shtml?userenv

在 Linux 的 shell 上搜尋文字並替代

Comments Off

Category : I.T., Linux

今天真的忙過死去活來!在決定放棄使用 Pacific Internet 的寬頻而改用 PCCW 的一刻,已經知道會有這一天的來臨‧‧‧ 無耐 Pacific Internet 實在不爭氣,連我這個 Reseller Partner 也要‧‧‧

接著就是要將我的 Servers (幾部) 的網絡設定,DNS,HTTPD,SENDMAIL,‧‧‧ 全部也要將 IP 更換下來,痛苦‧‧‧

幸好徙網路上找到了一個可以將文字更換的程式,工作就可以比較輕鬆地完成!

#!/bin/bash
#       This script will search and replace all regular files for a string
#       supplied by the user and replace it with another string.
#
#       Written by Daniel McCarthy
# daniel.mccarthy@linuxphile.org
#
function usage {
echo “”
echo “Search/replace script”
echo ”    Written by Daniel McCarthy”
echo ” daniel.mccarthy@linuxphile.org”
echo ” http ://linuxphile.org”
echo “”
echo “Not enough parameters provided.”
echo “Usage: ./$0 searchstring replacestring”
echo “Remember to escape any special characters in the searchstring or the replacestring”
echo “”
}

#check for required parameters
if  [ ${ #1 } -gt 0  ]  &&  [ ${ #2 } -gt 0  ];
then
for f in `find  -type f`;
do
if grep -q $1 $f;
then
cp $f $f.bak
echo “The string $1 will be replaced with $2 in $f”
sed s/$1/$2/g < $f.bak > $f
rm $f.bak
fi
done

else
#print usage informamtion
usage
fi

參考:http://linuxphile.org/node/13

IT佬 vs 通渠佬

(0)

Category : I.T.

從其他的 forum 聽到以下的一段關於 I.T. 工作的評價;心感切身,原來入錯行,怪不得客人都不願意付出分文地不斷的打電話來問東問西,但說要收費安排技術員上門解決問題時,連數百元服務費也不願付出…
公司爆屎渠搵個通渠佬用真空 pump 通渠 + 執走 D 屎    收費 HKD 2000.00 (都係做 3 個鐘到)
公司個 SQL down 左唔肯做 replication 搵個 IT SQL2000 expert 執過晒都係 收費 HKD 1500.00 (註: 500蚊個鍾架)
大家都係執屎一個小學程度, 一個大學畢業 + MSDBA 但收費平過 小學生

Information about the nslookup command (MS-DOS)

Comments Off

Category : I.T.

SYNTAX

Commands: (identifiers are shown in uppercase, [ ] means optional)

NAME print info about the host/domain NAME using default server
NAME1 NAME2 as above, but use NAME2 as server
help or ? print info on common commands
set OPTION set an option

all print options, current server and host
[no]debug print debugging information
[no]d2 print exhaustive debugging information
[no]defname append domain name to each query
[no]recurse ask for recursive answer to query
[no]search use domain search list
[no]vc always use a virtual circuit
domain=NAME set default domain name to NAME
srchlist=N1[/N2/.../N6] set domain to N1 and search list to N1,N2, etc.
root=NAME set root server to NAME
retry=X set number of retries to X
timeout=X set initial time-out interval to X seconds
type=X set query type (ex. A,ANY,CNAME,MX,NS,PTR,SOA,SRV)
querytype=X same as type
class=X set query class (ex. IN (Internet), ANY)
[no]msxfr use MS fast zone transfer
ixfrver=X current version to use in IXFR transfer request
server NAME set default server to NAME, using current default server
lserver NAME set default server to NAME, using initial server
finger [USER] finger the optional NAME at the current default host
root set current default server to the root
ls [opt] DOMAIN [> FILE] list addresses in DOMAIN (optional: output to FILE)

-a list canonical names and aliases
-d list all records
-t TYPE list records of the given type (e.g. A,CNAME,MX,NS,PTR etc.)
view FILE sort an ‘ls’ output file and view it with pg
exit exit the program

EXAMPLES

C:\>nslookup computerhope.com
Server: ns.computerhope.com
Address: 1.1.1.1

Name: computerhope.com
Address: 204.228.150.3

( from: http://www.computerhope.com/nslookup.htm )


伺服又被 Hack 了‧‧‧

(0)

Category : I.T.

今早反公司途中,接到老丁的電話說我的網站 (即伺服) 被 hacker 入侵了,過以為他說笑;怎知回到公司後一打開 IE,入到自己的網站後,心裡暗叫不妙,看到:

You Are HACKED BY ALEKS

再查看所有的網站,有十數個中招,幸好都集中在一台伺服上,其餘的都沒有發現被 hack,但這樣並不代表沒事‧‧‧ 在這台伺服上,大部份的 index.html 及 index.php 都被置換了,雖然可以被補救,但此終都覺得這一台 server 已經不大可靠了,而且她還是 Redhat 9,很早已經看她不順眼呢!

在沒有多大的信心下,就將她安裝成為 Fedora Core 4;實在太多的設定都變了,天啊~~ 單是 DNS 都給她用上二、三個小時,還有那個 VSFTP,喔~不是它的錯!都是 SeLinux 的問題,又再花上數小時‧‧‧

今晚氣溫急降,只有 9oC,唉~~~

使用 PHP 去 Upload 的上限

(0)

Category : I.T.

原來使用網頁寄存商的網頁寄存服務都幾多限制的,例如使用 PHP 程式作上存檔案時只可以上存到 2M 的,如果是自已的 Server 就很容易解決,修改 /etc/php.ini 便可以。

但是,使用網頁寄存服務就沒可能修改到 php.ini 了‧‧‧

找了很久,終於找到方法了,就是修改 .htaccess 了,只需要加入以下設定即可:

php_value upload_max_filesize 12M
可以說,在我使用的主機上可以用得上,希望你們也可以!