星期日, 5月 13, 2012

Parallels Desktop 7 安裝 Win7 開機錯誤訊息

Paralells Desktop 7 安裝 Win7 後,開機時會出現一段錯誤訊息:

"No Free Memory for XSDT"

通常,再重新開機後即可正常進入 虛擬 Win7.

解決方式如下:

1. 打開Parallels Desktop-"Configuration --> Hardware --> Boot Order and find Boot Flags field:

2. 將以下內容複制粘貼到方框中

    kernel.waet.enable=0

3. 保存更改後,重新啓動虛擬機即可


官方說明:http://kb.parallels.com/en/111406

星期六, 5月 05, 2012

MacBook Pro(13 英寸,2010 年中)Boot Camp 安裝 Win7 x64

MacBook Pro(13 英寸,2010 年中)
Mac OS X 10.6.8 Snow Leopard 

利用 Boot Camp 成功安裝 Win7 x64 後,如果需要 Boot Camp 3.0 driver 的話,可依如下所示~

1. 去找一片2009以後的隨機版的 Mac OS X,總之就是內建 Boot Camp 3.0 的隨機雪豹光碟

2. 進windows以後,放進光碟片

3. [開始] 搜尋 cmd 會出現顯示為 cmd 的 windows命令處理程式,按右鍵選「以系統管理員身分執行」

4. 應該會出現 C:\windows\system32>

5. 輸入 cd /d D: (或是把大寫 D 改成你光碟機代號)

6. 然後輸入 cd boot camp\drivers\Apple

7. 再輸入 bootcamp64.msi

8. 然後應該就會出現 Boot Camp 安裝的視窗了! 按照步驟完成後,再依序安裝 3.1 / 3.2 / 3.3 即可!

星期二, 3月 27, 2012

Google Apps HiNet DNS 代管設定

Step 1. 須先設定為 HiNet 代管 DNShttp://domain.hinet.net/eng-ip.html
















DNS Server Name

IP Address

IPv6 Address

admns1.hinet.net168.95.192.112001:b000:168::1:200:1
admns2.hinet.net168.95.1.112001:b000:168::2:200:1

設定 HiNet DNS 代管服務器如上列~


Step 2. 進入 DNS 代管設定 http://admns.hidomain.hinet.net/



Step 3. 如果您想要把 Google Apps Mail 服務轉為自己的網址,請如下設定:


新增一筆 CNAME 對應您的Mail網址前置字元,ex: mail
mail CNAME ghs.google.com

新增如下 MX 記錄:
MX 1 ASPMX.L.GOOGLE.COM
MX 5 ALT1.ASPMX.L.GOOGLE.COM
MX 5 ALT2.ASPMX.L.GOOGLE.COM
MX 10 ASPMX2.GOOGLEMAIL.COM
MX 10 ASPMX3.GOOGLEMAIL.COM

OK~ 您的 Google Apps Mail Services is ready!!

星期一, 3月 26, 2012

PHP 利用 sudo 執行 shell 指令 (shell_exec,exec,passthru,system)

!注意! 此方法可能有安全性隱憂,請慎用!

FreeBSD 需先透過 ports 安裝 sudo ( /usr/ports/security/sudo )

使用 visudo 修改 sudoers 設定檔 ( 或是直接編輯 /etc/sudoers )

ex:
apache 執行 任何 指令時,無須密碼
apache ALL = NOPASSWD: ALL

apache 執行 /root/SOME_SCRIPT 指令時,無須密碼,其餘不變
apache ALL = NOPASSWD: /root/SOME_SCRIPT

php ex:
$output = shell_exec("/usr/bin/sudo /root/SOME_SCRIPT");
echo $output;

P.S. 如遇 "sudo: sorry, you must have a tty to run sudo" 錯誤,可在 sudoers 中,將 Defaults requiretty 註解即可!

星期六, 12月 31, 2011

安裝 DenyHosts 防止 SSH 暴力破解

實在是受不了大量外部 IP 狂駭你的 SSH 嘛?

請服用 DenyHosts ~

FreeBSD 請用 ports 安裝: /usr/ports/security/denyhosts/
Linux 請到 http://denyhosts.sourceforge.net 下載安裝

官方安裝說明:

To run denyhosts from startup, add denyhosts_enable="YES" in your /etc/rc.conf.
Configiration options can be found in /usr/local/etc/denyhosts.conf
-------------------------------------------------------------------------------
In order to proper working of denyhosts
1. edit your /etc/hosts.allow file and add:
sshd : /etc/hosts.deniedssh : deny
sshd : ALL : allow
2. issue the following command if /etc/hosts.deniedssh does not exist yet
touch /etc/hosts.deniedssh
-------------------------------------------------------------------------------

/usr/local/etc/denyhosts.conf 基本設定完成後,/usr/local/etc/rc.d/denyhosts start 即可~

如需允許特定 IP 避免被鎖住,請在 DenyHosts WORK_DIR 目錄中新增一個 allow_hosts 每行一個IP,重啓 denyhosts 後即可排除特定 IP ~

星期日, 10月 02, 2011

Postfix + SASL2 + TLS + dovecot + RoundCube webmail

以下為採用 本機 passwd 認證,非虛擬帳號方式

重要 conf 設定如下:

Postfix ~ Mailbox 配合 dovecot 採用 Maildir 設定

==============================================

myhostname = HOST+DomainName
mydomain = DomainName
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
local_recipient_maps = unix:passwd.byname $alias_maps
mynetworks_style = host
mynetworks = 192.168.0.0/24, 127.0.0.0/8, WanFixIP
relay_domains = $mydestination
home_mailbox = Maildir/
mail_spool_directory = /var/mail
smtpd_banner = $myhostname ESMTP

# SASL 2
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination

# TLS
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /usr/local/etc/postfix/CA/server.key
smtpd_tls_cert_file = /usr/local/etc/postfix/CA/server.crt
smtpd_tls_CAfile = /usr/local/etc/postfix/CA/ca.crt
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom

# All mail will bcc to SomeAccount for backup
always_bcc = mailbak
==============================================

smtps inet n - n - - smtpd
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
==============================================


SASL2 ~ 需自行新增 smtpd.conf 於 /usr/local/lib/sasl2/ 下

==============================================
[/usr/local/lib/sasl2/smtpd.conf]

pwcheck_method: saslauthd
mechlist: plain login crammd5 digestmd5
==============================================


dovecot ~ IMAP, IMAPs, POP3, POP3s 可執行 doveconf 參考基本設定來產生 dovecot.conf

==============================================
[dovecot.conf]

auth_default_realm =
auth_mechanisms = plain login
auth_username_format = %n
disable_plaintext_auth = no
protocols = imap pop3
ssl_cert = server.crt
ssl_key = server.key
userdb {
driver = passwd
}
passdb {
driver = passwd
}
ssl = yes
mail_location = maildir:~/Maildir
mail_privileged_group = mail
==============================================


Roundcube Webmail ~ 請先於 MySQL 建立相對的資料庫及權限,用 Broswer 開啓 installer 目錄進行安裝設定,便可產生 main.inc.php & db.inc.php

==============================================
[main.inc.php]

$rcmail_config['db_dsnw'] = 'mysql://user:password@host/database';

//其他依預設值即可

==============================================
[db.inc.php]

// IMAP
$rcmail_config['default_host'] = 'DomainName';
$rcmail_config['default_port'] = 143;
$rcmail_config['imap_auth_type'] = '';

// SMTP
$rcmail_config['smtp_server'] = 'localhost';
$rcmail_config['smtp_port'] = 25;
$rcmail_config['smtp_auth_type'] = 'LOGIN, PLAIN';

// USER INTERFACE
$rcmail_config['junk_mbox'] = 'Spam';
$rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Spam', 'Trash');
$rcmail_config['create_default_folders'] = true;

// USER PREFERENCES
$rcmail_config['default_charset'] = 'UTF-8';

//其他依預設值即可

==============================================


/etc/rc.conf 需添加的設置如下
==============================================
# Postfix
postfix_enable="YES"

# dovecot
dovecot_enable="YES"

# Sendmail
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

# SASL2
saslauthd_enable="YES"

==============================================

星期三, 9月 14, 2011

Postfix + MySQL + ExtMail郵件伺服器

[轉載] http://www.bsdlover.cn/html/51/n-2951.html

一、安装

先把相应的软件安装上,最后再来分别配置。安装之前最好先用“portsnap fetch update”更新ports
[1]. 安装cyrus-sasl2
cyrus-sasl2是为标准的SASL实现库,可以支持Courier authlib。
[root@bsd01 ~]#cd /usr/ports/security/cyrus-sasl2
[root@bsd01 cyrus-sasl2]#make install clean

然后会出现“make config”的界面,选择需要的支持即可,但是我现在是以mysql做数据库支持,所以一定要需mysql:
Options for cyrus-sasl 2.1.22_2
----------------------------------------------------------------------------
[ ] BDB Use Berkeley DB
[X] MYSQL Use MySQL
[ ] PGSQL Use PostgreSQL
[ ] SQLITE Use SQLite
[ ] DEV_URANDOM Use /dev/urandom
[ ] ALWAYSTRUE Enable the alwaystrue password verifier
[ ] KEEP_DB_OPEN Keep handle to Berkeley DB open
[X] AUTHDAEMOND Enable use of authdaemon
[X] LOGIN Enable LOGIN authentication
[X] PLAIN Enable PLAIN authentication
[X] CRAM Enable CRAM-MD5 authentication
[X] DIGEST Enable DIGEST-MD5 authentication
[X] OTP Enable OTP authentication
[X] NTLM Enable NTLM authentication


[2]. 安装courier-imap
Courier-IMAP是一个提供POP3、IMAP服务的程序,能够很方便的配置使其支持加密协议POP3s、IMAPs。并良好的支持Maildir。
[root@bsd01 cyrus-sasl2]#cd /usr/ports/mail/courier-imap
[root@bsd01 courier-imap]#make install clean

然后会出现“make config”的界面,选择需要的支持即可:
Options for courier-imap 4.4.1,2
-------------------------------------------------------------------------------
[ ] FAM Build in fam support for IDLE command
[ ] TRASHQUOTA Include deleted mails in the quota
[ ] GDBM Use gdbm db instead of system bdb
[ ] IPV6 Build with IPv6 support
[ ] AUTH_LDAP LDAP support
[X] AUTH_MYSQL MySQL support
[ ] AUTH_PGSQL PostgreSQL support
[ ] AUTH_USERDB Userdb support
[ ] AUTH_VCHKPW Vpopmail/vchkpw support


[3]. 安装postfix
postfix是一个优秀的MTA(mail transfer agent,邮件传输代理),相比sendmail在性能还是配置简便都好一些,它本身就是用来替代sendmail的,所以兼容性也很不错,大部分的sendmail的脚本都可以使用在postfix上。
[root@bsd01 courier-imap]#cd /usr/ports/mail/postfix
[root@bsd01 postfix]#make install clean

然后会出现“make config”的界面,选择我们需要的组件就可以了:
Options for postfix 2.5.5,1
--------------------------------------------------------------------------------------
[X] PCRE Perl Compatible Regular Expressions
[X] SASL2 Cyrus SASLv2 (Simple Auth. and Sec. Layer)
[ ] DOVECOT Dovecot SASL authentication method
[ ] SASLKRB If your SASL req. Kerberos select this option
[ ] SASLKRB5 If your SASL req. Kerberos5 select this option
[ ] SASLKMIT If your SASL req. MIT Kerberos5 select this option
[X] TLS Enable SSL and TLS support
[ ] BDB Berkeley DB (choose version with WITH_BDB_VER)
[X] MYSQL MySQL maps (choose version with WITH_MYSQL_VER)
[ ] PGSQL PostgreSQL maps (choose with DEFAULT_PGSQL_VER)
[ ] OPENLDAP OpenLDAP maps (choose ver. with WITH_OPENLDAP_VER)
[ ] CDB CDB maps lookups
[ ] NIS NIS maps lookups
[X] VDA VDA (Virtual Delivery Agent)
[X] TEST SMTP/LMTP test server and generator

安装过程会出现1个问题,一般默认就可以了:
Would you like me to add it [y]?y
Would you like to activate Postfix in /etc/mail/mailer.conf [n]?n

安装完之后,会提示你把启动下下面文字加入/etc/rc.conf文件
postfix_enable="YES"
#If you not need sendmail anymore, please add in your rc.conf:
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

然后把下面的加入到/etc/periodic.conf,但是我服务器上根本没有/etc/periodic.conf文件,所以就不用管它:
#And you can disable some sendmail specific daily maintenance routines in your /etc/periodic.conf file:
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"

[4]. 安装extman和extmail
其实这个去http://www.extmail.org/cgi-bin/download.cgi下载也可以。
1). 安装extman 0.2.5
[root@bsd01 postfix]#cd /usr/ports/mail/extman
[root@bsd01 extman]#make install clean

然后会弹出“make config”的选项,选择我们需要的mysql就可以了:
Options for extman 0.2.5
------------------------------------------------------------
[X] MySQL Use MySQL support
[ ] LDAP Use LDAP support

extman安装好之后,网页及配置文件位于/usr/local/www/extman目录。它还会编译其他比如p5-MIME,p5-GD,p5-DBD-mysql,gd,p5-DBI,p5-Storable这些支持组件。这就是ports的强大之处。

2). 安装extmail 1.0.5
[root@bsd01 extman]#cd ../extmail
[root@bsd01 extmail]#make install clean

这里也会弹出“make config”的选项,跟extman的一样,但是由于前面extman已经选择了支持,所以这里可以把mysql和ldap的支持去掉了。
extmail安装好之后,网页及配置文件位于/usr/local/www/extmail,另外他还会把p5-Unix-Syslog这个组件安装上。

现在我们就可以来配置了。

二、配置篇
[1]. 先来做几个基本的动作
[root@bsd02 ~]#mv /usr/sbin/sendmail /usr/sbin/sendmail.old
[root@bsd01 ~]#ln -s /usr/local/sbin/sendmail /usr/sbin
[root@bsd01 ~]#echo 'postfix: root' >> /etc/aliases
[root@bsd01 ~]#/usr/local/bin/newaliases
[root@bsd01 ~]#chown postfix:postfix /etc/opiekeys

[2]. 现在来配置courier-imap
▼先复制下配置文件:
[root@bsd01 ~]#cd /usr/local/etc/courier-imap
[root@bsd01 courier-imap]#cp imapd.cnf.dist imapd.cnf
[root@bsd01 courier-imap]#cp pop3d.cnf.dist pop3d.cnf
[root@bsd01 courier-imap]#chmod a+x /var/run/authdaemond

▼然后把courier-imap的启动加到/etc/rc.conf文件:
courier_authdaemond_enable="YES"
courier_imap_pop3d_enable="YES"
courier_imap_imapd_enable="YES"

▼启动认证服务:
[root@bsd01 courier-imap]#/usr/local/etc/rc.d/courier-authdaemond start

星期三, 5月 11, 2011

MySQL root 密碼忘記 !? (Windows系列)

如果你的SERVER是 Windows XP/2000/2003/NT 應該都可以使用這個方法來重置 MySQL root 的密碼

1. 停止 MySQL 服務,執行 CMD,輸入 net stop mysql

2. 進入 MySQL 安裝目錄,ex: C:\Program files\mysql\bin\

3. 進入 mysql 安全模式,也就是 mysql start 後,不需輸入密碼就能進入 mysql! 指令如下:
mysqld -nt --skip-grant-tables
4. 再另外執行一個CMD命令窗口,輸入 mysql -u root -p,使用無密碼的方式登入 MySQL(不用輸入密碼,直接按 Enter)

5. 輸入以下指令開始修改 root 的密碼
mysql> UPDATE mysql.user SET password=PASSWORD('新密碼') WHERE User='root';
6. 重新載入 mysql 權限表
mysql> flush privileges;
7. 大功告成!
mysql> quit

如此一來,MySQL root 密碼已經重置,
MySQL 重新啟動後,就可以用新密碼登入了!

星期六, 7月 10, 2010

iPhone 3GS 誤升 iOS 4.0 成功降回 3.1.3 ( 解決 error 1015 )

同事的 iPhone 3GS 在一時手賤下,誤升級上了 iOS 4.0

在不確定是否有備份 SHSH 的情況下,只好死馬當活馬醫了...

降韌體前,須先修改 hosts 將 Apple 官方連線檢查更新SERVER 轉向至 Sauriks Server

Windows
找到 C:/Windows / System32 / drivers / etc / hosts 開啟編輯
在最下方加入下列一行:
74.208.10.249  gs.apple.com

MAC OS X
點選 Finder, 執行 Go to Folder... 輸入 /etc 後點選 Go
一樣在最下方加入一行:
74.208.10.249  gs.apple.com
此時因為權限問題,無法直接存檔,請先選擇 另存新檔 至桌面
注意! 不要勾選 [ If no extension is provide, use .txt ]
然後再到桌面,把剛剛另存的 hosts 拖拉回 /etc 目錄中,按照指示輸入權限密碼置換檔案即可!


接下來就是進行降韌體重刷工作,以下建議採用 MAC OS X 較容易成功!

  • 取得 iPhone OS 3.1.3 firmware (Click here!)
  • 取得 RecBoot (Mac App)
  • 進入 DFU 模式,直接重刷 3.1.3

進入 iPhone DFU (Device Firmware Upgrade) 模式
  1. 接上 iPod / iPhone 連接線
  2. 開啟 iTunes
  3. 同時按住 Lock(開關) 鍵與 Home 鍵不放
  4. 10 秒後放開 Lock 鍵,確實保持 Home 鍵按住不放
  5. 10 秒後 iTunes 跳出訊息,表示巳進入 recovery mode (回復模式),按 OK
  6. 在 iTunes 裡,按住 option(Shift) 同時點擊 restore(回復) 按鈕
  7. 此時跳出視窗,請指定 iPhone OS 3.1.3 ipsw 所在位置,按下 OK 開始 restore 程序

用 RecBoot 解決 error 1015 狀況

Restore 程序跑完之後,iTunes 將顯示 error 1015 訊息,立即執行 RecBoot (請執行 RecBoot Exit Only.app),按下 Exit Recovery Mode 按鈕,iPhone 將自行重新開機,完成 OS restore,接下來就可以進行 Spirit !!!


Regards, Rayback Liu.

星期二, 6月 15, 2010

「顯示桌面」不見了!怎辦?

CASE A:

請將下面虛線內的文字複製下來,不含虛線。
---------------------------------------
[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop
---------------------------------------
將其貼到記事本上,儲存檔案為「顯示桌面.scf」
然後把這個檔案放到「C:\Documents and Settings\使用者名稱\Application Data\Microsoft\Internet Explorer\Quick Launch」即可。


CASE B:

開始 → 執行 → 輸入[regsvr32 /n /i:u shell32] → 確定