From ddebdef0b4f0451f6b481776f40d8c6fb13e0e9d Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Fri, 29 Oct 2010 14:37:27 +0200 Subject: [PATCH] [remaster/mcs] more jboss config work --- .../mcs/mailware-jboss-conf/jboss-log4j.xml | 323 ++++++++++++++++++ .../login-config.xml.aggregation.babel | 102 ++++++ remaster/mcs/scripts/mcs-ldapinit.pl | 201 +++++++++++ .../remaster_mcs_inner_chroot_script_after.sh | 9 +- 4 files changed, 634 insertions(+), 1 deletion(-) create mode 100644 remaster/mcs/mailware-jboss-conf/jboss-log4j.xml create mode 100644 remaster/mcs/mailware-jboss-conf/login-config.xml.aggregation.babel create mode 100644 remaster/mcs/scripts/mcs-ldapinit.pl diff --git a/remaster/mcs/mailware-jboss-conf/jboss-log4j.xml b/remaster/mcs/mailware-jboss-conf/jboss-log4j.xml new file mode 100644 index 0000000..9346044 --- /dev/null +++ b/remaster/mcs/mailware-jboss-conf/jboss-log4j.xml @@ -0,0 +1,323 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/remaster/mcs/mailware-jboss-conf/login-config.xml.aggregation.babel b/remaster/mcs/mailware-jboss-conf/login-config.xml.aggregation.babel new file mode 100644 index 0000000..2936c86 --- /dev/null +++ b/remaster/mcs/mailware-jboss-conf/login-config.xml.aggregation.babel @@ -0,0 +1,102 @@ + + + + + ldap://localhost:389/dc=babel,dc=it + dc=babel,dc=it + + + cn=sa role + cn=admin role + true + passwordExpirationTime + + + + + + + + com.sun.jndi.ldap.LdapCtxFactory + ldap://localhost:389/ + simple + uid= + ,ou=People,dc=babel,dc=it + ou=Groups,dc=babel,dc=it + uniqueMember + true + cn + false + + + + + + + + imap + localhost + 143 + false + + + false + + + + ldap://localhost:389/dc=babel,dc=it + dc=babel,dc=it + + + cn=sa role + cn=admin role + true + passwordExpirationTime + 10 + 20 + 300000 + + + + + + + + + + + imap + localhost + + 143 + false + + + true + javax.net.ssl.SSLSocketFactory + false + 993 + + + + + + + + + + + ldap://localhost:389/dc=babel,dc=it + dc=babel,dc=it + + + cn=sa role + cn=admin role + true + passwordExpirationTime + + + + + diff --git a/remaster/mcs/scripts/mcs-ldapinit.pl b/remaster/mcs/scripts/mcs-ldapinit.pl new file mode 100644 index 0000000..9d4acb2 --- /dev/null +++ b/remaster/mcs/scripts/mcs-ldapinit.pl @@ -0,0 +1,201 @@ +#!/usr/bin/perl +# author rgiannetto@babel.it, rpolli@babel.it +# +# create the ldif file used to initialize Fedora Directory Server +# with Mailware Collaboration Suite +# +# specify by command line the following arguments: +# first administator domain (ex. babel.it ) +# dn (the base dn ex. $dn) +# username - the username of the SA +# password - the password of the SA +# aisle - the name of the mail aisle +use Getopt::Std; +our %opt; +our $domain, $dn, $user, $password, $isola, $addressbooks, $mailAlternateAddress; + +my $numArgs = $#ARGV + 1; + +if($numArgs < 10) { + printf(STDERR "Usage: mcs-ldapinit.pl -d [dominio] -b [basedn] -s [sa user] -p [sa password] -a [aisle name] [-B addressbook basedn ] [-f output file]]\n"); + printf(STDERR " + specify by command line the following arguments: + -d first administator domain (ex. babel.it ) + -b dn (the base dn ex. $dn) + -s username - the username of the SA + -p password - the password of the SA + -a aisle - the name of the mail aisle + -B \"db1,db2\" - the databases to create under your server + -f filename.ldif - the output file + + EXAMPLE: + # mcs-ldapinit.pl babel.it \"$dn\" sa secret node1 -f base.ldif + # ldapmodify -a -D \"cn=directory manager\" -W -f base.ldif +"); + exit(0); +} +getopts('vd:b:s:p:a:B:f:', \%opt); # options as above. Values in %opts +$domain = $opt{'d'}; +$dn =$opt{'b'}; +$user = $opt{'s'}; +$password = $opt{'p'}; +$isola = $opt{'a'}; +$addressbooks = $opt{'B'}; +$mailAlternateAddress = $opt{'m'}; +$ldifFileName = $opt{'f'}; + +if ($opt{'v'}) { + print STDERR "parameters $domain\n$dn\n$user\n$password\n$isola\n$addressbooks\n"; +} + +sub create_calendar_ldif() { + open (FH, ">>$ldifFileName") + or die("Cannot create $ldifFileName: ".$!); + + printf(FH "dn: uid=caladmin,ou=People,$dn\n"); + printf(FH "businessCategory: sa\n"); + printf(FH "userPassword: $password\n"); + printf(FH "mail: caladmin\n"); + printf(FH "uid: caladmin\n"); + printf(FH "givenName: caladmin\n"); + printf(FH "objectClass: top\n"); + printf(FH "objectClass: person\n"); + printf(FH "objectClass: organizationalPerson\n"); + printf(FH "objectClass: inetorgperson\n"); + printf(FH "objectClass: mailrecipient\n"); + printf(FH "objectClass: babmware\n"); + printf(FH "objectClass: babmwcompany\n"); + printf(FH "sn: caladmin\n"); + printf(FH "cn: caladmin caladmin\n"); + printf(FH "\n"); + printf(FH "\n"); + printf(FH "dn: uid=public-user,ou=People,$dn\n"); + printf(FH "mail: public-user\n"); + printf(FH "uid: public-user\n"); + printf(FH "givenName: public\n"); + printf(FH "objectClass: top\n"); + printf(FH "objectClass: person\n"); + printf(FH "objectClass: organizationalPerson\n"); + printf(FH "objectClass: inetorgperson\n"); + printf(FH "sn: user\n"); + printf(FH "cn: public user\n"); + printf(FH "\n"); + printf(FH "dn: uid=realtime01,ou=People,$dn\n"); + printf(FH "objectClass: top\n"); + printf(FH "objectClass: person\n"); + printf(FH "objectClass: organizationalPerson\n"); + printf(FH "objectClass: inetOrgPerson\n"); + printf(FH "objectClass: babmwcompany\n"); + printf(FH "mail: realtime01\n"); + printf(FH "givenName: realtime01\n"); + printf(FH "uid: realtime01\n"); + printf(FH "sn: realtime01\n"); + printf(FH "cn: realtime01\n"); + printf(FH "businessCategory: sa\n"); + printf(FH "\n"); + + close(FH); +} + +sub create_ldif() { + open (FH, ">$ldifFileName") + or die("Cannot create $ldifFileName: ".$!); + printf(FH "# Service Administrators \n"); + printf(FH "# the tree of the MCS administration\n"); + printf(FH "dn: ou=Service Administrators,$dn\n"); + printf(FH "changetype: add\n"); + printf(FH "description: Tree containing all Service Administrators\n"); + printf(FH "ou: Service Administrators\n"); + printf(FH "objectClass: top\n"); + printf(FH "objectClass: organizationalunit\n"); + printf(FH "\n"); + + printf(FH "# The first administrator\n"); + printf(FH "# $user, Service Administrators, $domain\n"); + printf(FH "dn: uid=$user,ou=Service Administrators,$dn\n"); + printf(FH "changetype: add\n"); + printf(FH "mail: $user\@$domain\n"); + printf(FH "uid: $user\n"); + printf(FH "givenName: Service\n"); + printf(FH "objectClass: top\n"); + printf(FH "objectClass: person\n"); + printf(FH "objectClass: organizationalPerson\n"); + printf(FH "objectClass: inetorgperson\n"); + printf(FH "objectClass: babmwcompany\n"); + printf(FH "sn: Administrator\n"); + printf(FH "cn: Service Administrator\n"); + printf(FH "userPassword: $password\n"); + printf(FH "businessCategory: sa\n"); + # !!! DOESN'T WORK !!! + # printf(FH "mailAlternateAddress: $mailAlternateAddress\n"); + printf(FH "\n"); + + printf(FH "# sa role, $domain\n"); + printf(FH "dn: cn=sa role,$dn\n"); + printf(FH "changetype: add\n"); + printf(FH "nsRoleFilter: (&(businesscategory=sa)(objectclass=inetorgperson)(objectclass=babmwcompany))\n"); + printf(FH "objectClass: top\n"); + printf(FH "objectClass: ldapsubentry\n"); + printf(FH "objectClass: nsroledefinition\n"); + printf(FH "objectClass: nscomplexroledefinition\n"); + printf(FH "objectClass: nsfilteredroledefinition\n"); + printf(FH "cn: sa role\n"); + printf(FH "\n"); + + printf(FH "# sa role, aci\n"); + printf(FH "dn: $dn\n"); + printf(FH "changetype: modify\n"); + printf(FH "add: aci\n"); + printf(FH "ACI: (targetattr = \"*\") (version 3.0;acl \"SA administration\";allow (all)(roledn = \"ldap:///cn=SA role,$dn\");)\n"); + printf(FH "\n"); + + printf(FH "# isola-mcs, $domain\n"); + printf(FH "dn: node=$isola, $dn\n"); + printf(FH "changetype: add\n"); + printf(FH "node: $isola\n"); + printf(FH "objectClass: top\n"); + printf(FH "objectClass: babmwcompany\n"); + printf(FH "\n"); + + if (defined $addressbooks) { + foreach my $i (split(/[, ]+/, $addressbooks)) { + printf(FH "# Create database and BackendInstance for storing personal contacts\n"); + printf(FH "dn: cn=Addressbook%s,cn=ldbm database,cn=plugins,cn=config\n", $i); + printf(FH "objectclass: extensibleObject\n"); + printf(FH "objectclass: nsBackendInstance\n"); + printf(FH "nsslapd-suffix: o=%s\n", $i); + printf(FH "\n"); + printf(FH "dn: cn=\"o=%s\",cn=mapping tree,cn=config\n", $i); + printf(FH "objectclass: top\n"); + printf(FH "objectclass: extensibleObject\n"); + printf(FH "objectclass: nsMappingTree\n"); + printf(FH "nsslapd-state: backend\n"); + printf(FH "nsslapd-backend: Addressbook%s\n", $i); + printf(FH "cn: \"o=%s\"\n", $i); + printf(FH "\n"); + printf(FH "dn: o=%s\n",$i); + printf(FH "objectclass: top\n"); + printf(FH "objectclass: organization\n"); + printf(FH "o: %s\n", $i); + printf(FH "\n"); + } + } + close(FH); +} + +sub create_balance() { + $addressbooks =~ s/ +//g; + my $command = "bash -c './balance.sh $isola:ldap://localhost:389/{$addressbooks}'"; + print STDERR "executing $command\n" if ($opt{'v'}); + + system($command) == 0 + or die("Error creating balance.xml"); +} + +sub main() { + &create_ldif; + &create_calendar_ldif; + # &create_balance; +} + +&main; diff --git a/scripts/3rdparty/remaster_mcs_inner_chroot_script_after.sh b/scripts/3rdparty/remaster_mcs_inner_chroot_script_after.sh index d9a2522..7741b9c 100755 --- a/scripts/3rdparty/remaster_mcs_inner_chroot_script_after.sh +++ b/scripts/3rdparty/remaster_mcs_inner_chroot_script_after.sh @@ -91,8 +91,15 @@ chown root:root /usr/sbin/mcs-ldapinit.pl || exit 1 # copy jboss data over echo "Copying jboss-bin deploy data over" -mv /tmp/jboss-deploy/* /opt/jboss-bin-4.2/server/default/deploy/ || exit 1 +cp /tmp/jboss-deploy/* /opt/jboss-bin-4.2/server/default/deploy/ -Rp || exit 1 chown jboss:jboss /opt/jboss-bin-4.2/server/default/deploy/ -R || exit 1 +rm -r /tmp/jboss-deploy || exit 1 + +# setup jboss login info +cat /.mcs/mailware-jboss-conf/login-config.xml.aggregation.babel >> /opt/jboss-bin-4.2/server/default/conf/login-config.xml || exit 1 +chown jboss:jboss /opt/jboss-bin-4.2/server/default/conf/login-config.xml || exit 1 +cp /.mcs/mailware-jboss-conf/jboss-log4j.xml /opt/jboss-bin-4.2/server/default/conf/jboss-log4j.xml || exit 1 +chown jboss:jboss /opt/jboss-bin-4.2/server/default/conf/jboss-log4j.xml || exit 1 # setup 389 schema cp /.mcs/389-mailware-schema/* /etc/dirsrv/schema/ || exit 1