# HOWTO: OpenGroupware.org with OpenLDAP

## joemc91

This is just a howto based on my experiences getting opengroupware.org up and running (minus email, cause I can't seem to get the webmail portion to work).  It will use OpenLDAP for authentication.

This guide is written for someone with little linux experience or just shallow experience, like myself.

Stuff you'll need that isn't automatically downloaded, or at least not in the portage tree yet:

The OpenGroupware.org ebuild and associated files: https://bugs.gentoo.org/attachment.cgi?id=30316&action=view

The latest ebuild file (rename it to opengroupware-0.2.1-r2): https://bugs.gentoo.org/attachment.cgi?id=31433&action=view

Recommended USE flags: "ldap, imap, apache2, sasl2, sasl, pam", some of these are most likely redundant, but I know they work.

Step 1, Install OpenLDAP:

I reccommend following the official OpenLDAP guide (http://www.gentoo.org/doc/en/ldap-howto.xml).  The great thing about using OpenLDAP is you can configure opengroupware.org, cyrus, postfix, and the system to all authenticate off of it.

After getting OpenLDAP running according to the guide, open your slapd.conf file (usually in /etc/openldap/) and add the line

```
allow   bind_v2
```

This will allow opengroupware to bind to the server to authenticate a user.

Step 2, make sure the opengroupware ebuild file is ready

There have been a few cases the after downloading the latest ebuild file when running the emerge gives an error, usually a syntax error.  There's a really simple fix, open the latest ebuild file in your favorite text editor and simply save it.  That should do the trick.

Step 3, emerge opengroupware

Make sure ACCEPT_KEYWORDS="~x86".  This step takes a decent amount of time.

Step 4, configure postgresql.conf

Open "/var/lib/postgresql/data/postgresql.conf" (or whereever your data directory is) in your favorite text editor.

Find the commented line #tcpip_socket = false.  Uncomment it and change it to true: "tcpip_socket = true"

This will allow postgresql to listen for tcpip traffic

Step 5, start postgresql

You've got to do this manually.

Step 6, setup the opengroupware databases

Navigate to where you extracted your opengroupware folder to, mine's in /usr/portage/net-misc/opengroupware

configure the ebuild "ebuild opengroupware-0.2.1-r2 config" and watch the script make lots of tables.

Step 7, configure apache to load to opengroupware module

Add "-D OGo" to your apache opts (in /etc/conf.d/apache2 for those of you who are like me)

Step 8, configure opengroupware LDAP authentication

Open the NSGlobalDomain.plist file, usually in "/opt/opengroupware.org/.libFoundation/Defaults/NSGlobalDomain.plist" with your favorite text editor.

Add the following lines at the bottom of the file, but before the closing bracket:

```
LSAuthLDAPServer = "ldap.mydomain.com";

LSAuthLDAPServerRoot = "dc=mydomain,dc=com";
```

LSAuthLDAPServer is your ldap server's FQDN and LSAuthLDAPServerRoot is the LDAP root of your directory.

Step 9, create an LDAP root account for opengroupware

OpenGroupware normally authenticates to the passwd file and uses the root user to configure stuff.  If you're using LDAP, you must create a root user in the LDAP database.  I actually create the root LDAP user to have the same credentials as the standard root account so everything is through LDAP now.  Create an .ldif file such as this:

```

dn: uid=root,ou=People,dc=mydomain,dc=com

objectClass: organizationalPerson

objectClass: top

objectClass: posixAccount

objectClass: shadowAccount

uid: root

uidNumber: 0

gidNumber: 0

sn: Root

cn: Root

homeDirectory: /root

loginShell: /bin/bash

gecos: Root

```

Add the person to the directory using

```
ldapadd -x -D "cn=Manager,dc=mydomain,dc=com" -W -f root.ldif"
```

This is assuming the in your slapd.conf file (in /etc/openldap/) has the setting

```
rootdn   "cn=Manager,dc=mydomain,dc=com"
```

Do NOT logout!  Test this by trying to change the root's password.  Instead of giving the generic password changed reply, it should respond "LDAP password information changed for root".  If you want to you can comment out the root lines in both /etc/passwd and /etc/shadow and everything should be fine, the system will authenticate root against LDAP and still give the user root priveledges.  I don't reccomend deleting any lines so it's recoverable if ldap fails.

Step 10 (optional), set autologin for IMAP

Open the NSGlobalDomain.plist file again and add the following lines at the bottom:

```
imap_host = "imap.mydomain.com"

   UseSkyrixLoginForImap = YES;
```

Step 11, it works!  We hope

Start postgresql (if not still running), opengroupware, and apache2

Navigate to "http://ogo.mydomain.com/OpenGroupware" in your webbrowser and login as root, should work now!

Please note that you should not use the OpenGroupware user manager to create users this way, though it's good to set permissions this way.  If you want a graphical user manager, I personally like phpldapadmin.  It's currently masked as unstable, but it runs great and is extremely easy to setup and use.

Notes:

Postfix

Postfix works great with OpenGroupware, especially with authentication is done against OpenLDAP. To configure Postfix to allow delivery to LDAP users, add this code

```
alias_maps = hash:/etc/mail/aliases, ldap:ldapsource

ldapsource_server_host = ldap.mydomain.com

ldapsource_search_base = dc=mydomain,dc=com

ldapsource_bind = no

#the following enables authentication and sets security so non-local hosts can relay as long as they're authenticated

smtpd_sasl_auth_enable = yes

smtpd_sasl2_auto_enable = yes

smtpd_sasl_local_domain = $myhostname

smtpd_sasl_security_options = noanonymous

broken_sasl_auth_clients = yes   #for those poor souls using Outlook

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_relay_domains

#for those of you using cyrus imap, add the following, but you probably already knew this

mailbox_transport = cyrus
```

Adding "ldap:ldapsource" to the alias-maps will tell Postfix to look up users in LDAP as well as the standard user file.  The ...server_host and ...server_base tell postfix where to find the LDAP server and in which directory to start the search for users.  SASL auth is enabled to allow users to authenticate to relay.  This will have postfix authenticate the users against SASL, which will in turn authenticate against LDAP.

Cyrus-IMAPD

Cyrus is supposed to play well with OpenGroupware, it is actually the recommended imap server.  Unfortunately, I have not been able to get OpenGroupware to work with it.  The OpenGroupware program throws an exception whenever it tries to access a user's mailbox, I do not know why this is.  Hopefully the problem will be fixed soon.  Here's a quick HOWTO to make Cyrus auth against LDAP and automatically create mailboxes when an authenticated user accesses IMAP.  This means that all you have to do is create the user and the software does the rest!

	First, you must use the modified ebuild available here https://bugs.gentoo.org/show_bug.cgi?id=47803.  Make sure you download the specified patch and place it in your cyrus-imapd/files folder in the portage tree.  After setting Cyrus up and doing the initial configuration of imapd.conf, add/change these settings in the file

```
allowplaintext:      yes

sasl_pwcheck_method:   saslauthd   #allows use of PAM

authcreatequota:   -1      #no maximum number of folders created, but autocreation allowed

autocreateinboxfolders: Sent | Drafts | Trash | Junk
```

To enable imap to authenticate off of LDAP, add these lines to the TOP of your /etc/pam.d/imap file

```
auth      sufficient   /lib/security/pam_ldap.so

account      sufficient   /lib/security/pam_ldap.so
```

I hope this howto was helpful!

----------

## _GeG_

This is what I had to change to get it running, maybe it helps someone:

 *Quote:*   

> The latest ebuild file (rename it to opengroupware-0.2.1-r2): https://bugs.gentoo.org/attachment.cgi?id=31433&action=view

 I had to rename is to opengroupware-0.2.1-r2.ebuild to get it working.

When emerging opengroupware I got the following error:

something like:

Objective-C compiler not found

This is because on my system gcc was installed without objc support.

So I had to do

> USE="objc" emerge gcc

before emerging opengroupware

----------

## dashnu

I cant emerge opengroupware.

I downloaded the latest and greatest stuff and I get the following errors

```
 USE="ldap, imap, apache2, sasl2, sasl, pam" ACCEPT_KEYWORDS="~x86" emerge opengroupware-0.2.1-r2

Calculating dependencies

!!! Problem in null/opengroupware-0.2.1-r2 dependencies.

!!! "Specific key requires an operator (null/opengroupware-0.2.1-r2) (try adding an '=')"

```

what am i doing wrong?

----------

## dashnu

Ok think i got past that I added it to /usr/portage/net-misc/opengroupware

Than echo "net-misc/opengroupware ~x86" >> /etc/package.keywords

Than tried a emerge net-misc/opengroupware

and it blew up on me 

```
: command not foundsc/opengroupware/opengroupware-0.2.1-r2.ebuild: line 4:

: command not foundsc/opengroupware/opengroupware-0.2.1-r2.ebuild: line 8:

/usr/portage/net-misc/opengroupware/opengroupware-0.2.1-r2.ebuild: line 20: synt'x error near unexpected token `{

/usr/portage/net-misc/opengroupware/opengroupware-0.2.1-r2.ebuild: line 20: `pkg'setup() {

!!! ERROR: net-misc/opengroupware-0.2.1-r2 failed.

!!! Function , Line 1294, Exitcode 1

!!! error sourcing ebuild

aux_get(): (0) Error in net-misc/opengroupware-0.2.1-r2 ebuild. (1)

               Check for syntax error or corruption in the ebuild. (--debug)

Calculating dependencies

!!! all ebuilds that could satisfy "net-misc/opengroupware" have been masked.

!!! possible candidates are:

: command not foundsc/opengroupware/opengroupware-0.2.1-r2.ebuild: line 4:

: command not foundsc/opengroupware/opengroupware-0.2.1-r2.ebuild: line 8:

/usr/portage/net-misc/opengroupware/opengroupware-0.2.1-r2.ebuild: line 20: synt'x error near unexpected token `{

/usr/portage/net-misc/opengroupware/opengroupware-0.2.1-r2.ebuild: line 20: `pkg'setup() {

!!! ERROR: net-misc/opengroupware-0.2.1-r2 failed.

!!! Function , Line 1294, Exitcode 1

!!! error sourcing ebuild

aux_get(): (0) Error in net-misc/opengroupware-0.2.1-r2 ebuild. (1)

               Check for syntax error or corruption in the ebuild. (--debug)

!!! Error calculating dependencies. Please correct.

```

I also tried your "quick fix" no go.  Im sure i went about getting the emerge to go the wrong way any help would be kick ass

----------

## veurits

 *init-zero wrote:*   

> 
> 
> ```
> : command not foundsc/opengroupware/opengroupware-0.2.1-r2.ebuild: line 4:
> 
> ...

 

I had same problem , what you should do is dos2unix your ebuild file.

it has cr and ln characters on each line.

That is why you get a error on empty lines like 4 and 8.

----------

## dashnu

I got it to work but I did not use the ebuild. I downloaded the source. I however can not bind to our mail server. I can send e-mail but I can not "login" through the opengroup app. wierd

----------

## kyler

I seem close to having the opengroupware-0.2.1-r2 ebuild work...  after dos2unixing the ebuild file as well as having to run -

```
cd /usr/portage/net-misc/opengroupware; ebuild opengroupware-0.2.1-r2.ebuild digest
```

I then attempted to merge with the following command -

```
ACCEPT_KEYWORDS=~x86 USE="ldap imap apache2 sasl2 pam" emerge =net-misc/opengroupware-0.2.1-r2
```

--

it chugs for a while and feels close to merging before it bombs...  searching google comes up with one match in german - doesnt have much help there...  am I the only one with this problem?  I just need to modify the ebuild to generate the English_kde.lproj/components.cfg file somehow, if anyone has an extra copy handy I could probably hax my way to a merge.  Here's the error output --

---- extra build stuff chopped ----

 *Quote:*   

> Copying resources into install path ...
> 
> Making all in OGoFoundation...
> 
> Making all for library libOGoFoundation...
> ...

 

----------

## dashnu

This is my configured one, not sure if it will help ya.

/opt/opengroupware.org/WOApps/OpenGroupware.woa/Resources/English_kde.lproj

```
// do not modify, automatically created !

// $Id: components.cfg,v 1.5 2004/07/22 08:43:30 helge Exp $

{

        master = {

          colors_attributeCell          = "#E8E8E0";

          colors_bgColor                = "#FFFFFF";

          colors_evenRow                = "#F5F5E9";

          colors_footer                 = "#FFDAAA";

          colors_header                 = "#FFDAAA";

          colors_footerCell             = "#FFFFFF";

          colors_headerCell             = "#FFFFFF";

          colors_linkColor              = "#6F1537";

          colors_mainButtonRow          = "#E8E8E0";

          colors_oddRow                 = "#FFFFF0";

          colors_sortedAttributeCell    = "#E8E8E0";

          colors_subAttributeCell       = "#E8E8E0";

          colors_subValueCell           = "#FFFFF0";

          colors_tabLeaf                = "#F5F5E9";

          colors_tableHeaderRow         = "#E8E8E0";

          colors_textColor              = "black";

          colors_title                  = "white";

          colors_valueCell              = "#FFFFF0";

          colors_vlinkColor             = "#C97138";

          colors_windowContent          = "#D0D0D0";

          colors_panelContent           = "#D0D0D0";

          colors_tableViewHeaderCell    = "#E8E8E0";

          colors_tableViewFooterCell    = "#E8E8E0";

          colors_tableViewContentCell   = "#FFFFF0";

          colors_tableViewGroupCell     = "#E8E8E0";

          colors_tableViewAttributeCell = "#E8E8E0";

          // scheduler-title

          colors_showDayLink         = "black";

          colors_newAppointmentLink  = "black";

          // mails

          colors_mailBodyColor     = "#FFFFFF";

          colors_mailHeaderRow     = "#FFEABA";

          colors_messageBody       = "white";

          colors_partBody          = "white";

          colors_partHeader        = "#D0D0D0";

          colors_partTitleRow      = "#FFDAAA";

          colors_selectedMailColor = "#FAEFC5";

          // appointment proposal

          colors_fullHourCell    = "#FFDAAA"; //#AAAACC";

          colors_halfHourCell    = "#FFDAAA"; //#AAAACC";

          colors_appointmentCell = "#FFAAAA"; //colorForDate

          colors_fullupCell      = "#FAE8B8";

          // configurer (e.g. SkyPersonViewerConfig)

          colors_configHeader = "#FF7777";

          colors_configBody   = "#D0D0D0";

          colors_deleted_object  = "red";

          font_alertColor    = "red";

          font_color         = "black";

          font_face          = "Arial,Helvetica,Verdana,Geneva,Tahoma";

          font_size          = "2";

          editFont_color     = "";

          editFont_face      = "";

          editFont_size      = "3";

          windowFont_bgcolor = "black";

          windowFont_color   = "white";

          windowFont_face    = "Arial,Helvetica,Verdana,Geneva,Tahoma";

          windowFont_size    = "3";

          panelFont_bgcolor  = "black";

          panelFont_color    = "white";

          panelFont_face     = "Arial,Helvetica,Verdana,Geneva,Tahoma";

          panelFont_size     = "2";

          textField_size1     = "60";

          textField_size2     = "40";

          textField_rows1     = "10";

          textField_rows2     = "3";

          textField_rows3     = "30";

          textField_cols1     = "60";

          textField_cols2     = "80";

        };

}

```

----------

## dashnu

any ideas on how to connect from other computers on the net would be great. I can only connect through the localhost.

I have tried the following my apache2.conf

```
LoadModule ngobjweb_module <path to the ngobjweb module>

<LocationMatch "^/OpenGroupware/*">

SetHandler ngobjweb-adaptor

SetAppPort 20000

</LocationMatch>

Alias /OpenGroupware.woa/WebServerResources/ \

  /usr/lib/opengroupware.org/WebServerResources/
```

and

```
Defaults write OpenGroupware WOHttpAllowHost \

  '(localhost, myhost.mydomain)' 
```

err tough install I tell ya.

----------

## kyler

I'm making a bit more progress on my missing English_kde.lproj/components.cfg file....  It looks like my Defaults.plist in WebUI/ says to make English_kde but there is no English_kde dir there...  i'm going to try and hack the ebuild to maybe copy one of the other .lproj dirs - perhaps the opengroupware guys removed the *_kde stuff recently so I just need to update my ebuild to use English_orange.lproj instead of English_kde.lproj

-----

```
auth OpenGroupware.org # pwd

/var/tmp/portage/opengroupware-0.2.1-r2/work/opengroupware-0.2.1/WebUI/OpenGroupware.org

auth OpenGroupware.org # grep kde *

Defaults.plist:    English_kde,    German_kde

OGo.make:       English_kde                     \

OGo.make:       English_kde.lproj/components.cfg\

OGo.make:English_kde.lproj/components.cfg : English.lproj/components.cfg

auth OpenGroupware.org # find . -name "*kde*" -print

auth OpenGroupware.org #

```

----------

## kyler

>>> net-misc/opengroupware-0.2.1-r3 merged.

sweet...  ok so this is a total hack, and i'm not sure if the thing even works yet, but hey at least it completed a merge.  Basically i just patched the ebuild so _kde/English_blue is replaced with _OOo/English_orange in the WebUI Defaults.plist file and OGo.make...  ugly but worked so i'll make it pretty later after I test my merged opengroupware.

If anyone else is having trouble with the merge, this is the current workaround -

I had to cp opengroupware-0.2.1-r2.ebuild opengroupware-0.2.1-r3.ebuild and add the following lines after 

 *Quote:*   

>         make -s install  || die "make DocumentAPI failed"
> 
>         cd ${S}/WebUI

 

```
# *_kde stuff not found under WebUI/

        mv /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/Defaults.plist /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/Defaults.plistnew

        sed 's/\_kde/\_OOo/g' /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/Defaults.plistnew > /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/Defaults.plist

        mv /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/OGo.make /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/OGo.makenew

        sed 's/\_kde/\_OOo/g' /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/OGo.makenew > /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/OGo.make

# same with English_blue

        mv /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/Defaults.plist /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/Defaults.plistnew

        sed 's/English\_blue/English\_orange/g' /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/Defaults.plistnew > /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/Defaults.plist

        mv /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/OGo.make /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/OGo.makenew

        sed 's/English\_blue/English\_orange/g' /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/OGo.makenew > /var/tmp/portage/opengroupware-0.2.1-r3/work/opengroupware-0.2.1/WebUI/OpenGroupware.org/OGo.make

```

----------

## Carbs

I found that I had to manually emerge sudo otherwise the ebuild...config didn't work.

```
emerge sudo

ebuild opengroupware-0.2.1-r2.ebuild config

```

EDIT:  I tried on another machine using the same ebuild and sudo was emerge automatically.  How odd.

----------

## will_in_wi

I tried to install and got all the way to the end. I have one problem. When I connect to the server via web, I hit this:

```
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, xxxx@xxxxx.xxx and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
```

The server error log says: 

```
[error] connect to application instance failed, tried 3 times.
```

Any suggestions?

----------

## cweiske

It seems to me that the sources are not available at the place described in the ebuild.

Furthermore, the sources don't contain a configure script any more.

Does somebody have a new ebuild?

----------

## Haldir

use either the forum search or the bugzilla search

----------

## chous

 *will_in_wi wrote:*   

> I tried to install and got all the way to the end. I have one problem. When I connect to the server via web, I hit this:
> 
> ```
> Internal Server Error
> 
> ...

 

Maybe I'm too late  :Smile: . I got the same problem, to fix it you need to notice that the ebuild installed an init.d script.

When I tried  to start it with 

```
/etc/init.d/opengroupware start
```

, it complained with "invalid configuration folder /var/lib/opengroupware.org", so I followed the trivial fix commented in bugzilla https://bugs.gentoo.org/show_bug.cgi?id=24247#c177.

----------

## dirtbag

* checking ebuild checksums  :Wink:  ...                                      [ ok ]

 * checking auxfile checksums  :Wink:  ...                                     [ ok ]

 * checking miscfile checksums  :Wink:  ...                                    [ ok ]

 * checking gnustep-make-1.12.0.tar.gz  :Wink:  ...                            [ ok ]

i686-pc-linux-gnu-gcc: /var/tmp/portage/net-misc/opengroupware-1.1.6/temp/objc_t                     est.m: Objective-C compiler not installed on this system

 * ObjC Compiler is missing. Please re-emerge gcc with USE="objc"

!!! ERROR: net-misc/opengroupware-1.1.6 failed.

Call stack:

  ebuild.sh, line 1630:   Called dyn_setup

  ebuild.sh, line 702:   Called qa_call 'pkg_setup'

  ebuild.sh, line 38:   Called pkg_setup

  opengroupware-1.1.6.ebuild, line 94:   Called die

!!! (no error message)

!!! If you need support, post the topmost build error, and the call stack if rel                     evant.

!!! A complete build log is located at '/var/tmp/portage/net-misc/opengroupware-                     1.1.6/temp/build.log'.

so do I really gotta re-emerge gcc with USE="objc" ?!   :Sad: 

-db

----------

