Módosítások

WebmailShibboleth

3 278 bájt hozzáadva, 2010. június 22., 10:46
passwordlifetime
= Shibboleth, Webmail szoftverek illesztése , IMAP Proof-of-concept = = In English ===Requirements==* The webmail software must not see or use users' LDAP password, the IdP must not release even the hashed form of the password.* IMAP must authenticate with username and password.* If one has access to the webmail server, she must not have access to the IMAP on behalf of all users (she can however access to active users session). ==Solution concepts==* The IdP and the IMAP server share an authentication database.* With every webmail SP request the IdP generates a new password for that particular user and writes it to the database.* The webmail SP receives this password with the attribute set and uses the username (e-mail address) and password to access the IMAP server.* The IMAP server tries to authenticate against the database.* In order to secure access, this password entry should contain an expiration time, which invalidates the password after the IdP session ends, so IMAP accepts only those users who has recently initiated active session at the IdP side. ==ShibbolethIdP plugin==* We have developed an IdP plugin -attribute resolver- which can generate this short-lifetime password (called service token) for the user and write it to the database.* Shibboleth IdP attribute resolver configuration is independent from the actual SP, so the plugin must check whether the current request came from an SP for which it needs to generate the token.* The service token is sent in plain-text, so the Shibboleth attribute statement must be encrypted either by using artifact resolution over SSL/TLS or by using XML encryption with HTTP-Post. ==IMAP configuration==* As we don't want to force the use of webmail, IMAP needs to use LDAP authentication as well.* Most IMAP servers can be configured to use PAM, which can be configured to use arbitrary SQL tables for authentication and it also supports authentication chaining. ==Webmail softwares==* For our proof-of-concept we have tried squirrelmail and roundcube with its HTTP-authentication plugin. If the SP is releasing the username and service token as PHP_AUTH_USER and PHP_AUTH_PW, this authentication module works out-of-the-hez box. = Magyarul =
== Koncepció ==
A webmail és a levelezőszerver (IMAP/POP3) együttes működését szeretnénk Shibbolizálni. A fő probléma abból áll, hogy a webmail az IMAP szerver felé felhasználónévvel és jelszóval autentikál. Az címtárban tárolt jelszót azonban nem adhatjuk ki az alkalmazásoknak, ráadásul legtöbb esetben ez egy hashelt jelszó.
* a webmail feltörése esetén nem férhetnek hozzá az összes felhasználó levelezéséhez
A fenti kritériumokat az 'egyszer használatos', rövid lejárató lejáratú jelszó használata ('service token') kielégíti. Ebben az esetben az IdP minden egyes webmail bejelentkezéshez generál egy véletlen jelszót, és ezt elmenti egy adatbázisban, (beállítva a jelszóhoz egy rövid lejárati időt) valamint elküldi a webmail SP-nek. A webmail ezen rövid lejáratú jelszó használatával autentikál az IMAP szerver felé.
A leírt gondolatmenet megvalósításához három komponens együttműködése szükséges:
<source lang="sql">
CREATE TABLE `otpservice_tokens` (
`uid` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
== IdP plugin ==
Az IdP plugin aktuális verziója a következő URL-ről tölthető le: http://software.niif.hu/maven2/hu/niif/shibboleth-servicetoken/1.0. A <code>shibboleth-otpdataconnectorservicetoken-1.0.jar </code> -t és illetve a megfelelő adatbázis drivert (MySQL esetén <code>mysql-connector.jar -t </code>) be kell másolni az <code>idp.war WEB-INF/lib </code> könyvtárába.
Az <code>attribute-resolver.xml </code> -ben a következő változtatásokat kell megtenni:
<source lang="xml">
<!--xml semak megfelelo beallitasa -->
<AttributeResolver
....
xmlns:otpniifconnector="urn:geant:niif.hu:dataconnector"
xsi:schemaLocation="
....
urn:geant:niif.hu:dataconnector classpath:/schema/otpdataconnectorservicetokendataconnector.xsd">
<!-- onetimepassword definicio -->
<resolver:AttributeDefinition id="otpserviceToken" xsi:type="Simple"
xmlns="urn:mace:shibboleth:2.0:resolver:ad"
sourceAttributeID="otpserviceToken">
<resolver:Dependency ref="otpConnectorserviceTokenConnector" />
<resolver:AttributeEncoder xsi:type="SAML2String"
xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
name="urn:geant:niif.hu:otpservicetoken" friendlyName="otpserviceToken" />
</resolver:AttributeDefinition>
</resolver:AttributeDefinition>
<!-- one time password service token generalasa --> <resolver:DataConnector xsi:type="otpniifconnector:OTPServiceToken" id="otpConnectorserviceTokenConnector"
sourceAttributeID="uid"
generatedAttributeID="otpserviceToken" tableName="otpservice_tokens"
principalColumn="uid"
passwordColumn="password"
expirationColumn="expiration"
passwordLifetime="400XXXXXX"
spEntityID="https://webmail.example.org/shibboleth" >
</source>
Fontos, hogy a <code>DataConnector</code> (másodpercekben értelmezett) <code>passwordLifetime</code> attribútumát jól állítsuk be, azaz hosszabb legyen, mint a webmail oldali SP session, de javasolt 24 óránál rövidebbre venni. Az <code>attribute-filter.xml </code> -ben pedig ki kell engedni az <code>uid </code> és otp <code>serviceToken</code> attribútumokat a webmail sp-nek:
<source lang="xml">
<AttributeRule attributeIDAttributeFilterPolicy id="otpsendServiceTokenToWebmail"> <PermitValueRule PolicyRequirementRule xsi:type="basic:AttributeRequesterString" value="https://webmail.example.org/shibboleth" /> </AttributeRule> <AttributeRule attributeID="uid"> <PermitValueRule xsi:type="basic:AttributeRequesterStringANY" /> </AttributeRule> <AttributeRule attributeID="serviceToken" > value <PermitValueRule xsi:type="httpsbasic:ANY" /> </webmail.example.org/shibboleth" /AttributeRule> </AttributeRuleAttributeFilterPolicy>
</source>
sasl_sql_passwd: *****
sasl_sql_database: shib_idp
sasl_sql_select: SELECT password AS userPassword FROM otp service_tokens WHERE uid = '%u' AND expiration > now()
Amennyiben az IMAP szervert nem TLS/SSL felett használjuk, ezek a beállítások nem biztonságosak!
MECHANISMS="pam"
Az /etc/pam.d/imap fájlban kell az imap pam beállításokat megtenni. Adatbázis használatához a libpam-mysql csomag is szükséges. Ha az adatbázisos felhasználókhoz nincs lokális account, akkor a PAM 'account' metódusát permit-re kell állítani.
auth sufficient pam_ldap.so
auth sufficient pam_mysql.so use_first_pass user=****** passwd=****** \
host=/var/run/mysqld/mysqld.sock db=shib_idp table=otp service_tokens usercolumn=uid passwdcolumn=password \
crypt=plain [where=expiration>now()]
auth required pam_deny.so
<source lang="xml">
<Attribute name="urn:oid:0.9.2342.19200300.100.1.1" id="PHP_AUTH_USER"/>
<Attribute name="urn:geant:niif.hu:otpservicetoken" id="PHP_AUTH_PW"/>
</source>
=== Squirrelmail ===
A Squirrelmailhez a [http://www.squirrelmail.org/plugin_view.php?id=34 Squirrelmail HTTP Authentication Plugin] letöltésével és telepítésével elvégezhető az IdP által kiadott és az SP által láthatóvá tett felhasználónév és jelszó alapú bejelentkezés.
 
=== Roundcube ===
A [http://trac.roundcube.net/browser/trunk/roundcubemail/plugins/http_authentication HTTP Authentication Plugin] telepítése után a plugin-ból el kell távolítani a következő sort:
 
public $task = 'login';
565
szerkesztés

Navigációs menü