這個問題最初發布在karaf用戶郵件列表,但我沒有得到一個答案:從 http://karaf.922171.n3.nabble.com/Deleting-an-unnecessary-login-module-td4033321.html在Apache中刪除不必要的登錄模塊Karaf
我想刪除登錄模塊(PublicKeyLoginModule)默認的jaas karaf領域。
根據文檔: http://karaf.apache.org/manual/latest/developers-guide/security-framework.html
「所以,如果你想覆蓋Karaf默認安全配置(這是使用ssh的外殼,Web控制檯和 JMX層),你需要部署JAAS配置的名稱爲name =「karaf」,rank =「1」。「
但是,當我這樣做時,添加了新模塊而不是替換現有模塊。
當下面的藍圖通過部署目錄加載或通過包含在一個包中(通過包含來自以下路徑的藍圖使用Maven創建) src \ main \ resources \ OSGI-INF \ blueprint \ context.xml
我得到如下:
[email protected]()> jaas:realm-list
Index | Realm Name | Login Module Class Name
-----------------------------------------------------------------------------------
1 | karaf | org.apache.karaf.jaas.modules.properties.PropertiesLoginModule
2 | karaf | org.apache.karaf.jaas.modules.publickey.PublickeyLoginModule
3 | karaf | org.apache.karaf.jaas.modules.ldap.LDAPLoginModule
我想看到的要麼是
[email protected]()> jaas:realm-list
Index | Realm Name | Login Module Class Name
-----------------------------------------------------------------------------------
1 | karaf | org.apache.karaf.jaas.modules.ldap.LDAPLoginModule
或者,如果有於exp方式合法地刪除模塊:
[email protected]()> jaas:realm-list
Index | Realm Name | Login Module Class Name
-----------------------------------------------------------------------------------
1 | karaf | org.apache.karaf.jaas.modules.properties.PropertiesLoginModule
2 | karaf | org.apache.karaf.jaas.modules.ldap.LDAPLoginModule
這是藍圖:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:jaas="http://karaf.apache.org/xmlns/jaas/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
<type-converters>
<bean class="org.apache.karaf.jaas.modules.properties.PropertiesConverter"/>
</type-converters>
<!-- Allow usage of System properties, especially the karaf.base property -->
<ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
<!-- AdminConfig property place holder for the org.apache.karaf.jaas -->
<cm:property-placeholder persistent-id="org.apache.karaf.jaas" update-strategy="none">
<cm:default-properties>
<cm:property name="example.group" value="example-group-value"/>
</cm:default-properties>
</cm:property-placeholder>
<jaas:config name="karaf" rank="1">
<jaas:module className="org.apache.karaf.jaas.modules.ldap.LDAPLoginModule" flags="required">
connection.url = ldap://ldap.example.com:389
user.base.dn = o= example.com
user.filter = (uid=%u)
user.search.subtree = true
role.base.dn = ou=applications,l=global,o= example.com
role.filter = (&(objectClass=groupOfUniqueNames)(uniqueMember=*uid=%u*)(cn=${ example.group}))
role.name.attribute = cn
role.search.subtree = true
authentication = simple
</jaas:module>
</jaas:config>
</blueprint>
[email protected]()> shell:info
Karaf
Karaf version 3.0.0
Karaf home ***
Karaf base ***
OSGi Framework org.apache.felix.framework - 4.2.1
同一問題上Karaf 3.0.1
我歡迎任何建議。創建一個全新的領域是一種可能性,但出於政策原因,我寧願不要在運行時中顯示PublicKeyLoginModule。