LDAPã§Tracã®èªè¨¼ã¨æ¨©éã®ç®¡çãè¡ã
ä»æ¥ã¯ä¹ ãã¶ãã«ãã天æ°ã§ããããå¤ã«ã¯ãã¾ãæ¥æ¿ãªé¨ãå人çã«ã¯æ¶¼ããã®ã¯ããããã®ã§ããããªããæ¥æ¬ã®æ°åã大åå¤ã£ã¦ãã¾ã£ãæãã§ããã
ãã¦ãTrac0.11ããªãªã¼ã¹ããããã¨ããã£ã¦ãä½ãã¨èª¿æ»ãã¦ããã®ã§ãããä»åã¯LDAPã«é¢ããæ
å ±ã«ã¤ãã¦ã§ãã
Tracã§ã¯ãLDAPãå©ç¨ãã¦èªè¨¼ã権éã®ç®¡çãè¡ããã¨ãã§ãã¾ãã大è¦æ¨¡ã«å©ç¨ãããå ´åãLDAPã§ã¦ã¼ã¶èªè¨¼ã権éã®ç®¡çãã§ããã®ã¯ã¨ã¦ã便å©ã§ãã
èªè¨¼ã«ã¤ãã¦ã¯ãapacheã®èªè¨¼æ©è½ãå©ç¨ãã¦æ¯è¼çç°¡åã«ã§ããã®ã§ããã権éã¯LDAPã®ã¹ãã¼ããé¢é£ãã¦ãããè¨å®ãè¤éã§ãããããã調ã¹ã¦å®ç¾ã§ããããã«ãªã£ãã®ã§ãããæ å ±ãå°ãªãã®ã§ã¾ã¨ãã¦ããã¾ãã
åä½ç°å¢
以ä¸ã®ç°å¢ã§æ¤è¨¼ãè¡ãã¾ããã
- Windows Vista
- TracLightning 2.0.6
- OpenDS 1.0.0ï¼JDKã®ã¤ã³ã¹ãã¼ã«ãå¿ è¦ï¼
LDAPç°å¢ã®æ§ç¯
LDAPã®Directory Serviceã«ã¯ãOpenDSã使ç¨ãã¾ããã
OpenDSã¯ãJavaã§éçºãããDirectory Serviceã§ãã以ä¸ã®ãµã¤ãã§ãInstall with QuickSetupããé¸æããã¨ãJava Web Startçµç±ã§ã¤ã³ã¹ãã¼ã«ãããã¨ãã§ãã¾ãã
https://opends.dev.java.net/public/downloads_index.html
[OpenDS]Server Settings
ã¤ã³ã¹ãã¼ã«å
ã®ãã£ã¬ã¯ããªã¯ä»»æã®å ´æãæå®ãã¾ãã
åæç¶æ
ã§ã¯ãã«ã¼ãã¦ã¼ã¶ã®ãã¹ã¯ã¼ãã空ã«ãªã£ã¦ãã¾ããããã¹ã¯ã¼ããæå®ãã¦ããã¾ãã
[OpenDS]Topology Options
ããã§ã¯ããThis will be a standalone serverããé¸æãã¦ããã¾ãã
[OpenDS]Directory Data
ãDirectory Base DN:ãã¯ããã©ã«ãã®ã¾ã¾ã§ããããdc=example,dc=comããæå®ãã¾ãã
ã¾ãããImport Automatically-Genarated Sample Dataããé¸æããã¨ãæå®ããæ°ã ãã¦ã¼ã¶ãèªåçæã§ãã¾ãã
ã¤ã³ã¹ãã¼ã«ãå®äºããããOpenDSã®èµ·åã確èªãã¾ãã
以ä¸ã®ããããã¡ã¤ã«ãå®è¡ããã¨ãOpenDSã®ç¶æ
ç»é¢ã表示ãããèµ·åï¼åæ¢ã®æä½ãè¡ããã¨ãã§ãã¾ãã
<OpenDS_HOME>\bat\status-panel.bat
æ¥ç¶ã®ç¢ºèªã«ã¯ãLDAPãã©ã¦ã¶ãå©ç¨ããã¨ç°¡åã§ããä»åã¯ãLDAP Adminãå©ç¨ãã¦ãã¾ãã
[LDAP Admin]æ¥ç¶è¨å®
Tracç¨ã®LDAPã®è¨å®
LDAPã®ã¤ã³ã¹ãã¼ã«ãå®äºãããã次ã¯ãTracç¨ã®è¨å®ãè¡ãã¾ããTracã®æ¨©éãLDAPã§ç®¡çã§ããããã«ããããã«ã¯ãTracç¨ã®ã¹ãã¼ããç»é²ãã¦ãããã¨ãå¿ è¦ã«ãªãã¾ããOpenDSã§ã¯ãldifãã¡ã¤ã«ï¼LDAPãã¼ã¿äº¤æå½¢å¼ãã¡ã¤ã«ï¼ãã以ä¸ã®ãã£ã¬ã¯ããªã«é ç½®ãããã¨ã§ãã¹ãã¼ãã追å ãããã¨ãå¯è½ã§ãã
<OpenDS_HOME>\config\schema
ä»åã¯ã以ä¸ã®ãããªãã¡ã¤ã«ãå®ç¾©ããä¸è¨ãã£ã¬ã¯ããªã«é
ç½®ãã¾ããã
ã¹ãã¼ãã®å
容ã¯ã以ä¸ã®ãµã¤ããåèã«ãã¦ä½æãã¦ãã¾ãã
http://trac-hacks.org/wiki/LdapPluginTests
- 09-trac.ldif
dn: cn=schema objectClass: top objectClass: ldapSubentry objectClass: subschema attributeTypes: ( 1.3.6.1.4.1.15527.143 NAME 'tracperm' DESC 'Trac Permission' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32} ) objectClasses: ( 1.3.6.1.4.1.15527.8 NAME 'tracuser' DESC 'Regular user with Trac permission' SUP top STRUCTURAL MUST ( uid $ cn $ userpassword ) MAY ( tracperm $ sn $ description ) ) objectClasses: ( 1.3.6.1.4.1.15527.9 NAME 'tracgroup' DESC 'Trac permission for groupofnames' SUP top AUXILIARY MAY ( tracperm ) )
ã¹ãã¼ãã®ç»é²ãã§ãã¦ãããã©ããã¯ãLDAP Adminã®Schema Viewerãå©ç¨ãã¦ç¢ºèªã§ãã¾ãã
ã¡ãã¥ã¼ããããToolsãâãSchema...ãã¨é¸æãããtracpermããæ¤ç´¢ãã¦ã¹ãã¼ããç»é²ããã¦ãããã¨ã確èªãã¾ãã
Tracã§å©ç¨ããã¦ã¼ã¶ï¼ã°ã«ã¼ãã®ä½æ
Tracç¨ã®ã¹ãã¼ãã®ç»é²ãå®äºããããTracãæä½ããã¦ã¼ã¶ãã°ã«ã¼ãã®è¨å®ããã¾ãã
ä»åã¯ã以ä¸ã®ãããªå®ç¾©ããã¾ããã
ããã¼ã¸ã£æ¨©éãæå®ããã¦ã¼ã¶ | uid=manager01,ou=TracUsers,dc=example,dc=com |
---|---|
ããã¼ã¸ã£æ¨©éãæã¤ã°ã«ã¼ã | cn=managers,ou=TracPermissionGroups,dc=example,dc=com |
- çµç¹ï¼ouï¼ã®ä½æ
- è¦ç´ ãå³ã¯ãªãã¯ããã¡ãã¥ã¼ãããNewãâãOrganizational unit...ããé¸æã
- çµç¹ã®ååãå ¥åããã
- ã¦ã¼ã¶ã®ç»é²å ã§ãããTracUsersãã¨æ¨©éã°ã«ã¼ãã®ãTracPermissionGroupsããä½æã
- ã¦ã¼ã¶ï¼uidï¼ã®ä½æ
- ä½æãããTracUsersããå³ã¯ãªãã¯ããã¡ãã¥ã¼ãããNewãâãUser...ããé¸æã
- ã¦ã¼ã¶ããããã£ãå ¥åãããã¤ã¢ãã°ãéããããããå¿ è¦ãªå¤ãæå®ã
- ãã¹ã¯ã¼ããæå®ããå¿ è¦ãããããå³ã¯ãªãã¯ã¡ãã¥ã¼ã®ãSet password...ãããæå®ãããã¨ããã¨ã¨ã©ã¼ã¨ãªãããããEdit Entry...ãã®ãuserPasswordãå±æ§ãç·¨éãã¦æå®ã
- ã°ã«ã¼ãï¼cnï¼ã®ä½æ
- ä½æãããTracPermissionGroupsããå³ã¯ãªãã¯ããã¡ãã¥ã¼ãããNewãâãEntry...ããé¸æã
- objectClassã«ãgroupOfNamesããtracgroupãã追å ã
- ãcnããtracpermãå±æ§ãè¨å®(tracpermå±æ§ãæå®ãã¦ããã®ããã¤ã³ããè¤æ°ã®æ¨©éãæå®ãããå ´åã¯ãtracpermå±æ§ãè¤æ°æå®ãã)ã
- ãmemberãå±æ§ã«ãã¦ã¼ã¶ã追å ã
çµç¹ï¼ouï¼ | ã¦ã¼ã¶ï¼uidï¼ | ã°ã«ã¼ãï¼cnï¼ |
---|---|---|
ããã§ãã£ã¨ãLDAPã®è¨å®ãå®äºã§ãã
Tracã®ãã°ã¤ã³èªè¨¼ã®è¨å®
èªè¨¼ã®è¨å®ã¯ãApacheã®httpd.confã§æå®ãã¾ãã
TracLightningã®ã¤ã³ã¹ãã¼ã«ã¯å®äºãã¦ããããSampleProjectãã¨ããããã¸ã§ã¯ããç»é²ããã¦ãããã®ã¨ãã¾ãã
- httpd.conf
LoadModule ldap_module modules/mod_ldap.so LoadModule authnz_ldap_module modules/mod_authnz_ldap.so <LocationMatch "/[^/]+/login"> AuthType Basic AuthName "Enter your LDAP ID" AuthBasicProvider ldap Order Allow,Deny Allow from All AuthLDAPBindDN "cn=Directory Manager" AuthLDAPBindPassword **** AuthLDAPURL "ldap://ldaphost:389/?uid?sub?(objectClass=*)" Require ldap-attribute objectClass=person </LocationMatch>
ä¸è¨ã®è¨å®ãããããTracLightningãèµ·åããSampleProjectã«ã¢ã¯ã»ã¹ãã¾ãã
ããã°ã¤ã³ããªã³ã¯ãã¯ãªãã¯ããå
ã»ã©ä½æããmanager01ã¦ã¼ã¶ã®ã¦ã¼ã¶IDï¼ãã¹ã¯ã¼ããæå®ãã¦ããã°ã¤ã³ãæåããã°ãèªè¨¼ã®è¨å®ã¯æåã§ãã
ãã ãããã®ç¶æ ã§ã¯ã権éã¯LDAPã§æå®ãããã®ã¯æå¹ã«ãªã£ã¦ãã¾ãããæå¹ã«ããããã«ã¯ãTracã®LdapPluginãå©ç¨ãã¦è¨å®ãããã¨ãå¿ è¦ã§ãã
Tracã®æ¨©éã®è¨å®
権éãLDAPãå©ç¨ãã¦ç®¡çããã«ã¯ãLdapPluginãã¤ã³ãã¼ã«ãã¦è¨å®ãè¡ãã¾ãã
LdapPluginã¯ãTrac0.10ã¾ã§ã®å¯¾å¿ã§ãããTrac0.11ã§ãåä½ãã¾ããã
ã¾ãã¯ã以ä¸ã®ãµã¤ããããLdapPluginï¼2008/08/31æç¹ã§ã¯v0.5.1ï¼ããã¦ã³ãã¼ããã¾ãï¼Subversionã®ãªãã¸ããªããç´æ¥åå¾ããå¿ è¦ãããã¾ãï¼ã
http://trac-hacks.org/wiki/LdapPlugin
LdapPluginãåå¾ããããã³ãã³ãããã³ããããã以ä¸ã®ããã«ãã¦ã¤ã³ã¹ãã¼ã«ãã¾ãã
é常ã¯ãã
>cd <LdapPlugin_HOME> >python setup.py install
次ã«ãtrac.iniã®è¨å®ãè¡ãã¾ããå®ç¾©ããé
ç®ã¯ãLdapPluginã®ãã¼ã¸ã«èª¬æãããã¾ãããå¿
è¦ãªãã®ã®ã¿æå®ããã°åé¡ããã¾ããã
- trac.ini
[trac] #permission_store = DefaultPermissionStore permission_store = LdapPermissionStore [components] ldapplugin.* = enabled [ldap] # LDAPã®æå¹ enable = true # LDAPã®ãµã¼ãæ å ± host = ldaphost port = 389 # ã¦ã¼ã¶ãæå±ãããã¼ã¹DN basedn = dc=example,dc=com # ãã¼ã¹DNããã®ã¦ã¼ã¶ã®RDN user_rdn = ou=TracUsers # ã¦ã¼ã¶IDãå®ç¾©ãã¦ããå±æ§ uidattr = uid # ãã¼ã¹DNããã®ã°ã«ã¼ãã®RDN group_rdn = ou=TracPermissionGroups # ã°ã«ã¼ãIDãå®ç¾©ãã¦ããå±æ§ groupattr = cn groupname = groupOfNames # 権éãã«é¢ããè¨å® manage_groups = true store_bind = true # LDAPãæä½ããã¦ã¼ã¶ã®èªè¨¼æ å ± bind_user = cn=Directory Manager bind_passwd = ****
trac.iniãå¤æ´ããã®ã§ãTracLightningãåèµ·åããSampleProjectã«ã¢ã¯ã»ã¹ãã¾ãã
ã¨æã£ããã以ä¸ã®ãããªã¡ãã»ã¼ã¸ãåºã¦ãã¢ã¯ã»ã¹ã«å¤±æãã¦ãã¾ãã¾ãã
AttributeError: Cannot find an implementation of the "IPermissionStore" interface named "LdapPermissionStore". Please update the option trac.permission_store in trac.ini.
LdapPluginã®ã¤ã³ã¹ãã¼ã«ã¯ããã¦ãããããªã®ã§ãä½ãåå ãããããã¨èª¿ã¹ã¦ã¿ãã¨ãããã©ããããpythonã®LDAPã¢ã¸ã¥ã¼ã«ãä¸è¶³ãã¦ããããã§ãããã®ãããLdapPluginã¯ã¤ã³ã¹ãã¼ã«ãæ£å¸¸ã«å®äºãã¦ããå¦çããã¨ãã«ã¨ã©ã¼ã¨ãªã£ã¦ããããã§ãã
ãããã«ãLdapPluginã®ãµã¤ããè¯ãè¦ãã¨ããYou need the Python LDAP module. It can be retrieved from python-ldap.ãã¨æ¸ãã¦ããã»ã»ã»ã
Windowsç¨ã®python-ldapã¢ã¸ã¥ã¼ã«ã¯ã以ä¸ã®ãµã¤ããããã¦ã³ãã¼ãã§ãã¾ãã
http://www.osuch.org/python-ldap
ã¤ã³ã¹ãã¼ã«æã«ãPythonã®ã¤ã³ã¹ãã¼ã«ãã£ã¬ã¯ããªãè¦æ±ããã¾ããã以ä¸ã®ãã£ã¬ã¯ããªãæå®ããã°OKã§ãã
<TracLight_HOME>\python
å度ãSampleProjectã«ã¢ã¯ã»ã¹ãã¾ãã
LDAPã®è¨å®ãæå¹ã«ãªã£ã¦ããã°ãã403 Forbiddenãã¨ç»é¢ã«è¡¨ç¤ºãããã¯ãã§ããããã¯ã権éã®è¨å®å
ããDefaultPermissionStoreããLdapPermissionStoreã«å¤ãã£ããã¨ã«ãããTracã¸ã®æ¨©éè¨å®ãæªè¨å®ã®ç¶æ
ã«ãªã£ãããã§ãã
trac.iniã§ãDefaultPermissionStoreã®ã¾ã¾ã«ãã¦ããã¦ããLDAPãã権éæ å ±ã¯åå¾ããã¾ãããtrac-adminã³ãã³ãã§æå®ãã権éãLDAPã«ç»é²ããå ´åã¯ãLdapPermissionStoreãæå®ãã¦ããå¿ è¦ãããã¾ãã
ãã¦ãmanager01ã§ãã°ã¤ã³ããã¨ãLDAPã§æå®ãã権éã«åºã¥ããTracã®æ¨©éãæå¹ã«ãªã£ã¦ããã¯ãã§ããmanager01ã¯ãTRAC_ADMIN権éãä¿æããmanagersã°ã«ã¼ãã«å±ãã¦ããã®ã§ãå
¨ã¦ã®æä½ãå¯è½ã«ãªã£ã¦ããã¯ãã§ãã
ã管çï¼adminï¼ãã¿ããã¯ãªãã¯ããããã¼ããã·ã§ã³ï¼Permissionsï¼ãã®æ
å ±ã確èªããã¨ã以ä¸ã®ãããªè¨å®ã確èªã§ãã¾ãã
対象 | ã¢ã¯ã·ã§ã³ |
---|---|
@managers | TRAC_ADMIN |
manager01 | @managers |
ãã®æ¨©éã¯ãtarc-adminã³ãã³ããå©ç¨ãã¦ãåç
§ï¼è¿½å ï¼åé¤ãããã¨ãå¯è½ã§ãã
- åç §
>trac-admin <TracLight_HOME>\project\trac\SampleProject permission list
- 追å
>trac-admin <TracLight_HOME>\project\trac\SampleProject permission add @<ã°ã«ã¼ãID> TRAC_ADMIN
- åé¤
>trac-admin <TracLight_HOME>\project\trac\SampleProject permission remove @<ã°ã«ã¼ãID> TRAC_ADMIN
ã°ã«ã¼ãã¸æ¨©éãä»ä¸ããã¨ãã¯ãLDAPã§å®ç¾©ããã¦ããã°ã«ã¼ãIDã®å
é ã«ã@ããä»ãã¾ãã
ãµã
ã
大åãé·æã«ãªã£ã¦ãã¾ãã¾ããããããã§ãLDAPãå©ç¨ãã¦ãTracã®èªè¨¼ï¼æ¨©éã®ç®¡çãè¡ããããã«ãªãã¾ãããTrac0.10ã®å ´åãåæ§ã«ã§ããã¯ãã§ãã
èªè¨¼ã¯Apacheã®è¨å®ã権éã¯Tracã®è¨å®ã¨ãªãã¾ãããããããã®å®ç¾©ã¯ç¬ç«ãããã®ãªã®ã§ãå¤æ´ããéã¯ä¸¡æ¹ã®å®ç¾©ãæ´æ°ããå¿ è¦ãããã¾ãã