Microsoft ADFS+Shibboleth配置联合身份认证+单点登录服务

Microsoft ADFS+Shibboleth配置联合身份认证+单点登录服务,第1张

MicrosoftADFS+Shibboleth配置联合身份认证+单点登录服务

前一段时间,由于客户的需要,建立了单点登录(SSO)系统。这是由shibboleth实现的,它可以在访问特定的Web资源时使用AD中的用户名和密码作为登录凭据,Shibboleth是SP,ADFS是IdP。

至少需要两台基本测试服务器。一台(服务器A)安装WindowsServer2012来实施ADCS、ADDS、ADFS和SQLServer,另一台(服务器B)安装CentOS6.6来实施Webserver和shibbolethSP。

关键步骤如下:配置各个服务器组件,配置服务器证书,配置shibboleth的配置文件(shibboleth2.xml),配置adfs添加“TrusteeTrust”。下面详细解释一下。

配置服务器a

1.安装WindowsServer2012

2.安装MicrosoftSQLServer2012

3.添加新的管理员帐户(非管理员),并将其添加到管理员组(管理员)。以后,使用此用户登录并管理此服务器,而不是使用administrator。

4.添加一个服务帐户,并将其添加到IIS_IUSERS组。您可能需要先安装“IIS”服务。

5.调整电源管理策略以取消屏幕锁定,并从“电源选项”->“无需密码”中删除“唤醒时的密码保护”

6.调整电脑名称,缩短名称,如ds、ad等。,要看这里的情况。

7.安装adds功能,将服务器提升为域控制器,合理设置NETBIOSYUMING,不使用dns委托。

8.安装合适的浏览器,比如Chrome,取消IE增强的安全配置。安装适当的输入法,并将其设置为默认输入法。安装解压程序,如winrar等。

9.安装adcs,并为安装的根证书配置一个易于记忆和区分的名称。根证书(CA证书)一般命名为“主机名+二级域名+CA”。例如,如果一个域是ds.com,那么ADCS所在的名为ds的计算机的CA名称一般是“ds-DS-CA”。

10.安装adfs,在此之前,将之前创建的管理员帐户(可以在步骤7中完成)添加到“DomianAdminis”容器(用户组)中。

11.将步骤4中创建的服务帐户添加到SQLServer的登录许可证中,即“指定的服务帐户具有对数据库的登录权限”,可以不指定数据库实例名称。如果不指定名称,默认情况下将创建两个数据库,AdfsArtifactStore和AdfsConfiguration。

12.在安装adfs的过程中,ADCS会为adfs自己创建所需的证书,并将其颁发给“主机名+主DNS后缀”。例如,如果一个域是ds.com,则adcs所在的名为ds的计算机的证书名称一般为“ds.ds.com”。该域名用于adfs的联合身份验证名称和联合身份验证服务标识符,完整的联合身份验证服务标识符将由shibboleth使用。

配置服务器B,服务器选择CentOS6.664位。

1.编译安装httpd,可选安装最新的openssl。

2.编译并安装Shibboleth

wgethttp://shibboleth.net/downloads/log4shib/latest/log4shib-1.0.8.tar.gz
wgethttp://shibboleth.net/downloads/c++-opensaml/latest/xmltooling-1.5.3.tar.gz
wgethttp://shibboleth.net/downloads/c++-openSAML/latest/openSAML-2.5.3.tar.gz
wgethttp://www.apache.org/dyn/closer.cgi?path=/santuario/c-library/XML-security-c-1.7.2.tar.gz[/br

tarzxflog4shib-1.0.8.tar.gz
CDlog4shib-1.0.8
。/configure-disable-static-disable-doxygen-prefix=/opt/shibboleth-sp
CD..
tarzxfxerces-c-3.1.1.tar.gz
CDXerces-c-3.1.1
。/configure-prefix=/opt/shibboleth-sp-disable-netaccessor-libcurl
CD..
cdlog4shib-1.0.8
制作
制作安装
CD..
cdXerces-c-3.1.1
制作
制作安装
CD..
tarzxfxml-security-c-1.7.2.tar.gz
CDXML-security-c-1.7.2
。/configure-with-Xalan-disable-static-prefix=/opt/shibboleth-sp-with-Xerces=/opt/shibboleth-sp
make
makeinstall
CD..
tarzxfxmltooling-1.5.3.tar.gz
CDXMLtooling-1.5.3
。/configure-with-log4shib=/opt/shibboleth-sp-prefix=/opt/shibboleth-sp-C
make
makeinstall
CD..
tarzxfopensaml-2.5.3.tar.gz
CDopenSAML-2.5.3
。/configure-with-log4shib=/opt/shibboleth-sp-prefix=/opt/shibboleth-sp-C
make
makeinstall
CD..[br/]http://shibboleth.net/downloads/service-provider/latest/·shibboleth-sp-2.5.3.tar.gz
塔尔·zxf·shibboleth-sp-2.5.3.tar.gz
CDshibboleth-sp-2.5.3
。/configure-with-log4shib=/opt/shibboleth-sp-enable-Apache-24-with-apxs24=/usr/local/bin/apxs-prefix=/opt/shibboleth-sp-with-apr1=/usr/local/apr-1-config-with-APU1=/usr/local/apr-util-httpd/bin/APU-1-config
make安装

3.配置shibboleth的配置文件(shibboleth2.xml),可以用shibd-tt检查文件的合法性。

<spconfigxmlns="urn:mace:shibboleth:2.0:native:sp:config"
xmlns:conf="urn:mace:shibboleth:2.0:native:sp:config"
xmlns:SAML="urn:oasis:names:TC:SAML:2.0:assertion"
xmlns:samlp="urn:oasis:names:TC:SAML:2.0:protocol"
xmlns:MD="urn:oasis
<;OutOfProcess>
<;扩展>
<;库路径="/opt/shibboleth-sp/lib/shibboleth/adfs.so"fatal="true"/>;
<;/Extensions>;
<;/outofprocess>;
<;inprocesslogger="native.logger">;
<;扩展>
<;库路径="/opt/shibboleth-sp/lib/shibboleth/adfs-lite.so"fatal="true"/>;
<;/Extensions>;
<;/inprocess>;
<;RequestMappertype="Native">
<;RequestMap>
<;hostscheme="https"name="SSL.ds.cn">;
<;pathname="/admin"authType="shibboleth"requiresession="true"/>;
<;/Host>;
<;/requestmap>;
<;/requestmapper>;
<;applicationdefaultsentityID="https://SSL.ds.cn/shibboleth"homeURL="https://SSL.ds.cn"
REMOTE_USER="eppnpersistent-idtargeted-id"signing="false"encryption="false"attributeprefix="AJP_">;
<;sessionslifetime="28800"timeout="3600"relaystate="ss:mem"
checkaddress="false"handlerssl="true"cookieProps="https">;
<;SSOentityID="http://DS.DS.cn/adfs/services/trust"
discoveryprotocol="SamLDS"discoveryURL="https://DS.example.org/DS/WAYF">;
SAML2SAML1
<;/SSO>;
<;注销>SAML2本地</Logout>;
<;handlertype="Metadatagenerator"Location="/Metadata"signing="false"/>;
<;handlertype="Status"Location="/Status"ACL="127.0.0.1::1172.16.179.3172.16.172.33"/>
<;handlertype="Session"Location="/Session"showattributevalues="false"/>;
<;handlertype="discoveryfeed"Location="/discoveryfeed"/>。
<;/Sessions>;
<;errorssupportcontact="dgdenterprise@Gmail.com"
helplocation="/about.html"
stylesheet="/shibboleth-sp/main.CSS"/>;
<;metadataprovidertype="XML"file="ds.ds.cn-metadata.XML"/>;
<;attributeextractortype="XML"validate="true"reloadchanges="false"path="attribute-map.XML"/>;
<;attributeresolvertype="Query"subjectmatch="true"/>;
<;attributefiltertype="XML"validate="true"path="attribute-policy.XML"/>;
<;credentialresolvertype="File"key="SSL.ds.cn.key"certificate="SSL.ds.cn.cer"password="xxxxx"/>;
<;/applicationdefaults>;
<;securitypolicyprovidertype="XML"validate="true"path="security-policy.XML"/>;
<;protocolprovidertype="XML"validate="true"reloadchanges="false"path="protocols.XML"/>;
<;/spconfig>;

4.配置httpd服务器,包括ssl访问和shibboleth模块

配置ssl时,您需要从WindowsADCS申请证书。相关命令如下:
OpenSSLgenRSA-des3-OUTssl.ds.cn.key
OpenSSLreq-new-days365-keySSL.ds.cn.key-OUTSSL.ds.cn.req.PEM

把这个文件上传到服务器a,然后你就可以通过ssl.ds.cn.req.pem文件用"certsrv"->:"certificateauthority"->:右键点击发证机构名称-->选择"所有任务"->:"提交新的申请"->:浏览文件""->;在“待批申请”->“已签发证书”中签发证书:以cer格式从“已签发证书”中导出“二进制证书”。

注意,在Windows系统上导出cer证书时,一定要选择“Base64编码的X.509(.CER)”,它可以通过文本编辑程序打开,如果可以读取而不是二进制,则可以在Linux系统上使用。例如,正确的格式是:

[root@Chris~]#cat/usr/local/httpd/conf/SSL/SSL.ds.cn.cer
-开始证书-
miiesdccapigawibagitnaaaaaxejq4f/fazeqaaaaaaaabtanbgkqhkig9w0baquf
……
-结束证书-

[root@Chris~]#cat/usr/local/httpd/conf/SSL/SSL.ds.cn.KEY
-BEGINRSA私钥-
Proc-Type:4,加密的
DEK-Info:DES-EDE3-CBC,153EEBA6AC815504

3cvvp3QA1a569awfjjjjcjgpsomuo7txqnpaujn5ph55eaqhabhpwqp9m8m6+
……
-ENDRSA私钥-
[root@chris~]#

配置shibboleth模块

[root@Chris~]#cat/usr/local/httpd/conf/extra/shibboleth.conf
#https://wiki.shibboleth.net/confluence/display/ShiB2/NativeSPLinuxSourceBuild
usecanonicalnameOn

配置ssl虚拟主机
[root@Chris~]#delsc/usr/local/httpd/conf/extra/httpd-SSL.conf
listen443
sslcipherSuiteHigh:Medium:!阿努尔:MD5
SSLpassphrasedialogbuiltin
SSLsessioncache"shmcb:/usr/local/httpd/logs/SSL_scache(512000)"
SSLsessioncachetimeout300
<;虚拟主机ssl.ds.cn:443
documentroot"/usr/local/httpd/htdocs"
ServerNamessl.ds.cn:443
serveradmindgdenterprise@gmail.com
errorlog"/usr/local/httpd/logs/SSL.DS.cn_error_log"/br/]transferlog"/usr/local/httpd/logs/SSL.DS.cn_access_log"
SSLcertificatefile"/usr/local/httpd/conf/SSL上的SSLEngine位置/管理>
AuthTypeshibboleth
ShibRequestSettingRequiresession1
RequiresessionOn
shibusheadersOn
<;/Location>;
<;文件匹配"\"(CGI|shtml|phtml|PHP)$">;
s选项+stdenvars
<;/filesmatch>;
<;目录“/usr/local/httpd/CGI-bin”>;
s选项+stdenvars
<;/Directory>;
browsermatch"MSIE[2-5]"\
nokeepaliveSSL-unclean-shutdown\
降级-1.0force-response-1.0
CustomLog"/usr/local/httpd/logs/SSL_request_log"\
"%t%h%{SSL_PROTOCOL}x%{SSL_CIPHER}x\"%r\"%b"/br/]<;/virtualhost>;
[root@chris~]#

4.启动shibd,/opt/shibboleth-sp/sbin/shibd

配置服务器A并添加受信任方的信任。

关键是上图显示的“可信方联合元数据”的url必须正确,测试才能通过。

创建索赔规则。

上图中的“传入声明类型”可以任意指定。

配置服务器b

1.开始shibd

2.启动httpd

3.测试验证

1)不通过身份验证访问根目录(即https://ssl.ds.cn/),如下图所示。

2)访问特定目录(即https://ssl.ds.cn/admin/)需要身份验证。可以通过输入域用户的用户名和密码来通过认证,如下图所示。

3)验证通过后,会显示正确的页面,如下图所示。

至此,配置完成,可以根据shibboleth手册开发相关应用。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/784149.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-04
下一篇2022-05-04

发表评论

登录后才能评论

评论列表(0条)

    保存