cancel
Showing results for 
Search instead for 
Did you mean: 

Authentication and Sync - Alf 4.2 with Mountain Lion 10.8.2

peterglock
Champ in-the-making
Champ in-the-making
This is a followup to a post I made with a working Alf 4.0 to Lion Server configuration. This config did not work when I upgraded to Alf 4.2 on Mountain Lion so I thought I'd post my updated configs here to help anyone else who may be bashing their head against the wall.

Here are the basic steps (paths on your installation may vary):

1. Create the authentication subsystem folder
mkdir -p /Applications/alfresco-4.2.b/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/Authentication/ldap/ldap1‍

2. Create the LDAP authentication and sync file
nano /Applications/alfresco-4.2.b/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/Authentication/ldap/ldap1/ldap-authentication.properties‍

3. Insert into ldap-authentication.properties file (and modify dc=company,dc=com to your own requirements):

# This flag enables use of this LDAP subsystem for authentication. It may be# that this subsytem should only be used for synchronization, in which case# this flag should be set to false.ldap.authentication.active=true## This properties file brings together the common options for LDAP authentication rather than editing the bean definitions#ldap.authentication.allowGuestLogin=true# How to map the user id entered by the user to that passed through to LDAP# - simple #    - this must be a DN and would be something like#      uid=%s,ou=People,dc=company,dc=com# - digest#    - usually pass through what is entered#      %s# If not set, an LDAP query involving ldap.synchronization.personQuery and ldap.synchronization.userIdAttributeName will # be performed to resolve the DN dynamically. This allows directories to be structured and doesn't require the user ID to# appear in the DN.ldap.authentication.userNameFormat=uid=%s,cn=users,dc=company,dc=com#ldap.authentication.userNameFormat=%s# The read timeout in millisecondsldap.authentication.java.naming.read.timeout=500# The LDAP context factory to useldap.authentication.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory# The URL to connect to the LDAP server ldap.authentication.java.naming.provider.url=ldap://127.0.0.1:389# The authentication mechanism to use for password validationldap.authentication.java.naming.security.authentication=SIMPLE# Escape commas entered by the user at bind time# Useful when using simple authentication and the CN is part of the DN and contains commasldap.authentication.escapeCommasInBind=false# Escape commas entered by the user when setting the authenticated user# Useful when using simple authentication and the CN is part of the DN and contains commas, and the escaped \, is # pulled in as part of an LDAP sync# If this option is set to true it will break the default home folder provider as space names can not contain \ldap.authentication.escapeCommasInUid=false# Comma separated list of user names who should be considered administrators by defaultldap.authentication.defaultAdministratorUserNames=diradmin# This flag enables use of this LDAP subsystem for user and group# synchronization. It may be that this subsytem should only be used for # authentication, in which case this flag should be set to false.ldap.synchronization.active=true# The authentication mechanism to use for synchronizationldap.synchronization.java.naming.security.authentication=none# The default principal to use (only used for LDAP sync)ldap.synchronization.java.naming.security.principal=# The password for the default principal (only used for LDAP sync)ldap.synchronization.java.naming.security.credentials=# If positive, this property indicates that RFC 2696 paged results should be# used to split query results into batches of the specified size. This# overcomes any size limits imposed by the LDAP server.ldap.synchronization.queryBatchSize=0# If positive, this property indicates that range retrieval should be used to fetch# multi-valued attributes (such as member) in batches of the specified size.# Overcomes any size limits imposed by Active Directory.        ldap.synchronization.attributeBatchSize=0# The query to select all objects that represent the groups to import.ldap.synchronization.groupQuery=(objectclass\=apple-group)# The query to select objects that represent the groups to import that have changed since a certain time.ldap.synchronization.groupDifferentialQuery=(&(objectclass\=apple-group)(!(modifyTimestamp<\={0})))# The query to select all objects that represent the users to import.ldap.synchronization.personQuery=(objectclass\=inetOrgPerson)# The query to select objects that represent the users to import that have changed since a certain time.ldap.synchronization.personDifferentialQuery=(&(objectclass\=inetOrgPerson)(!(modifyTimestamp<\={0})))# The group search base restricts the LDAP group query to a sub section of tree on the LDAP server.ldap.synchronization.groupSearchBase=cn\=groups,dc\=company,dc\=com# The user search base restricts the LDAP user query to a sub section of tree on the LDAP server.ldap.synchronization.userSearchBase=cn\=users,dc\=company,dc\=com# The name of the operational attribute recording the last update time for a group or user.ldap.synchronization.modifyTimestampAttributeName=modifyTimestamp# The timestamp format. Unfortunately, this varies between directory servers.ldap.synchronization.timestampFormat=yyyyMMddHHmmss'Z'# The attribute name on people objects found in LDAP to use as the uid in Alfrescoldap.synchronization.userIdAttributeName=uid# The attribute on person objects in LDAP to map to the first name property in Alfrescoldap.synchronization.userFirstNameAttributeName=givenName# The attribute on person objects in LDAP to map to the last name property in Alfrescoldap.synchronization.userLastNameAttributeName=sn# The attribute on person objects in LDAP to map to the email property in Alfrescoldap.synchronization.userEmailAttributeName=mail# The attribute on person objects in LDAP to map to the organizational id  property in Alfrescoldap.synchronization.userOrganizationalIdAttributeName=apple-company# The default home folder provider to use for people created via LDAP importldap.synchronization.defaultHomeFolderProvider=largeHomeFolderProvider# The attribute on LDAP group objects to map to the authority name property in Alfrescoldap.synchronization.groupIdAttributeName=cn# The attribute on LDAP group objects to map to the authority display name property in Alfrescoldap.synchronization.groupDisplayNameAttributeName=apple-group-realname# The group type in LDAPldap.synchronization.groupType=groups# The person type in LDAPldap.synchronization.personType=inetOrgPerson# The attribute in LDAP on group objects that defines the DN for its membersldap.synchronization.groupMemberAttributeName=memberUid# If true progress estimation is enabled. When enabled, the user query has to be run twice in order to count entries.ldap.synchronization.enableProgressEstimation=true‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

4. Set up authentication chain
nano /Applications/alfresco-4.2.b/tomcat/shared/classes/alfresco-global.properties‍
then add 
### Authentication Chain ###authentication.chain=ldap1:ldap,alfrescoNtlm1:alfrescoNtlm#Sync Settingssynchronization.synchronizeChangesOnly=falsesynchronization.syncOnStartup=truesynchronization.syncWhenMissingPeopleLogIn=truesynchronization.import.cron=0 0 * * * ?‍‍‍‍‍‍‍‍

5. Restart alfresco and try to login as diradmin (or any other user)

Some things to note:

1. Timeouts for ldap lookups were killing authentication, I had to set
ldap.authentication.java.naming.read.timeout=500‍
to get queries to complete

2. My alf implementation is on the same server as one of my OD replicas so I'm ok with using simple authentication and anonymous bind and ldap not ldaps. Setting
 ldap.authentication.java.naming.security.authentication=DIGEST-MD5‍
doesn't work for me

3. Turn on debugging in tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties made life a lot easier:
# LDAPlog4j.logger.org.alfresco.repo.importer.ImporterJob=debuglog4j.logger.org.alfresco.repo.importer.ExportSourceImporter=debuglog4j.logger.org.alfresco.repo.security.authentication.ldap=debug‍‍‍‍

Let me know if this works for you.
2 REPLIES 2

peterglock
Champ in-the-making
Champ in-the-making

I'm finding this forum a useful place to keep my implementation notes. Some other things to help those using OSX server 10.8 to host alfresco.

1. Disable the native webdav web app on the server: sudo webappctl stop com.apple.webapp.webdavsharing
2. TODO - setup a launchctl task to start tomcat/alfresco on reboot
3. SSL Proxy using apache:

sudo nano /Library/Server/Web/Config/apache2/webapps/com.example.alfresco.plist ‍

insert

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  <!-- See man pages for webapp.plist(5) and webappctl(8) for information about this example webapp.plist -->  <plist version="1.0"><dict><key>includeFiles</key><array> <!-- Include files are activated in virtual host when webapp is started --><string>/Library/Server/Web/Config/apache2/httpd_alfresco.conf</string></array><key>launchKeys</key><array> <!-- Launchd plists in /System/Library/LaunchDaemons are loaded when webapp is started --><!-- <string>com.example.mywebapp</string> --></array><key>name</key><string>com.example.alfresco</string> <key>sslPolicy</key> <!-- Determines webapp SSL behavior --><integer>0</integer> <!-- 0: default, UseSSLWhenEnabled --><!-- 1: UseSSLAlways --><!-- 2: UseSSLOnlyWhenCertificateIsTrustable --><!-- 3: UseSSLNever --><!-- 4: UseSSLAndNonSSL --></dict></plist>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

save it!

sudo nano /Library/Server/Web/Config/apache2/httpd_alfresco.conf‍

insert

RewriteEngine On# This will enable the Rewrite capabilities RewriteCond %{HTTPS} !=on# This checks to make sure the connection is not already HTTPS RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]  <IfModule mod_proxy_ajp.c>     ProxyPass /alfresco ajp://localhost:8009/alfresco     ProxyPassReverse /alfresco ajp://127.0.0.1:8009/alfresco     ProxyPass /share ajp://localhost:8009/share        ProxyPassReverse /share ajp://127.0.0.1:8009/share</IfModule>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

save it!

then start your web app: sudo webappctl start com.example.alfresco

If you want to setup a dedicated virtual host for alfresco (e.g. alfresco.example.com) you can limit the proxy to one virtual host by using sudo webappctl start com.example.alfresco alfresco.example.com

4. TODO - setup vti module to work through same ssl proxy

5. Install tomcat native

I used macports to install APR:

sudo port selfupdatesudo port upgrade outdatedsudo port install apr‍‍‍

then used the tomcat-native in Alfresco/tomcat/bin/

# Unpack the native library source codetar -xvzf tomcat-native.tar.gz # Change into the native source directorycd tomcat-native-1.1.24-src/jni/native # Build the make file./configure --with-apr=/usr/local/apr --with-ssl=/usr --with-java-home=/System/Library/Frameworks/JavaVM.framework/ # you may need to adjust this if using a different java to the Apple version # Makemake # Copy the native library to /usr/lib/javasudo cp .libs/libtcnative-1.0.1.24.dylib /usr/lib/java # Create a symbolic link in /usr/lib/java to the native librarycd /usr/lib/javasudo ln -sfhv libtcnative-1.0.1.24.dylib libtcnative-1.dylibsudo ln -sfhv libtcnative-1.dylib libtcnative-1.jnilib # Restart Tomcatshutdown.shstartup.sh # Check the log to make sure APR is loadedYou should see the following message in your log:INFO: Loaded APR based Apache Tomcat Native library 1.1.24‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

too dumb to think of an original sign off...

One of the challenges with Tomcat in general, and Alfresco's scripted startup in particular, is that the startup scripts get everything going and then exit. I found setup notes for Confluence <a>https://confluence.atlassian.com/display/CONF33/Start+Confluence+automatically+on+OS+X+using+launchd</a> which give some clues as to how to get things running smoothly. You'll have to adjust paths for your own setup, and modify for which user you run Alfresco under (root is not recommended!)

1 - create launchd_wrapper.sh in /Applications/alfresco-4.2d/bin

# A script to automatically start up Alfresco on system bootup# for Mac OS X. This is actually just a wrapper script around# the standard startup.sh script, which is included in# the distribution.## Suppress the annoying "$1: unbound variable" error when no option# was givenif [ -z $1 ] ; then        echo "Usage: $0 [start|stop|restart] "        exit 1fi# Source the common setup functions for startup scriptstest -r /etc/rc.common || exit 1. /etc/rc.common# The path to the startup script. # The currently used version is in /ApplicationsSCRIPT="/Applications/alfresco-4.2.d/alfresco.sh"# file to hold the process ID on start so it can be killed by stop.export CATALINA_PID="/Applications/alfresco-4.2.d/tomcat/temp/catalina.pid"StartService (){        ConsoleMessage "Starting Alfresco server"        $SCRIPT start > /dev/null 2>&1}StopService (){        ConsoleMessage "Stopping Alfresco server"        $SCRIPT stop > /dev/null 2>&1}RestartService (){        ConsoleMessage "Restarting Alfresco server"        $SCRIPT restart > /dev/null 2>&1}if test -x $SCRIPT ; then        RunService "$1"# Allow any signal which would kill a process to stop Alfresco   trap StopService HUP INT QUIT ABRT KILL ALRM TERM TSTP      while pgrep -F $CATALINA_PID > /dev/null; do sleep 1; doneelse        ConsoleMessage "Could not find Alfresco control script!"fi‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


2.  make it executable
sudo chmod a+x /Applications/alfresco-4.2d/bin/launchd_wrapper.sh ‍

3.  try it
sudo /Applications/alfresco-4.2d/bin/launchd_wrapper.sh start‍
You should be stuck in a loop until sending ^C to exit gracefully
4.  create plist file for launchd
 sudo nano /Library/LaunchDaemons/com.yourname.alfresco.plist‍

5.  paste the following
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict>   <key>Disabled</key>   <false/>   <key>Label</key>   <string>com.yourname.alfresco</string>   <key>ProgramArguments</key>   <array>      <string>/Applications/alfresco-4.2.d/bin/launchd_alfresco.sh</string>      <string>start</string>   </array>   <key>RunAtLoad</key>   <true/>   <key>UserName</key>   <string>root</string>   <key>WorkingDirectory</key>   <string>/Users/localadmin</string></dict></plist>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

6.  try it
sudo launchctl load -wF /Library/LaunchDaemons/com.yourname.alfresco.plist‍


Not the most elegant of coding, but it survives a reboot!
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.