Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
“License”); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
“AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Overview
FORTRESS, a sub-project of the Apache Directory, is a standards-based access management system, written in Java, that provides
role-based access control, delegated administration and password policy services using an LDAP backend.
This repo is contains the Apache Fortress Core component.
There are three other git repos that comprise the project:
The Apache Fortress pom.xml may run without connection to Internet if its dependencies are already present in local or intermediate maven repo.
Running mvn install calls out to maven-ant init-fortress-config task in build.xml to regenerate configuration artifacts (more info here: README-CONFIG).
SECTION 3. Options for using Apache Fortress and LDAP server
This document describes three options to use Apache Fortress with:
ApacheDS LDAP server
SECTION 4. Apache Fortress and ApacheDS LDAP server
Symas OpenLDAP server
SECTION 5. Apache Fortress and Symas OpenLDAP server
Pre-existing OpenLDAP server
SECTION 6. Apache Fortress and native OpenLDAP server
Options 1 & 2 are recommended for first-time users. Option 3 is for advanced users.
SECTION 4. Instructions for using Apache Fortress and ApacheDS LDAP server
include OPENLDAP_HOME/etc/openldap/schema/fortress.schema
For password policy support, enable pwpolicy overlay.
Add right before the ACL definitions:
moduleload ppolicy.la
For Fortress audit support, enable slapo accesslog overlay.
moduleload accesslog.la
Enable Fortress default DB.
# Default DB Settings
database mdb
maxreaders 64
maxsize 1000000000
suffix "dc=example,dc=com"
rootdn "cn=Manager,dc=example,dc=com"
rootpw "{SSHA}pSOV2TpCxj2NMACijkcMko4fGrFopctU"
index uidNumber,gidNumber,objectclass eq
index cn,sn,ftObjNm,ftOpNm,ftRoleName,uid,ou eq,sub
index ftId,ftPermName,ftRoles,ftUsers,ftRA,ftARA eq
directory "/var/openldap/dflt"
overlay accesslog
logdb "cn=log"
dbnosync
checkpoint 64 5
Enable Fortress slapo access log DB.
# History DB Settings (optional)
database mdb
maxreaders 64
maxsize 1000000000
suffix "cn=log"
rootdn "cn=Manager,cn=log"
rootpw "{SSHA}pSOV2TpCxj2NMACijkcMko4fGrFopctU"
index objectClass,reqDN,reqAuthzID,reqStart,reqAttr eq
directory "/var/openldap/hist"
access to *
by dn.base="cn=Manager,cn=log" write
dbnosync
checkpoint 64 5
Set the slapo access log usage policy on DB.
# Audit Log Settings (optional)
# note: the following settings may be tailored to your requirements:
logops bind writes compare
logoldattr ftModifier ftModCode ftModId ftRC ftRA ftARC ftARA ftCstr ftId ftPermName ftObjNm ftOpNm ftObjId ftGroups ftRoles ftUsers ftType
logpurge 5+00:00 1+00:00
Enable slapo pwpolicy overlay.
#######################################################################
# PW Policy Settings
#######################################################################
# Enable the Password Policy overlay to enforce password policies on this database.
overlay ppolicy
ppolicy_default "cn=PasswordPolicy,ou=Policies,dc=example,dc=com"
ppolicy_use_lockout
ppolicy_hash_cleartext
Add to OpenLDAP ACL’s.
### ACLs
access to dn="" by * read
access to *
by self write
by users read
by anonymous auth
by sockurl="^ldapi:///$" write
### This one allows user to modify their own password (needed for pw policies):
### This also allows user to modify their own ftmod attributes (needed for audit):
access to attrs=userpassword
by self write
by * auth
A few more for good measure.
# Never allow anonymous binds:
disallow bind_anon
# Speeds up member list processing for ldap group operations:
sortvals roleOccupant
# Convenience:
gentlehup on
# Sensible defaults:
sizelimit 5000
timelimit 60
threads 8
loglevel 32768
Create the dirs needed by the new slapd databases:
mkdir /var/openldap/dflt
mkdir /var/openldap/hist
Restart the slapd daemon. Ensure there are no errors.
Set the LDAP Host and port properties. Either a valid host name or IP address can be used. If you are running on the same platform as your LDAP server, localhost will do.
host=localhost
port=389
Set the suffix name and domain component. These may be set according to your requirements. For example suffix.name=example and suffix.dc=com turns into dc=example,dc=com.
suffix.name=example
suffix.dc=com
Optional - if a multi-level suffix needed, e.g. dc=foo, dc=example, dc=com.
Add to the file to enable LDAP connection pool parameters.
# Here we are testing with slapd's root user. Never do this in prod envs.
# This value contains dn of service account that has read/write access to fortress LDAP DIT:
root.dn=cn=Manager,${suffix}
# This the admin password:
cfg.root.pw=secret
# Specify the min/max settings for ADMIN conn pool w/ both read & write connections to default DB:
admin.min.conn=1
# The optimal setting for max is much fewer than concurrent number of users on system.
admin.max.conn=10
# Specify the min/max settings for USER conn pool with permission to bind to user objects as self:
user.min.conn=1
# The optimal setting for max will be much fewer than concurrent number of users.
user.max.conn=10
Enable the fortress audit and its connection pool.
This step is optional.
# If you have openldap accesslog overlay enabled, enable the Fortress audit with this param (default is true).
enable.audit=true
# This value contains dn of user that has read access to slapd access log database:
log.root.dn=cn=Manager,${log.suffix}
# This password is for same log user:
cfg.log.root.pw=secret
# The min/max settings for LOG pool w/ read permissions to slapo access log:
log.min.conn=1
# Very few needed because only used by AuditMgr during search operations:
log.max.conn=3
# Set more audit logger parameters (openldap only):
log.suffix=cn=log
# To enable slapd persistence on the following OpenLDAP operations:
log.ops=logops search bind writes
Rebuild the configuration artifacts:
mvn clean install
Perform an initial load to the target LDAP server:
Do not run this target with refreshLDAPData.xml on production systems as it deletes all nodes beneath the suffix before readding.
More usage notes of fortress build property files:
The defaults usually work.
The build.properties.example contains defaults for ApacheDS. This file is required and will activate once renamed to build.properties.
The slapd.properties.example is optional. Use only when OpenLDAP is the target server. Once renamed to slapd.properties, it will override any values found in the build.properties file.
Learn more about the configuration subsystem: README-CONFIG
Don’t change the ant substitution parameters within the properties unless you know what you’re doing. These are are the settings inside of curly brackets, e.g. ${param1}.
These will build the Directory Information Tree, load the configuration node and security policy needed for integration testing.
Never run in production environment as refreshLDAPData.xml tears down all nodes under the target suffix.
Next, from FORTRESS_HOME enter the following command:
mvn -Dtest=FortressJUnitTest test
Tests that all of the APIs and security functions work on your LDAP server.
If tests complete without errors Apache Fortress works with your LDAP server.
These tests load thousands of objects into the target ldap server. You should clear out the test data in the end.
Warning messages are negative tests in action.
SECTION 10. Instructions to load policy data using Apache Fortress Load utility
The Load utility is useful to create base policy configurations that need to be rerun many times in different test and production environments.
For samples look here: ./ldap/setup.
Create a load file using examples from FORTRESS_HOME/ldap/setup folder.
e.g. myLoadFile.xml
From FORTRESS_HOME folder, enter the following command:
SECTION 11. Instructions to run the Apache Fortress Command Line Interpreter (CLI)
The CLI is useful for ad-hoc policy administration in runtime environments.
From FORTRESS_HOME enter the following command:
mvn -Pcli test
Which starts the Fortress command line interpreter:
CommandLineInterpreter:176 - Startup to interactive mode success...
CommandLineInterpreter:183 - CLI function groups include admin, review, system, dadmin, group
CommandLineInterpreter:185 - Enter one from above or 'q' to quit
Where subsequent commands can be performed. For example to add a new user:
admin auser -u testuser1 -p mypasword123 -o dev1
2016-01-07 09:17:030 INFO CommandLineInterpreter:1078 - arg:admin
2016-01-07 09:17:030 INFO CommandLineInterpreter:1078 - arg:auser
2016-01-07 09:17:030 INFO CommandLineInterpreter:1078 - arg:-u
2016-01-07 09:17:030 INFO CommandLineInterpreter:1078 - arg:testuser1
2016-01-07 09:17:030 INFO CommandLineInterpreter:1078 - arg:-p
2016-01-07 09:17:030 INFO CommandLineInterpreter:1078 - arg:-o
2016-01-07 09:17:030 INFO CommandLineInterpreter:1078 - arg:dev1
2016-01-07 09:17:030 INFO CommandLineInterpreter:487 - auser
2016-01-07 09:17:030 INFO CommandLineInterpreter:683 - command:auser was successful
2016-01-07 09:17:030 INFO CommandLineInterpreter:183 - CLI function groups include admin, review, system, dadmin, group
2016-01-07 09:17:030 INFO CommandLineInterpreter:185 - Enter one from above or 'q' to quit
Or to interrogate users:
review fuser -u testuser1
2016-01-07 09:18:042 INFO CommandLineInterpreter:1078 - arg:review
2016-01-07 09:18:042 INFO CommandLineInterpreter:1078 - arg:fuser
2016-01-07 09:18:042 INFO CommandLineInterpreter:1078 - arg:-u
2016-01-07 09:18:042 INFO CommandLineInterpreter:1078 - arg:testuser1
2016-01-07 09:18:042 INFO CommandLineInterpreter:713 - fuser
2016-01-07 09:18:042 INFO CommandLineInterpreter:1443 - U CTR [0]
2016-01-07 09:18:042 INFO CommandLineInterpreter:1443 - U UID [testuser1]
2016-01-07 09:18:042 INFO CommandLineInterpreter:1443 - U IID [20ef2dfd-0b86-41a5-87d6-f7081e455d76]
2016-01-07 09:18:042 INFO CommandLineInterpreter:1443 - U CN [testuser1]
2016-01-07 09:18:042 INFO CommandLineInterpreter:1443 - U DESC [null]
2016-01-07 09:18:042 INFO CommandLineInterpreter:1443 - U OU [dev1]
2016-01-07 09:18:042 INFO CommandLineInterpreter:1443 - U SN [testuser1]
Or perform any of the other APIs as a shell program, follow instructions in the command line interpreter reference manual, contained within the generated javadoc:
SECTION 12. Instructions to run the Apache Fortress Command Console
The Command Console is an interactive program that is allows ad-hoc edit and reporting on data stored in LDAP server.
From FORTRESS_HOME enter the following command:
mvn -Pconsole test
Is a menu-driven program. Select option:
CHOOSE FUNCTION:
1. RBAC ADMIN MANAGER
2. RBAC REVIEW MANAGER
3. RBAC ACCESS MANAGER
4. ARBAC ADMIN MANAGER
5. ARBAC REVIEW MANAGER
6. ARBAC ACCESS MANAGER
7. PASSWORD POLICY MANAGER
8. AUDIT MANAGER
9. CONFIG MANAGER
A. ENCRYPTION MANAGER
B. GROUP MANAGER
C. RBAC ACCELERATOR MANAGER
Enter q or Q to quit
Option 1 performs Administrative operations:
CHOOSE ADMIN MANAGER FUNCTION:
1. Add User
2. Update User
3. Delete User
4. Unlock User
5. Lock User Account
6. Reset User Password
7. Change User Password
8. Add Perm Object
9. Add Perm Operation
0. Delete Perm
A. Add Role
B. Update Role
C. Delete Role
D. Assign User to Role
E. Deassign User from Role
F. Grant Perm to Role
G. Revoke Perm from Role
H. Grant Perm to User
I. Revoke Perm from User
J. Add Role Inheritance
K. Remove Role Inheritance
L. Add Role Ascendant
M. Add Role Descendant
N. Add SSD Data Set
O. Add DSD Data Set
Enter q or Q to return to previous menu
Option 2 performs Review operations:
CHOOSE REVIEW MANAGER FUNCTION:
0. Search Users
1. Search Users by OU
2. Get User by IID
3. Read User
4. Search Permissions
5. Read Permissions
6. Read Role
7. Search Roles
8. Perm Roles
9. Perm Users
A. Authorized Users
B. Role Permissions
C. Get Assigned Roles
Enter q or Q to return to previous menu
CHOOSE ACCESS MANAGER FUNCTION:
1. Authenticate
2. Create Session
3. Create Session Trusted
4. Create Session with Roles Trusted
5. Create Session with Props
6. Check Access - RBAC
7. Session Roles
8. Add Active Role to Session
9. Drop Active Role from Session
0. Show User Data in Session
A. Show UserId in Session
B. Session Permissions
Enter q or Q to return to previous menu
etc… for PW Policy, ARBAC, Groups.
SECTION 13. Instructions to build and test the Apache Fortress samples
Compile and re-run samples to test your changes using:
mvn -Dtest=AllSamplesJUnitTest test
Sample show how to use the APIs
e.g. How to Grant a Permission to a Role:
AdminMgr adminMgr = AdminMgrFactory.createInstance(TestUtils.getContext());
Role inRole = new Role(CreateRoleSample.TEST_ROLE_PREFIX + i);
// Permissions contain Object to Operation mapping and once created can then be targeted for assignment to Role entities in ldap:
Permission inPerm = new Permission(TEST_PERM_OBJECT, TEST_PERM_OPERATION_PREFIX + j);
// This API grant a Permission to a Role:
adminMgr.grantPermission(inPerm, inRole);
Sample Notes:
Test cases are simple and useful for learning how to code using Apache Fortress APIs.
Tests should complete without ERRORS.
These tests will load some records into the target ldap server.
The target may be run as many times as necessary and should be run at least twice to test the teardown.
The 2nd and subsequent times runs, it will tear down the data loaded during the prior run.
Which suspends the process waiting for connection on port specified, e.g. 5432.
fortress-load-debug:
[echo] ############### Run Fortress Ant script to load policy ###############
[startAnt] Listening for transport dt_socket at address: 5432
LICENSE
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Overview
Table of Contents
Document Overview
This document contains instructions to download, install, test, and manage an LDAP server using the Apache Fortress Core.
Tips for first-time users
SECTION 1. Prerequisites
Minimum software requirements:
SECTION 2. Download & Install
From Apache GIT Fortress-Core Software Repo: https://gitbox.apache.org/repos/asf?p=directory-fortress-core.git
Clone the SNAPSHOT:
Set Java and Maven home on machines.
From the FORTRESS_HOME root folder, enter the following command:
Install Notes:
mvn installcalls out to maven-ant init-fortress-config task in build.xml to regenerate configuration artifacts (more info here: README-CONFIG).SECTION 3. Options for using Apache Fortress and LDAP server
This document describes three options to use Apache Fortress with:
Options 1 & 2 are recommended for first-time users. Option 3 is for advanced users.
SECTION 4. Instructions for using Apache Fortress and ApacheDS LDAP server
SECTION 5. Instructions for using Apache Fortress and Symas OpenLDAP server
SECTION 6. Instructions for using Apache Fortress and native OpenLDAP server
Do these sections:
SECTION 7. Instructions for configuring OpenLDAP
For example:
A. On Debian systems: http://wiki.debian.org/LDAP/OpenLDAPSetup
B. Ubuntu: https://help.ubuntu.com/community/OpenLDAPServer
C. etc.
Add to the top of the file:
Add right before the ACL definitions:
Config Notes:
SECTION 8. Instructions for using Apache Fortress with OpenLDAP
This step is optional.
More usage notes of fortress build property files:
SECTION 9. Instructions to integration test
These will build the Directory Information Tree, load the configuration node and security policy needed for integration testing. Never run in production environment as refreshLDAPData.xml tears down all nodes under the target suffix.
Tests that all of the APIs and security functions work on your LDAP server.
Notice that more tests ran this time vs the first time, due to teardown.
Test Notes:
SECTION 10. Instructions to load policy data using Apache Fortress Load utility
The Load utility is useful to create base policy configurations that need to be rerun many times in different test and production environments. For samples look here: ./ldap/setup.
e.g. myLoadFile.xml
Policy Load Notes:
SECTION 11. Instructions to run the Apache Fortress Command Line Interpreter (CLI)
The CLI is useful for ad-hoc policy administration in runtime environments.
SECTION 12. Instructions to run the Apache Fortress Command Console
The Command Console is an interactive program that is allows ad-hoc edit and reporting on data stored in LDAP server.
SECTION 13. Instructions to build and test the Apache Fortress samples
View and change the samples here: ./src/test/java/org/apache/directory/fortress/core/samples
Compile and re-run samples to test your changes using:
Sample Notes:
SECTION 14. Howto Debug a load script
Which suspends the process waiting for connection on port specified, e.g. 5432.
Set breakpoints in FortressAntTask
Connect with the JDB on the specified port.
END OF README