Shibboleth 1.3 安装指南(Linux版)
IdP的安装大致可分为网络平台的安装和Shibboleth IdP的安装两个部分。其中网络平台的安装包括jdk, openssl, httpd, tomcat, JK等的安装。
IdP安装时,需要用到的软件包如下:
l
ntp-
l jdk-1_5_0_05-linux-i586.bin
l
openssl-
l
httpd-
l
apache-tomcat-
l
jakarta-tomcat-connectors-
l
shibboleth-idp-
定义NCPKU_HOME=/home/ncpku, NCPKU_COMMON=/home/ncpku/common。本次安装中,网络平台的软件都装在NCPKU_COMMON下。Shibboleth IdP安装在NCPKU_HOME/shibboleth-idp下。
安装软件时的源代码都放在NCPKU_HOME/allsrc下。
假设IdP安装在DNS名字为idp.pku6.edu.cn的服务器上。
参照本安装说明进行安装,将使IdP加入CERNETFed联盟。在安装之前,CERNETFed联盟会为每一台加入的IdP提供以下4个文件:
l 名为idp.pku6.edu.cn.crt的服务器证书;
l 名为idp.pku6.edu.cn.key.nopwd的服务器私钥;
l 名为cernet-fed-metadata.xml的联盟元文件;
l 名为idp.xml的配置文件;
确认服务器上安装有NTP,可以使用ntpdate命令校正时间。
否则,利用安装包ntp-
# ./configure
#make
#make install
在NCPKU_HOME下新建文件myenv.sh。
在其中写入如下内容:
ntpdate ntp.pku.edu.cn
export LC_ALL=zh_CN
export NCPKU_HOME=/home/ncpku
export NCPKU_COMMON=$NCPKU_HOME/common
export JAVA_HOME=$NCPKU_COMMON/jdk
export OPENSSL_HOME=$NCPKU_COMMON/openssl-
export HTTPD_HOME=$NCPKU_COMMON/httpd-
export
CATALINA_HOME=$NCPKU_COMMON/apache-tomcat-
export LD_LIBRARY_PATH=$OPENSSL_HOME/lib:$HTTPD_HOME/lib:$LD_LIBRARY_PATH
PATH=$JAVA_HOME/bin:$OPENSSL_HOME/bin:$HTTPD_HOME/bin:$CATALINA_HOME/bin:$PATH
在NCPKU_HOME下,
# chmod +x myenv.sh
以后每次登录后,都要运行以下命令
# . /home/ncpku/myenv.sh
在NCPKU_HOME下新建文件restart.sh。
在其中写入如下内容:
$HTTPD_HOME/bin/apachectl -k stop
$CATALINA_HOME/bin/shutdown.sh
$HTTPD_HOME/bin/apachectl -k start -DSSL
$CATALINA_HOME/bin/startup.sh
在NCPKU_HOME下,
# chmod +x myenv.sh
以后每次重启IdP,只需运行以下命令
# /home/ncpku/restart.sh
把jdk安装包jdk-1_5_0_05-linux-i586.bin拷贝到NCPKU_COMMON下。
# chmod +x jdk-1_5_0_05-linux-i586.bin
# ./ jdk-1_5_0_05-linux-i586.bin
在NCPKU_COMMON下新建目录openssl-
把openssl安装包openssl-
在NCPKU_HOME/allsrc下,解压openssl-
# ./config threads shared zlib --prefix=$OPENSSL_HOME
# make
# make install
在NCPKU_COMMON下新建目录httpd-
把httpd的安装包httpd-
在NCPKU_HOME/allsrc下,解压httpd-
# ./configure
--prefix=$HTTPD_HOME --enable-rewrite --enable-so --enable-ssl --with-ssl=$OPENSSL_HOME
# make
# make install
修改HTTPD_HOME/conf/httpd.conf文件,
l Listen 3333
l ServerName idp.pku6.edu.cn
修改HTTPD_HOME/conf/ssl.conf文件,
l ServerName idp.pku6.edu.cn:443
把tomcat安装包apache-tomcat-
# tar zxf apache-tomcat-
把JK安装包jakarta-tomcat-connectors-
在NCPKU_HOME/allsrc下,解压jakarta-tomcat-connectors-
# cd jk/native
# ./configure --enable-jni --with-apxs=$HTTPD_HOME/bin/apxs --with-java-home=$JAVA_HOME --with-java-platform=2
# make
# make install
在HTTPD_HOME/conf/httpd.conf中,加入
# **********mod_jk related configurations start***************
<IfModule !mod_jk.c>
LoadModule jk_module modules/mod_jk.so
</IfModule>
JkLogFile "logs/mod_jk.log"
JkLogLevel debug
JkMount /shibboleth-idp/* ajp13w
JkMount /jsp-examples/* ajp13w
JkWorkerProperty worker.list=ajp13w
JkWorkerProperty worker.ajp13w.type=ajp13
JkWorkerProperty worker.ajp13w.host=localhost
JkWorkerProperty worker.ajp13w.port=8009
#**********mod_jk related configurations end*******************
在CATALINA_HOME/conf/server.xml中,在<Connector port="8009" …>中加入,
address="127.0.0.1" request.tomcatAuthentication="false"
将CERNETFed联盟所提供的idp.pku6.edu.cn.crt和idp.pku6.edu.cn.key.nopwd拷贝到目录HTTPD_HOME/conf下。
在HTTPD_HOME/conf/ssl.conf中,
SSLCertificateFile conf/idp.pku6.edu.cn.crt
SSLCertificateKeyFile conf/idp.pku6.edu.cn.key.nopwd
在HTTPD_HOME/conf/httpd.conf中,加入,
#***************Shibboleth installation Basic AuthN configuration start******
<Location /shibboleth-idp/SSO>
AuthType Basic
AuthName "Villain Verification Service (VVS)"
AuthUserFile conf/user.db
require valid-user
</Location>
#***************Shibboleth installation Basic AuthN configuration stop******
在HTTPD_HOME/bin下,
# htpasswd -c $HTTPD_HOME/conf/user.db Test_User_01
# htpasswd $HTTPD_HOME/conf/user.db Test_User_02
在HTTPD_HOME/conf/ssl.conf中,在<IfDefine>元素内,加入
#***************Shibboleth installation attribute exchange configuration start******
Listen 8443
<VirtualHost _default_:8443>
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
SSLVerifyClient optional_no_ca
SSLVerifyDepth 10
SSLOptions +StdEnvVars +ExportCertData
SSLCertificateFile conf/idp.pku6.edu.cn.crt
SSLCertificateKeyFile conf/idp.pku6.edu.cn.key.nopwd
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
</VirtualHost>
#***************Shibboleth installation attribute exchange configuration stop******
为了检查到目前为止的安装是否正确,在浏览器中输入以下2个地址:
http://idp.pku6.edu.cn:3333/jsp-examples/
https://idp.pku6.edu.cn/jsp-examples/
如果都能够显示Tomcat自带的示例程序jsp-examples的页面,则安装正确;否则,之前的安装过程存在错误。
在NCPKU_HOME下新建目录shibboleth-idp。
把IdP的安装包shibboleth-idp-
进入shibboleth-
# cp *.jar $CATALINA_HOME/common/endorsed
在shibboleth-
# ./ant -Didp.home=$NCPKU_HOME/shibboleth-idp -Dtomcat.home=$CATALINA_HOME
当ant要求用户输入某些信息时,全部输入回车,选择默认选项即可。
①把cernet联盟所提供的cernet-fed-metadata.xml拷贝到目录NCPKU_HOME\shibboleth-idp\etc下。
②把cernet联盟所提供idp.xml拷贝到目录NCPKU_HOME\shibboleth-idp\etc下,覆盖掉原有的同名文件。
为了检查到目前为止的安装是否正确,在浏览器中输入以下地址:
https://idp.pku6.edu.cn/shibboleth-idp/SSO
首先出现一个对话框询问是否接受证书,选择“是”后,弹出窗口要求输入用户名和密码,输入1.2.8.3节中设置的用户名和密码,出现包含如下信息的错误页面:
“Shibboleth
Identity Provider Failure
org.opensaml.SAMLException: Invalid data from Service Provider: no target URL
received”
这说明到此为止的安装正确。否则,安装存在错误。
启动IdP,需要:
l 启动httpd: $HTTPD_HOME/bin/apachectl -k start -DSSL
l 启动tomcat: $CATALINA_HOME/bin/startup.sh
在新建了文件restart.sh之后,只需使用以下命令:
# /home/ncpku/restart.sh
在HTTPD_HOME/conf/httpd.conf中,将1.2.8.3节中加入的内容注释掉。
①将ClientFlatFileFilter.java拷到NCPKU_HOME/allsrc/shibboleth-
②在/home/ncpku/下新建文件user.conf,写入合法的用户名和密码,user.conf中每行的格式为“用户名:密码”。
③在NCPKU_HOME/allsrc/shibboleth-
<filter>
<filter-name>Client Cert AuthN Filter</filter-name>
<filter-class>edu.internet2.middleware.shibboleth.utils.ClientFlatFileFilter</filter-class>
<init-param>
<param-name>portalURL</param-name>
<param-value>interia.pku6.edu.cn</param-value>
</init-param>
<init-param>
<param-name>cmdfile</param-name>
<param-value>/home/ncpku/user.conf</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Client Cert AuthN Filter</filter-name>
<url-pattern>/SSO</url-pattern>
</filter-mapping>
④在/home/ncpku/allsrc/shibboleth-
#./ant
当ant要求用户输入某些信息时,全部输入回车,选择默认选项即可。
①将ClientDiameterFilter.java和Client.java拷到NCPKU_HOME/allsrc/shibboleth-
②在NCPKU_HOME/allsrc/shibboleth-
<filter>
<filter-name>Client Cert AuthN Filter</filter-name>
<filter-class>edu.internet2.middleware.shibboleth.utils.ClientDiameterFilter</filter-class>
<init-param>
<param-name>portalURL</param-name>
<param-value>interia.pku6.edu.cn</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Client Cert AuthN Filter</filter-name>
<url-pattern>/SSO</url-pattern>
</filter-mapping>
③在/home/ncpku/allsrc/shibboleth-
#./ant
①将ClientUserFilter.java拷到NCPKU_HOME/allsrc/shibboleth-
②同1.5.2的②
③在/home/ncpku/allsrc/shibboleth-
#./ant
IdP上与提供属性相关的配置分为2部分:
l 在NCPKU_HOME\shibboleth-idp\etc\arps\arp.site.xml中配置ARP
l 在NCPKU_HOME\shibboleth-idp\etc\idp.xml的根元素IdPConfig的属性IdPConfig所指定的文件中配置属性定义和属性提供类(DataConnector).
在NCPKU_HOME\shibboleth-idp\etc\arps\arp.site.xml中进行配置,
如在该文件中写入以下内容,
<Rule>
<Target>
<AnyTarget/>
</Target>
<Attribute name="cernetfed:institution">
<AnyValue release="permit"/>
</Attribute>
<Attribute name="cernetfed:username">
<AnyValue release="permit"/>
</Attribute>
</Rule>
可以把名为”cernetfed:institution”和”cernetfed:username”的属性提供给任何SP。
在NCPKU_HOME\shibboleth-idp\etc\idp.xml的根元素IdPConfig的属性IdPConfig所指定的文件中,配置属性定义和属性提供类。
在目前安装的IdP上主要有以下3种属性提供类(DataConnector):
l IdP自带的从LDAP中取得用户属性的DataConnector
l IdP自带的提供固定值属性的StaticDataConnector
l 从国瑞的DT服务器取得用户属性的DTDataConnector
在NCPKU_HOME\shibboleth-idp\etc\idp.xml的根元素IdPConfig的属性IdPConfig为:
resolverConfig="file:/home/ncpku/shibboleth-idp/etc/resolver.ldap.xml"
在NCPKU_HOME\shibboleth-idp\etc\resolver.ldap.xml中,
<SimpleAttributeDefinition id="o:ou:uid" sourceName="uid">
<DataConnectorDependency requires="pku_ldap"/>
</SimpleAttributeDefinition>
<SimpleAttributeDefinition id="o:ou:cn" sourceName="cn">
<DataConnectorDependency requires="pku_ldap"/>
</SimpleAttributeDefinition>
<SimpleAttributeDefinition id="o:ou:mail" sourceName="mail">
<DataConnectorDependency requires="pku_ldap"/>
</SimpleAttributeDefinition>
<JNDIDirectoryDataConnector id="pku_ldap">
<Search filter="uid=%PRINCIPAL%">
<Controls searchScope="SUBTREE_SCOPE" returningObjects="false" />
</Search>
<Property name="java.naming.factory.initial" value="com.sun.jndi.ldap.LdapCtxFactory" />
<Property name="java.naming.provider.url" value="ldap://ldap1.pku.edu.cn/o=pku" />
<Property name="com.sun.jndi.ldap.connect.pool" value="true" />
<Property name="com.sun.jndi.ldap.connect.pool.initsize" value="5" />
<Property name="com.sun.jndi.ldap.connect.pool.prefsize" value="5" />
<Property name="com.sun.jndi.ldap.connect.pool.authentication" value="none simple DIGEST-MD5" />
<Property name="com.sun.jndi.ldap.connect.pool.protocol" value="plain ssl" />
</JNDIDirectoryDataConnector>
①对于
将resolver-static.zip解压,将resolver-static.zip中的3个文件上传到$CATALINA_HOME/webapps/shibboleth-idp/WEB-INF/classes之下的对应的路径下:
l schemas\shibboleth-resolver-1.0.xsd
l edu\internet2\middleware\shibboleth\aa\attrresolv\ResolutionPlugInFactory.class
l edu\internet2\middleware\shibboleth\aa\attrresolv\provider\StaticDataConnector.class
②在NCPKU_HOME\shibboleth-idp\etc\idp.xml的根元素IdPConfig的属性IdPConfig所指定的文件中,加入以下内容:
<SimpleAttributeDefinition id="cernetfed:institution" sourceName="institution">
<DataConnectorDependency requires="static"/>
</SimpleAttributeDefinition>
<SimpleAttributeDefinition id="cernetfed:username" sourceName="username">
<DataConnectorDependency requires="static"/>
</SimpleAttributeDefinition>
<StaticDataConnector id="static">
<Attribute name="institution">
<Value>pku_v6</Value>
</Attribute>
<Attribute name="username">
<Value>%PRINCIPAL%</Value>
</Attribute>
</StaticDataConnector>
在IdP上设有Shibboleth IdP的源码扩展机制,以便于把扩展的源码与Shibboleth项目提供的源码区分开。
具体作法是,在IdP的源代码路径(/home/ncpku/allsrc/shibboleth-idp-
在pkuExt下,新建2个文件夹lib,src以及1个文件build.properties。
build.properties的内容为:
ext.name=pkuExt
gen.ext.docs=false
在pkuExt/lib下,把新建源码所需要的Jar包拷进去。在本例中为国瑞公司给的使用DT作认证并取用户角色列表所需要的一系列Jar包。
在pkuExt/src下,是新建的源码文件。在本例中包括包cn.edu.pku.interia中用于取属性的类cn.edu.pku.interia.DTDataConnector.java。
增加源文件DTDataConnector.java后,需要重新使用ant编译整个项目。
在IdP和SP的交互中,IdP需要把用户的角色以用户属性的方式传给SP,考虑到用户具有的联盟角色的个数是不确定的,所以,IdP传给SP的用户属性有:
l 用户具有的联盟角色的个数cernet:rolenum
l 用户具有的联盟角色名,形如cernet:role1, cernet:role2等等。第N个联盟角色名为cernet:roleN
在DTDataConnector.java中的resolve(Principal principal, String requester, String responder, Dependencies depends)方法中,把用户的联盟角色列表从DT服务器中取出来,把每个角色名放入一个类BasicAttribute的实例myBA中,并把每个myBA放入一个类BasicAttributes的实例basicAttrs中。basicAttrs是函数resolve的返回值。
在NCPKU_HOME\shibboleth-idp\etc\idp.xml的根元素IdPConfig的属性IdPConfig所指定的文件中,加入以下内容:
在文件resolver.xml中,增加以下语句使用DTDataConnector从DT服务器中取得属性。
<SimpleAttributeDefinition id="cernet:rolenum" sourceName="cernet:rolenum">
<DataConnectorDependency requires="dt"/>
</SimpleAttributeDefinition>
<SimpleAttributeDefinition id="cernet:role1" sourceName="cernet:role1">
<DataConnectorDependency requires="dt"/>
</SimpleAttributeDefinition>
<SimpleAttributeDefinition id="cernet:role2" sourceName="cernet:role2">
<DataConnectorDependency requires="dt"/>
</SimpleAttributeDefinition>
<SimpleAttributeDefinition id="cernet:role3" sourceName="cernet:role3">
<DataConnectorDependency requires="dt"/>
</SimpleAttributeDefinition>
<CustomDataConnector id="dt" class="cn.edu.pku.interia.DTDataConnector"/>
SP的安装大致可分为网络平台的安装和Shibboleth SP的安装两个部分。其中网络平台的安装包括httpd等的安装。
IdP安装时,需要用到的软件包如下:
l
ntp-
l jdk-1_5_0_05-linux-i586.bin
l
openssl-
l
httpd-
l
apache-tomcat-
l
jakarta-tomcat-connectors-
l
log4cpp-
l opensaml-1.1-5.i386.rpm
l
xerces-c-
l
xml-security-c-
l shibboleth-1.3-7.i386.rpm
定义NCPKU_HOME=/home/ncpku, NCPKU_COMMON=/home/ncpku/common。本次安装中,网络平台的软件都装在NCPKU_COMMON下。安装软件时的源代码都放在NCPKU_HOME/allsrc下。
本次SP的安装使用了RPM包,而没有从源代码开始安装。
假设SP安装在DNS名字为sp.pku6.edu.cn的电脑上。
参照本安装说明进行安装,将使IdP加入CERNETFed联盟。在安装之前,CERNETFed联盟会为每一台加入的SP提供以下4个文件:
l 名为sp.pku6.edu.cn.crt的服务器证书;
l 名为sp.pku6.edu.cn.key.nopwd的服务器私钥;
l 名为cernet-fed-metadata.xml的联盟元文件;
l 名为shibboleth.xml的配置文件。
确认服务器上安装有NTP,可以使用ntpdate命令校正时间。
否则,利用安装包ntp-
# ./configure
#make
#make install
在NCPKU_HOME下新建文件myenv.sh。
在其中写入如下内容:
ntpdate ntp.pku.edu.cn
export LC_ALL=zh_CN
export NCPKU_HOME=/home/ncpku
export NCPKU_COMMON=$NCPKU_HOME/common
export JAVA_HOME=$NCPKU_COMMON/jdk
export HTTPD_HOME=$NCPKU_COMMON/httpd-
export CATALINA_HOME=$NCPKU_COMMON/apache-tomcat-
export LD_LIBRARY_PATH=$HTTPD_HOME/lib:$LD_LIBRARY_PATH
PATH=$JAVA_HOME/bin:$HTTPD_HOME/bin:$CATALINA_HOME/bin:$PATH
在NCPKU_HOME下,
# chmod +x myenv.sh
以后每次登录后,都要运行以下命令
# . /home/ncpku/myenv.sh
在NCPKU_HOME下新建文件restart.sh。
在其中写入如下内容:
$HTTPD_HOME/bin/apachectl -k stop
$CATALINA_HOME/bin/shutdown.sh
/etc/init.d/shibd stop
$HTTPD_HOME/bin/apachectl -k start -DSSL
$CATALINA_HOME/bin/startup.sh
/etc/init.d/shibd start
在NCPKU_HOME下,
# chmod +x myenv.sh
以后每次重启SP,只需运行以下命令
# /home/ncpku/restart.sh
把jdk安装包jdk-1_5_0_05-linux-i586.bin拷贝到NCPKU_COMMON下。
# chmod +x jdk-1_5_0_05-linux-i586.bin
# ./ jdk-1_5_0_05-linux-i586.bin
使用以下命令检查Linux上已经安装的openssl的版本,
# openssl version
如果openssl版本为
否则,把openssl-
# rpm -ivh openssl-
在NCPKU_COMMON下新建目录httpd-
把httpd的安装包httpd-
在NCPKU_HOME/allsrc下,解压httpd-
# ./configure
--prefix=$HTTPD_HOME --enable-rewrite --enable-so --enable-ssl
# make
# make install
修改HTTPD_HOME/conf/httpd.conf文件,
l Listen 3333
l ServerName sp.pku6.edu.cn
修改HTTPD_HOME/conf/ssl.conf文件,
l ServerName sp.pku6.edu.cn:443
把tomcat安装包apache-tomcat-
# tar zxf apache-tomcat-
把JK安装包jakarta-tomcat-connectors-
在NCPKU_HOME/allsrc下,解压jakarta-tomcat-connectors-
# cd jk/native
# ./configure --enable-jni --with-apxs=$HTTPD_HOME/bin/apxs --with-java-home=$JAVA_HOME --with-java-platform=2
# make
# make install
在HTTPD_HOME/conf/httpd.conf中,加入
# **********mod_jk related configurations start***************
<IfModule !mod_jk.c>
LoadModule jk_module modules/mod_jk.so
</IfModule>
JkLogFile "logs/mod_jk.log"
JkLogLevel debug
JkMount /jsp-examples/* ajp13w
JkWorkerProperty worker.list=ajp13w
JkWorkerProperty worker.ajp13w.type=ajp13
JkWorkerProperty worker.ajp13w.host=localhost
JkWorkerProperty worker.ajp13w.port=8009
#**********mod_jk related configurations end*******************
在CATALINA_HOME/conf/server.xml中,在<Connector port="8009" …>中加入,
address="127.0.0.1" request.tomcatAuthentication="false"
将CERNETFed联盟所提供的sp.pku6.edu.cn.crt和sp.pku6.edu.cn.key.nopwd拷贝到目录HTTPD_HOME/conf下。
在HTTPD_HOME/conf/ssl.conf中,
SSLCertificateFile conf/sp.pku6.edu.cn.crt
SSLCertificateKeyFile conf/sp.pku6.edu.cn.key.nopwd
为了检查到目前为止的安装是否正确,在浏览器中输入以下2个地址:
http://sp.pku6.edu.cn:3333/jsp-examples/
https://sp.pku6.edu.cn/jsp-examples/
如果都能够显示Tomcat自带的示例程序jsp-examples的页面,则安装正确;否则,之前的安装过程存在错误。
先把以下rpm包拷贝到NCPKU_HOME/allsrc下:
l log4cpp-
l xerces-c-
l xml-security-c-
l opensaml-1.1-5.i386.rpm
l shibboleth-1.3-7.i386.rpm
在NCPKU_HOME/allsrc下,严格按顺序执行以下命令:
# rpm -ivh log4cpp-
# rpm -ivh xerces-c-
# rpm -ivh xml-security-c-
# rpm -ivh opensaml-1.1-5.i386.rpm
# rpm -ivh shibboleth-1.3-7.i386.rpm
SP 安装在/etc/shibboleth路径下。
在/etc/init.d下出现了SP中守护进程shibd的启动程序shibd。
要启动shibd,使用 # /etc/init.d/shibd start,或使用# service shibd start .
要停止shibd,使用 # /etc/init.d/shibd stop,或使用# service shibd stop .
在HTTPD_HOME/conf/httpd.conf中,加入
Include /etc/shibboleth/apache.config
在HTTPD_HOME/conf/httpd.conf中,修改如下:
UseCanonicalName On
在/etc/shibboleth/apache.conf中,修改第10行:
LoadModule mod_shib /usr/libexec/mod_shib_20.so
①将cernetfed联盟所提供的shibboleth.xml拷贝到/etc/shibboleth下。
②将cernetfed联盟所提供的cernet-fed-metadata.xml拷贝到/etc/shibboleth下。
③在/etc/shibboleth/apache.config中,加入
<Location /research>
AuthType shibboleth
ShibRequireSession On
require shibboleth
</Location>
同时,在HTTPD_HOME/htdocs下,建立目录research,在目录research下添加静态html文件shrinkcray.htm。
/etc/shibboleth/native.logger中,修改如下,
l 第14行,log4j.appender.native_log.fileName=/etc/shibboleth/native.log
l 第5行,log4j.category.SAML.XML=DEBUG
l 第6行,log4j.category.shibtarget.XMLApplication=DEBUG
/etc/shibboleth/shibd.logger中,
l 第16行,log4j.appender.shibd_log.fileName=/etc/shibboleth/shibd.log
l 第5行,log4j.category.SAML.XML=DEBUG
l 第6行,log4j.category.shibtarget.XMLApplication=DEBUG
l 第24行,log4j.appender.tran_log.fileName=/etc/shibboleth/transaction.log
在/etc/shibboleth下,创建文件native.log和transaction.log
# chmod a+w native.log
# chmod a+w transaction.log
按2.4节中的方法启动SP,在IE中访问https://sp.pku6.edu.cn/research/shrinkcray.htm时,就会直接被重定向到门户上。
启动SP包括:
l 启动shibd: /etc/init.d/shibd start
l 启动httpd: $HTTPD_HOME/bin/apachectl -k start �CDSSL
l 启动tomcat: $CATALINA_HOME/bin/startup.sh
在新建了文件restart.sh之后,只需使用以下命令:
# /home/ncpku/restart.sh
为了在Web Application中取得用户属性,在SP上需要进行的配置可以分为以下3部分:
l 在/etc/shibboleth/AAP.xml中配置属性接受策略(AAP)
l 在/etc/shibboleth/apache.config和/etc/shibboleth/shibboleth.xml中把特定的URL配置为受保护的资源
l 对于Java Web Application来说,需要在$HTTPD_HOME/conf/ssl.conf中要求JK对于特定的URL把用户属性以环境变量的方式传给Tomcat;而对于PHP应用来说,直接在PHP程序中就可以取得用户的属性。
下面以名为”kuayu”的Web Application为例。
在/etc/shibboleth/AAP.xml中,加入以下内容:
<AttributeRule Name="cernetfed:institution" Header="INSTITUTION">
<AnySite>
<AnyValue/>
</AnySite>
</AttributeRule>
<AttributeRule Name="cernetfed:username" Header="USERNAME">
<AnySite>
<AnyValue/>
</AnySite>
</AttributeRule>
在/etc/shibboleth/apache.config中,加入以下内容:
<Location /kuayu>
AuthType shibboleth
ShibRequireSession On
require shibboleth
</Location>
在/etc/shibboleth/shibboleth.xml中,在元素<Host name="sp.pku6.edu.cn"></Host>中,加入以下内容:
<Path name="kuayu" authType="shibboleth" requireSession="true" exportAssertion="true" requireSessionWith="WAYF_pku"/>
对于Java Web Application来说,需要在$HTTPD_HOME/conf/ssl.conf中,通过配置JK,使得对于特定的URL,httpd把用户属性以环境变量的方式传给Tomcat。方法如下:
在$HTTPD_HOME/conf/ssl.conf中,
加入 JkMount /kuayu/* ajp13w
在”kuayu”中,使用以下语句来取得用户的属性:
String cn = request.getHeader("INSTITUTION");
String uid = request.getHeader("USERNAME");
针对PHP应用,在Apache上安装了PHP模块后,使用以下2句来取得用户的属性:
echo $_SERVER['HTTP_INSTITUTION'];
echo $_SERVER['HTTP_USERNAME'];