1 安裝GT 4.0
1.用root用戶登錄并創建“globus”的用戶,通過運行下面的命令為該用戶建立目錄并賦予globus用戶對其目錄的所有權限:
root#[1] mkdir /usr/local/globus-
root# chown globus:globus /user/local/globus-
2.下載附錄 軟件先決條件里面的軟件。
注:正確設置JAVA_HOME環境變量,在/etc/profile里面加入
export JAVA_HOME=/usr/local/jdk
同時在/etc/ant.conf文件里面只需要加入
ANT_HOME=/usr/local/ant-
3.最為globus用戶登錄,運行命令:
globus$ export GLOBUS_LOCATION=/user/local/globus-
globus$ ./configure –prefix=$GLOBUS_LOCATION
同時可以使用./configure –help獲得更多幫助信息。
注:為了方便執行,可以將上面第一個語句加入到/etc/profile文件里面,或者加入到用戶自己HOME目錄下的.bashrc文件中。
4.執行命令:
globus$ make
也可以用下面的命令對安裝過程進行日志記錄:
globus$ make 2>&1 | tee build.log
5.最后運行:
globus$ make install
來完成安裝。
2 安全配置
標準的安裝文檔的結構設置存在問題,如果按照它的順序無法完整安裝。這里我們對結構進行了調整。這部分包含了標準安裝文檔的5、6、7章的內容。
2.1 設置環境變量
1. 作為globus登錄,設置GLOBUS_LOCATION指向Globus Toolkit的安裝路徑:
globus$ export GLOBUS_LOCATION=/usr/local/globus-
注:如果上面你以及在/etc/profile里面進行了設置,這里就不需要再執行這一步驟。
2. 執行$GLOBUS_LOCATION/ect/gobus-user-env.sh(我們這里使用的是BShell。如使用的是C Shell,需要執行后綴是csh的文件)。
globus$ . $GLOBUS_LOCATION/ect/globus-user-env.sh
注:在點“.”和$GLOBUS_LOCATION/ect/globus-user-env.sh之間有一個空格。
2.2 得到主機證書(host certificates)
為了運行GT 4.0,必須為主機分配證書。其中:
l 證書必須包含兩個文件:hostcert.pem和hostkey.pem
l 同時,這兩個文件必須放在正確的目錄下:/etc/grid-security/
l 主機在DNS上必須具有一個固定的域名,不可以運行在使用了DHCP服務的服務器上。
為此,可以選擇:
l 從一個以及存在的CA處申請一個證書。
l 安裝SimpleCA,并使之為我們分配證書。
l 使用globus提供的low-trust證書。
這里,我們選擇一個比較容易實現的方法,就是安裝SimpleCA。在下面一節里面我們將介紹如何安裝和配置SimpleCA。
2.3 安裝和配置SimpleCA
1.創建用戶
保證系統中存在這樣的用戶:
l 普通的用戶賬號,用來執行客戶端的程序。
l 一個globus賬號,用來執行管理的任務。如啟動、停止容器,部署服務等。同時,這個用戶還負責管理SimpleCA。為此,需要保證該用戶對$GLOBUS_LOCATION目錄有讀寫權限。在第1章中我們以及創建了這樣一個用戶。
2.運行安裝腳本
對每個網格,只需運行一次下面的腳本即可。
globus$ GLOBUS_LOCATION/setup/globus/setup-simple-ca
在此過程中,程序會提醒你關于你想創建的CA的信息,如:
The unique subject name for this CA is:
cn=Globus Simple CA, ou=simpleCA-mci.uestc.edu.cn, ou=GlobusTest, o=Grid
Do you want to keep this as the CA subject (y/n) [y]:
推薦默認選項,按y繼續。接下來,會提示你輸入用來發送證書的email地址:
Enter the email of the CA (this is the email where certificate requests will be sent to be signed by the CA):
這時,系統提示你輸入證書過期的時間。默認是5年,接受即可。
The CA certificate has an expiration date. Keep in mind that once the CA certificate has expired, all the certificates signed by that CA become invalid. A CA should regenerate the CA certificate and start re-issuing ca-setup packages before the actual CA certificate expires. This can be done by re-running this setup script. Enter the number of DAYS the CA certificate should last before it expires.
[default: 5 years (1825 days)]:
緊接著,系統提示輸入生成密鑰的短語。這里可以隨意輸入,但是不允許包括空格。同時一定要記住,因為接下來還要使用這個短語。
Generating a 1024 bit RSA private key
........++++++
................++++++
writing new private key to '/home/globus/.globus/simpleCA//private/cakey.pem'
Enter PEM pass phrase:
最后,你會看見下面的提示:
A self-signed certificate has been generated for the Certificate Authority with the subject: /O=Grid/OU=GlobusTest/OU=simpleCA-mayed.mcs.anl.gov/CN=Globus Simple CA
If this is invalid, rerun this script
setup/globus/setup-simple-ca
and enter the appropriate fields.
------------------------------------------------------------------
The private key of the CA is stored in /home/globus/.globus/simpleCA//private/cakey.pem
The public CA certificate is stored in /home/globus/.globus/simpleCA//cacert.pem
The distribution package built for this CA is stored in
/home/globus/.globus/simpleCA//globus_simple_ca_68ea3306_setup-0.17.tar.gz
這里顯示的信息對于以后在其它機器上進行安裝你的網格是十分重要的。在最后一行的數字68ea3306是你的CA hash,它是一個8位的十六進制的字符串。安裝繼續進行,直到你看到類似下面的內容,證明安裝以及結束。
******************************************************************
Note: To complete setup of the GSI software you need to run the following script as root to configure your security configuration directory:
/opt/gt4/setup/globus_simple_ca_68ea3306_setup/setup-gsi
For further information on using the setup-gsi script, use the -help option. The -default option sets this security configuration to be the default, and -nonroot can be used on systems where root access is not available.
******************************************************************
setup-ssl-utils: Complete
3.安裝GSI
以root用戶登錄,運行:
root# $GLOBUS_LOCATION/setup/globus_simple_ca_CA_Hash_setup/
setup-gsi -default
其中,Hash表示你的CA Hash,應該用68ea3306代替。這里每次安裝時獲得的CA Hash是不一樣的,應該注意。
2.4 證書的申請和發放
2.4.1 host證書
1.申請一個host證書
這個證書應該是給服務器申請的,這樣才可以向用戶發放證書。首先,使用root用戶登錄,運行命令:
root# grid-cert-request –host ‘hostname’
這里的hostname是服務器的主機名,比如“mci.uestc.edu.cn”。該命令會在服務器上創建3個文件,分別是:
l /etc/gride-security/hostkey.pem
l /etc/grid-security/hostcert_request.pem
l /etc/grid-security/hsotcert.pem(這是一個空的文件)
之后,會通過郵件的方式將hostcert_request.pem發送給CA的管理員,即globus用戶。
2.對host證書簽名
作為globus用戶登錄,并運行如下命令:
grid-ca-sign –in hostcert_request.pem –out hostsigned.pem
這個命令是對接受到的host證書進行簽名,從而生成hostsigned.pem文件。在此過程中,系統提示globus用戶輸入最初安裝SimpleCA時輸入的短語。
3.獲得簽名證書
作為root用戶登錄,將剛才生成的hostsinged.pem文件移到/etc/grid-security/目錄下并改名為hostcert.pem,從而覆蓋原先的空文件。這時,該文件的所有者是root,同時對其它用戶是只讀的權限。
2.4.2 用戶證書
1.申請證書
首先,用一個普通用戶登錄。然后在命令行輸入如下命令:
user$ grid-cert-request
在此過程中,會提示你輸入passphrase。這個是用來生成密鑰的短語,要牢記。否則只能重新申請證書。
最后,系統中會生成如下三個文件:
· ~$USER/.globus/usercert.pem (empty)
· ~$USER/.globus/userkey.pem
· ~$USER/.globus/usercert_request.pem
其中usercert.pem是空文件,需要另外獲得。此時,會用email方式將usercert_request.pem給SimpleCA的管理員。
2.對申請的證書進行簽名
SimpleCA的管理員賬號globus登錄,并運行如下命令
globus$ grid-ca-sign -in usercert_request.pem -out signed.pem
對通過email收到的usercert_request.pem進行簽名。這時,系統會提示globus用戶輸入在安裝SimpleCA過程中輸入的passphrase。正確輸入后就會根據usercert_request.pem生成一個signed.pem文件,并通過email將其發送給申請證書的用戶。
3.獲得簽名證書
用普通用戶登錄,并接收來自email的經過簽名的signed.pem文件,將其拷貝到~$USRE/.globus/目錄下,并改名為usercert.pem。從而覆蓋原先生成的空文件。
2.4.3 測試
為了對安裝在/etc/grid-security/certificates的證書進行校驗,需要運行如下命令:
user$ grid-proxy-init –debug –verify
如果一切正確,輸出的結果類似下面的內容:
[bacon@mayed schedulers]$ grid-proxy-init -debug -verify
User Cert File: /home/user/.globus/usercert.pem
User Key File: /home/user/.globus/userkey.pem
Trusted CA Cert Dir: /etc/grid-security/certificates
Output File: /tmp/x509up_u1817
Your identity: /O=Grid/OU=GlobusTest/OU=simpleCA-mayed.mcs.anl.gov/OU=mcs.anl.gov/CN=User Name
Enter GRID pass phrase for this identity:
Creating proxy ..............................++++++++++++
...............++++++++++++
Done
Proxy Verify OK
Your proxy is valid until: Sat Mar 20 03:01:46 2004
2.5 使容器可以訪問證書
通過上述方法獲得證書的host key文件(/etc/grid-security/hostkey.pem)對于root用戶使只讀的。而此時容器會以非root用戶身份運行(可能使globus用戶)。為了讓容器也可以訪問證書,必須使用root賬號登錄并做如下改動:
root# cd /etc/grid-security
root# cp hostkey.pem containerkey.pem
root# cp hostcert.pem containercert.pem
root# chown globus.globus containerkey.pem containercert.pem
執行結束后,/etc/grid-security目錄看起來像下面這樣:
root# ls -l *.pem
-rw-r--r-- 1 globus globus 1785 Oct 14 14:47 containercert.pem
-r-------- 1 globus globus 887 Oct 14 14:47 containerkey.pem
-rw-r--r-- 1 root root 1785 Oct 14 14:42 hostcert.pem
-r-------- 1 root root 887 Sep 29 09:59 hostkey.pem
2.6 添加授權
為用戶添加授權,使之可以訪問服務。首先,需要作為root用戶登錄,創建/etc/grid-security/grid-mapfile文件。這時,你需要兩部分信息:
l 用戶的主體名(subject name)
l 這個主體名應該映射到的賬號(account name)
這個文件的語法是每個用戶使用一行來表示,前面是用戶的主體名,后面跟著用戶的賬號。
為了得到這兩部分信息,可以使用grid-cert-info命令得到用戶的主體名,并用whoami命令得到用戶的賬號。例如:
bacon$ grid-cert-info -subject
/O=Grid/OU=GlobusTest/OU=simpleCA-mayed.mcs.anl.gov/OU=mcs.anl.gov/CN=Charles Bacon
bacon$ whoami
bacon
可以使用grid-mapfile-add-entry命令向grid-mapfile文件中添加用戶。例如:
root# $GLOBUS_LOCATION/sbin/grid-mapfile-add-entry -dn "/O=Grid/OU=GlobusTest/OU=simpleCA-mayed.mcs.anl.gov/OU=mcs.anl.gov/CN=Charles Bacon" -ln bacon
結果grid-mapfile看起來應該像這樣:
"/O=Grid/OU=GlobusTest/OU=simpleCA-mayed.mcs.anl.gov/OU=mcs.anl.gov/CN=Charles Bacon" bacon
注:主體名兩側的雙引號是必須的,因為這樣可以忽略其中包含的空格。
[1] 在指南中,所有命令之前都標準執行該命令的用戶名。root# 表示系統管理員root用戶,globus$ 表示globus用戶執行該命令。對于不是globus的非特權用戶,我們使用user$ 來表示