steffen: server/perl-kolab/Kolab-Conf Conf.pm,1.61,1.62
cvs at intevation.de
cvs at intevation.de
Fri Jul 29 04:15:55 CEST 2005
Author: steffen
Update of /kolabrepository/server/perl-kolab/Kolab-Conf
In directory doto:/tmp/cvs-serv30765/perl-kolab/Kolab-Conf
Modified Files:
Conf.pm
Log Message:
Meta template config stuff. Much nicer than what we had before...
Index: Conf.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Kolab-Conf/Conf.pm,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- Conf.pm 26 Jul 2005 01:29:17 -0000 1.61
+++ Conf.pm 29 Jul 2005 02:15:52 -0000 1.62
@@ -62,6 +62,114 @@
our $VERSION = '0.9';
+
+my $templatedir = "$ap::config->{sysconfdir}/kolab/templates";
+
+my %special_templates = (
+ "$templatedir/transport.template" => 1,
+ "$templatedir/virtual.template" => 1,
+ "$templatedir/imapd.group.template" => 1,
+ "$templatedir/cyrus.conf.template" => 1,
+ "$templatedir/slapd.access.template" => 1,
+ "$templatedir/slapd.replicas.template" => 1);
+
+my %templates = ();
+my %ownership = ();
+my %permissions = ();
+
+# my %templates = (
+# "$templatedir/rc.conf.template" => "$ap::config->{sysconfdir}/rc.conf",
+# "$templatedir/session_vars.php.template" => "$ap::config->{webadmindir}/php/admin/include/session_vars.php",
+# "$templatedir/clamd.conf.template" => "$ap::config->{clamav_confdir}/clamd.conf",
+# "$templatedir/freshclam.conf.template" => "$ap::config->{clamav_confdir}/freshclam.conf",
+# "$templatedir/amavisd.conf.template" => "$ap::config->{sysconfdir}/amavisd/amavisd.conf",
+# "$templatedir/main.cf.template" => "$ap::config->{sysconfdir}/postfix/main.cf",
+# "$templatedir/ldapdistlist.cf.template" => "$ap::config->{sysconfdir}/postfix/ldapdistlist.cf",
+# "$templatedir/ldaptransport.cf.template" => "$ap::config->{sysconfdir}/postfix/ldaptransport.cf",
+# "$templatedir/ldapvirtual.cf.template" => "$ap::config->{sysconfdir}/postfix/ldapvirtual.cf",
+# "$templatedir/master.cf.template" => "$ap::config->{sysconfdir}/postfix/master.cf",
+# "$templatedir/transport.template" => "$ap::config->{sysconfdir}/postfix/transport",
+# "$templatedir/virtual.template" => "$ap::config->{sysconfdir}/postfix/virtual",
+# "$templatedir/saslauthd.conf.template" => "$ap::config->{sasl_confdir}/saslauthd.conf",
+# "$templatedir/imapd.conf.template" => "$ap::config->{imap_confdir}/imapd.conf",
+# "$templatedir/imapd.group.template" => "$ap::config->{imap_confdir}/imapd.group",
+# "$templatedir/cyrus.conf.template" => "$ap::config->{imap_confdir}/cyrus.conf",
+# "$templatedir/httpd.conf.template" => "$ap::config->{webserver_confdir}/apache.conf",
+# "$templatedir/httpd.local.template" => "$ap::config->{webserver_confdir}/apache.local",
+# "$templatedir/php.ini.template" => "$ap::config->{webserver_confdir}/php.ini",
+# "$templatedir/proftpd.conf.template" => "$ap::config->{ftpserver_confdir}/proftpd.conf",
+# "$templatedir/ldap.conf.template" => "$ap::config->{sysconfdir}/openldap/ldap.conf",
+# "$templatedir/slapd.conf.template" => "$ap::config->{sysconfdir}/openldap/slapd.conf",
+# "$templatedir/slapd.access.template" => "$ap::config->{sysconfdir}/openldap/slapd.access",
+# "$templatedir/slapd.replicas.template" => "$ap::config->{sysconfdir}/openldap/slapd.replicas",
+# "$templatedir/DB_CONFIG.slapd.template" => "$ap::config->{ldapserver_dir}/DB_CONFIG",
+# "$templatedir/freebusy.conf.template" => "$ap::config->{sysconfdir}/resmgr/freebusy.conf",
+# "$templatedir/fbview.conf.template" => "$ap::config->{sysconfdir}/resmgr/fbview.conf",
+# "$templatedir/resmgr.conf.template" => "$ap::config->{sysconfdir}/resmgr/resmgr.conf"
+# );
+
+# my %permissions = (
+# "$ap::config->{sysconfdir}/rc.conf" => 0644,
+# "$ap::config->{webadmindir}/php/admin/include/session_vars.php" => 0640,
+# "$ap::config->{sysconfdir}/resmgr/freebusy.conf" => 0640,
+# "$ap::config->{sysconfdir}/resmgr/fbview.conf" => 0640,
+# "$ap::config->{sysconfdir}/resmgr/resmgr.conf" => 0640,
+# "$ap::config->{sysconfdir}/postfix/main.cf" => 0644,
+# "$ap::config->{sysconfdir}/postfix/ldapdistlist.cf" => 0640,
+# "$ap::config->{sysconfdir}/postfix/ldaptransport.cf" => 0640,
+# "$ap::config->{sysconfdir}/postfix/ldapvirtual.cf" => 0640,
+# "$ap::config->{sysconfdir}/postfix/master.cf" => 0640,
+# "$ap::config->{clamav_confdir}/clamd.conf" => 0640,
+# "$ap::config->{clamav_confdir}/freshclam.conf" => 0640,
+# "$ap::config->{sysconfdir}/amavisd/amavisd.conf" => 0640,
+# "$ap::config->{sasl_confdir}/saslauthd.conf" => 0600,
+# "$ap::config->{imap_confdir}/imapd.conf" => oct($ap::config->{'imap_confperm'}),
+# "$ap::config->{webserver_confdir}/apache.conf" => 0640,
+# "$ap::config->{webserver_confdir}/apache.local" => 0640,
+# "$ap::config->{webserver_confdir}/php.ini" => 0640,
+# "$ap::config->{ftpserver_confdir}/proftpd.conf" => 0640,
+# "$ap::config->{sysconfdir}/openldap/slapd.conf" => 0640,
+# "$ap::config->{sysconfdir}/openldap/slapd.access" => 0640,
+# "$ap::config->{sysconfdir}/openldap/slapd.replicas" => 0640,
+# "$ap::config->{ldapserver_dir}/DB_CONFIG" => 0640,
+# "$ap::config->{sysconfdir}/openldap/ldap.conf" => 0644,
+# "$ap::config->{sysconfdir}/postfix/transport" => 0640,
+# "$ap::config->{sysconfdir}/postfix/virtual" => 0640,
+# "$ap::config->{imap_confdir}/cyrus.conf" => oct($ap::config->{'imap_confperm'}),
+# "$ap::config->{imap_confdir}/imapd.group" => oct($ap::config->{'imap_confperm'}));
+
+# my %ownership = (
+# "$ap::config->{sysconfdir}/rc.conf" => "kolab:kolab",
+# "$ap::config->{webadmindir}/php/admin/include/session_vars.php" => "kolab:kolab-n",
+# "$ap::config->{sysconfdir}/resmgr/freebusy.conf" => "kolab:kolab-n",
+# "$ap::config->{sysconfdir}/resmgr/fbview.conf" => "kolab:kolab-n",
+# "$ap::config->{sysconfdir}/resmgr/resmgr.conf" => "kolab:kolab-n",
+# "$ap::config->{sysconfdir}/postfix/main.cf" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
+# "$ap::config->{sysconfdir}/postfix/ldapdistlist.cf" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
+# "$ap::config->{sysconfdir}/postfix/ldaptransport.cf" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
+# "$ap::config->{sysconfdir}/postfix/ldapvirtual.cf" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
+# "$ap::config->{sysconfdir}/postfix/master.cf" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
+# "$ap::config->{clamav_confdir}/clamd.conf" => "kolab:kolab-r",
+# "$ap::config->{clamav_confdir}/freshclam.conf" => "kolab:kolab-r",
+# "$ap::config->{sysconfdir}/amavisd/amavisd.conf" => "kolab:kolab-r",
+# "$ap::config->{sasl_confdir}/saslauthd.conf" => "kolab:kolab",
+# "$ap::config->{imap_confdir}/imapd.conf" => "$ap::config->{imap_usr}:$ap::config->{imap_grp}",
+# "$ap::config->{webserver_confdir}/apache.conf" => "kolab:kolab-n",
+# "$ap::config->{webserver_confdir}/apache.local" => "kolab:kolab-n",
+# "$ap::config->{webserver_confdir}/php.ini" => "kolab:kolab-n",
+# "$ap::config->{ftpserver_confdir}/proftpd.conf" => "kolab:kolab-n",
+# "$ap::config->{sysconfdir}/openldap/ldap.conf" => "$ap::config->{ldapserver_usr}:$ap::config->{ldapserver_grp}",
+# "$ap::config->{sysconfdir}/openldap/slapd.conf" => "$ap::config->{ldapserver_usr}:$ap::config->{ldapserver_grp}",
+# "$ap::config->{sysconfdir}/openldap/slapd.access" => "$ap::config->{ldapserver_usr}:$ap::config->{ldapserver_grp}",
+# "$ap::config->{sysconfdir}/openldap/slapd.replicas" => "$ap::config->{ldapserver_usr}:$ap::config->{ldapserver_grp}",
+# "$ap::config->{ldapserver_dir}/DB_CONFIG" => "$ap::config->{ldapserver_usr}:$ap::config->{ldapserver_grp}",
+# "$ap::config->{sysconfdir}/postfix/transport" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
+# "$ap::config->{sysconfdir}/postfix/virtual" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
+# "$ap::config->{imap_confdir}/cyrus.conf" => "$ap::config->{imap_usr}:$ap::config->{imap_grp}",
+# "$ap::config->{imap_confdir}/imapd.group" => "$ap::config->{imap_usr}:$ap::config->{imap_grp}");
+
+
+
sub fixup {
my $file = shift;
my $ownership = shift;
@@ -88,7 +196,6 @@
my $owner = shift;
my $perm = shift;
my $oldcfg = $cfg . '.old';
- my $prefix = $Kolab::config{'prefix'};
my $oldmask = umask 077;
copy($cfg, $oldcfg);
@@ -187,7 +294,7 @@
#chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $cfg);
#chmod(0600, $cfg) if ($cfg =~ /openldap/);
- if (-f $oldcfg) {
+ if (-f $oldcfg && !defined $special_templates{$tmpl} ) {
my $rc = `diff -q $cfg $oldcfg`;
chomp($rc);
if ($rc) {
@@ -231,15 +338,15 @@
my $map = shift;
Kolab::log('T', "Building Postfix $map map", KOLAB_DEBUG);
- my $prefix = $Kolab::config{'prefix'};
- my $cfg = "$ap::config->{sysconfdir}/postfix/$map";
+ my $keytemplate = "$templatedir/$map.template";
+ my $cfg = $templates{$keytemplate};
my $oldcfg = $cfg . '.old';
- my $oldmask = umask 077;
- copy($cfg, $oldcfg);
- chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
- umask $oldmask;
- copy("$ap::config->{sysconfdir}/kolab/templates/$map.template", $cfg);
+ #my $oldmask = umask 077;
+ #copy($cfg, $oldcfg);
+ #chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
+ #umask $oldmask;
+ #delete $templates{$keytemplate};
my $transport;
if (!($transport = IO::File->new($cfg, 'a'))) {
@@ -283,6 +390,7 @@
# FIXME: bad way of doing things...
#system("chown root:root $ap::config->{sysconfdir}/postfix/*");
+ fixup( $cfg, $ownership{$cfg}, $permissions{$cfg});
system("$ap::config->{sbindir}/postmap $ap::config->{sysconfdir}/postfix/$map");
if (-f $oldcfg) {
@@ -303,45 +411,57 @@
{
Kolab::log('T', 'Building Cyrus config', KOLAB_DEBUG);
- my $prefix = $Kolab::config{'prefix'};
- my $cyrustemplate;
- if (!($cyrustemplate = IO::File->new("$ap::config->{sysconfdir}/kolab/templates/cyrus.conf.template", 'r'))) {
- Kolab::log('T', "Unable to open template file `cyrus.conf.template'", KOLAB_ERROR);
- exit(1);
- }
-
- my $cfg = "$ap::config->{imap_confdir}/cyrus.conf";
+ my $keytemplate = "$templatedir/cyrus.conf.template";
+ my $cfg = $templates{$keytemplate};
+ my $imapdtemplate = "$templatedir/imapd.conf.template";
+ my $imapdcfg = $templates{$imapdtemplate};
my $oldcfg = $cfg . '.old';
- my $oldmask = umask 077;
- copy($cfg, $oldcfg) or Kolab::log('T', "Unable to back up configuration file `$cfg'", KOLAB_WARN);
- chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
- umask $oldmask;
+ #delete $templates{$keytemplate};
+
+ #my $oldmask = umask 077;
+ #copy($cfg, $oldcfg);
+ #chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
+ #umask $oldmask;
my $cyrusconf;
+ my $cyrustemplate;
+ if (!($cyrustemplate = IO::File->new($keytemplate, 'r'))) {
+ Kolab::log('T', "Unable to open configuration file `$cfg'", KOLAB_ERROR);
+ exit(1);
+ }
+
if (!($cyrusconf = IO::File->new($cfg, 'w'))) {
Kolab::log('T', "Unable to open configuration file `$cfg'", KOLAB_ERROR);
exit(1);
}
while (<$cyrustemplate>) {
+ if (/^KOLAB_META_START$/) {
+ my $found_end;
+ while (!$found_end) {
+ $_ = <$cyrustemplate>;
+ $found_end = /^KOLAB_META_END$/;
+ }
+ $_ = <$cyrustemplate>;
+ }
if (/\@{3}cyrus-imap\@{3}/ && ($Kolab::config{"cyrus-imap"} =~ /true/i)) {
- $_ = "imap cmd=\"imapd -C $ap::config->{imap_confdir}/imapd.conf\" listen=\"143\" prefork=0\n";
+ $_ = "imap cmd=\"imapd -C $imapdcfg\" listen=\"143\" prefork=0\n";
}
elsif (/\@{3}cyrus-imap\@{3}/ && ($Kolab::config{"cyrus-imap"} =~ /false/i)) {
# Even if imapd is disabled, enable it for localhost -- resource handlers depend on it
- $_ = "imap cmd=\"imapd -C $ap::config->{imap_confdir}/imapd.conf\" listen=\"127.0.0.1:143\" prefork=0\n";
+ $_ = "imap cmd=\"imapd -C $imapdcfg\" listen=\"127.0.0.1:143\" prefork=0\n";
}
elsif (/\@{3}cyrus-pop3\@{3}/ && ($Kolab::config{"cyrus-pop3"} =~ /true/i)) {
- $_ = "pop3 cmd=\"pop3d -C $ap::config->{imap_confdir}/imapd.conf\" listen=\"110\" prefork=0\n";
+ $_ = "pop3 cmd=\"pop3d -C $imapdcfg\" listen=\"110\" prefork=0\n";
}
elsif (/\@{3}cyrus-imaps\@{3}/ && ($Kolab::config{"cyrus-imaps"} =~ /true/i)) {
- $_ = "imaps cmd=\"imapd -s -C $ap::config->{imap_confdir}/imapd.conf\" listen=\"993\" prefork=0\n";
+ $_ = "imaps cmd=\"imapd -s -C $imapdcfg\" listen=\"993\" prefork=0\n";
}
elsif (/\@{3}cyrus-pop3s\@{3}/ && ($Kolab::config{"cyrus-pop3s"} =~ /true/i)) {
- $_ = "pop3s cmd=\"pop3d -s -C $ap::config->{imap_confdir}/imapd.conf\" listen=\"995\" prefork=0\n";
+ $_ = "pop3s cmd=\"pop3d -s -C $imapdcfg\" listen=\"995\" prefork=0\n";
}
elsif (/\@{3}cyrus-sieve\@{3}/ && ($Kolab::config{"cyrus-sieve"} =~ /true/i)) {
- $_ = "sieve cmd=\"timsieved -C $ap::config->{imap_confdir}/imapd.conf\" listen=\"2000\" prefork=0\n";
+ $_ = "sieve cmd=\"timsieved -C $imapdcfg\" listen=\"2000\" prefork=0\n";
}
$_ =~ s/\@{3}.*\@{3}//;
print $cyrusconf $_;
@@ -350,7 +470,7 @@
$cyrustemplate->close;
$cyrusconf->close;
- chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $cfg);
+ fixup( $cfg, $ownership{$cfg}, $permissions{$cfg});
if (-f $oldcfg) {
my $rc = `diff -q $cfg $oldcfg`;
@@ -370,15 +490,16 @@
{
Kolab::log('T', 'Building Cyrus groups', KOLAB_DEBUG);
- my $prefix = $Kolab::config{'prefix'};
- my $cfg = "$ap::config->{imap_confdir}/imapd.group";
+ my $keytemplate = "$templatedir/imapd.group.template";
+ my $cfg = $templates{$keytemplate};
my $oldcfg = $cfg . '.old';
+ #delete $templates{$keytemplate};
+
+ #my $oldmask = umask 077;
+ #copy($cfg, $oldcfg);
+ #chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
+ #umask $oldmask;
- my $oldmask = umask 077;
- copy($cfg, $oldcfg);
- chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
- umask $oldmask;
- copy("$ap::config->{sysconfdir}/kolab/templates/imapd.group.template", $cfg);
my $groupconf;
if (!($groupconf = IO::File->new($cfg, 'a'))) {
Kolab::log('T', "Unable to open configuration file `$cfg'", KOLAB_ERROR);
@@ -395,7 +516,7 @@
my $mesg = $ldap->search(
base => $Kolab::config{'base_dn'},
scope => 'sub',
- filter => '(objectclass=kolabgroupofnames)'
+ filter => '(&(mail=*)(objectclass=kolabgroupofnames))'
);
if ($mesg->code) {
Kolab::log('T', 'Unable to locate Cyrus groups in LDAP', KOLAB_ERROR);
@@ -406,12 +527,8 @@
my $count = 60000;
if ($mesg->code <= 0) {
foreach $ldapobject ($mesg->entries) {
- my @dcs = split(/,/,$ldapobject->dn());
- my @dn;
- while( pop( @dcs ) =~ /dc=(.*)/ ) {
- push(@dn, $1);
- }
- my $group = $ldapobject->get_value('cn') . '@'.join('.',reverse(@dn)) . ":*:$count:";
+ #my $group = $ldapobject->get_value('cn') . '@'.join('.',reverse(@dn)) . ":*:$count:";
+ my $group = $ldapobject->get_value('mail').":*:$count:";
my $userlist = $ldapobject->get_value('member', asref => 1);
foreach (@$userlist) {
my $uid = $_;
@@ -437,7 +554,7 @@
$groupconf->close;
Kolab::LDAP::destroy($ldap);
- chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $cfg);
+ fixup( $cfg, $ownership{$cfg}, $permissions{$cfg});
Kolab::log('T', 'Finished building Cyrus groups', KOLAB_DEBUG );
}
@@ -445,14 +562,10 @@
sub buildLDAPAccess
{
Kolab::log('T', 'Building LDAP access file', KOLAB_DEBUG);
- my $prefix = $Kolab::config{'prefix'};
- my $cfg = "$ap::config->{sysconfdir}/openldap/slapd.access";
+ my $keytemplate = "$templatedir/slapd.access.template";
+ my $cfg = $templates{$keytemplate};
my $oldcfg = $cfg . '.old';
- my $oldmask = umask 077;
- copy($cfg, $oldcfg);
- chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
- copy("$ap::config->{sysconfdir}/kolab/templates/slapd.access.template", $cfg);
my $access;
if (!($access = IO::File->new($cfg, 'a'))) {
Kolab::log('T', "Unable to open configuration file `$cfg'", KOLAB_ERROR);
@@ -531,7 +644,7 @@
$Kolab::haschanged{'slapd'} = 1;
}
- chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $cfg);
+ fixup( $cfg, $ownership{$cfg}, $permissions{$cfg});
Kolab::log('T', 'Finished building LDAP access file', KOLAB_DEBUG );
}
@@ -540,14 +653,10 @@
{
Kolab::log('T', 'Building LDAP replicas', KOLAB_DEBUG);
- my $prefix = $Kolab::config{'prefix'};
- my $cfg = "$ap::config->{sysconfdir}/openldap/slapd.replicas";
+ my $keytemplate = "$templatedir/slapd.replicas.template";
+ my $cfg = $templates{$keytemplate};
my $oldcfg = $cfg . '.old';
- my $oldmask = umask 077;
- copy($cfg, $oldcfg);
- chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $oldcfg);
- copy("$ap::config->{sysconfdir}/kolab/templates/slapd.replicas.template", $cfg);
my $repl;
if (!($repl = IO::File->new($cfg, 'a'))) {
Kolab::log('T', "Unable to open configuration file `$cfg'", KOLAB_ERROR);
@@ -577,7 +686,7 @@
$repl->close;
- chown($Kolab::config{'kolab_uid'}, $Kolab::config{'kolab_gid'}, $cfg);
+ fixup( $cfg, $ownership{$cfg}, $permissions{$cfg});
if (-f $oldcfg) {
my $rc = `diff -q $cfg $oldcfg`;
@@ -589,7 +698,6 @@
} else {
$Kolab::haschanged{'slapd'} = 1;
}
- umask $oldmask;
Kolab::log('T', 'Finished building LDAP replicas', KOLAB_DEBUG);
}
@@ -600,7 +708,7 @@
my ($tref, $pref, $oref) = @_;
Kolab::log('T', 'Collecting template files', KOLAB_DEBUG );
- opendir(DIR, $templatedir);
+ opendir(DIR, $templatedir) or Kolab::log('T', 'Given templatedir $templatedir does not exist!', KOLAB_ERROR );
my @metatemplates = grep { /\.template$/ } readdir (DIR);
closedir(DIR);
@@ -636,7 +744,7 @@
}
if ($found_end && $target && $permissions && $ownership) {
Kolab::log('T', 'All mandatory fields populated in '.$template, KOLAB_DEBUG );
- $$tref{$template} = $target;
+ $$tref{$templatedir . "/" . $template} = $target;
$$oref{$target} = $ownership;
$permissions = oct($permissions);
$$pref{$target} = $permissions;
@@ -650,93 +758,6 @@
}
-my $prefix = $Kolab::config{'prefix'};
-my $templatedir = "$ap::config->{sysconfdir}/kolab/templates";
-
-my %templates = (
- "$templatedir/rc.conf.template" => "$ap::config->{sysconfdir}/rc.conf",
- "$templatedir/session_vars.php.template" => "$ap::config->{webadmindir}/php/admin/include/session_vars.php",
- "$templatedir/clamd.conf.template" => "$ap::config->{clamav_confdir}/clamd.conf",
- "$templatedir/freshclam.conf.template" => "$ap::config->{clamav_confdir}/freshclam.conf",
- "$templatedir/amavisd.conf.template" => "$ap::config->{sysconfdir}/amavisd/amavisd.conf",
- "$templatedir/main.cf.template" => "$ap::config->{sysconfdir}/postfix/main.cf",
- "$templatedir/ldapdistlist.cf.template" => "$ap::config->{sysconfdir}/postfix/ldapdistlist.cf",
- "$templatedir/ldaptransport.cf.template" => "$ap::config->{sysconfdir}/postfix/ldaptransport.cf",
- "$templatedir/ldapvirtual.cf.template" => "$ap::config->{sysconfdir}/postfix/ldapvirtual.cf",
- "$templatedir/master.cf.template" => "$ap::config->{sysconfdir}/postfix/master.cf",
- "$templatedir/saslauthd.conf.template" => "$ap::config->{sasl_confdir}/saslauthd.conf",
- "$templatedir/imapd.conf.template" => "$ap::config->{imap_confdir}/imapd.conf",
-# "$templatedir/imapd.group.template" => "$ap::config->{imap_confdir}/imapd.group",
-# "$templatedir/cyrus.conf.template" => "$ap::config->{imap_confdir}/cyrus.conf",
- "$templatedir/httpd.conf.template" => "$ap::config->{webserver_confdir}/apache.conf",
- "$templatedir/httpd.local.template" => "$ap::config->{webserver_confdir}/apache.local",
- "$templatedir/php.ini.template" => "$ap::config->{webserver_confdir}/php.ini",
- "$templatedir/proftpd.conf.template" => "$ap::config->{ftpserver_confdir}/proftpd.conf",
- "$templatedir/ldap.conf.template" => "$ap::config->{sysconfdir}/openldap/ldap.conf",
- "$templatedir/slapd.conf.template" => "$ap::config->{sysconfdir}/openldap/slapd.conf",
- "$templatedir/DB_CONFIG.slapd.template" => "$ap::config->{ldapserver_dir}/DB_CONFIG",
- "$templatedir/freebusy.conf.template" => "$ap::config->{sysconfdir}/resmgr/freebusy.conf",
- "$templatedir/fbview.conf.template" => "$ap::config->{sysconfdir}/resmgr/fbview.conf",
- "$templatedir/resmgr.conf.template" => "$ap::config->{sysconfdir}/resmgr/resmgr.conf"
- );
-
-my %permissions = (
- "$ap::config->{sysconfdir}/rc.conf" => 0644,
- "$ap::config->{webadmindir}/php/admin/include/session_vars.php" => 0640,
- "$ap::config->{sysconfdir}/resmgr/freebusy.conf" => 0640,
- "$ap::config->{sysconfdir}/resmgr/fbview.conf" => 0640,
- "$ap::config->{sysconfdir}/resmgr/resmgr.conf" => 0640,
- "$ap::config->{sysconfdir}/postfix/main.cf" => 0644,
- "$ap::config->{sysconfdir}/postfix/ldapdistlist.cf" => 0640,
- "$ap::config->{sysconfdir}/postfix/ldaptransport.cf" => 0640,
- "$ap::config->{sysconfdir}/postfix/ldapvirtual.cf" => 0640,
- "$ap::config->{sysconfdir}/postfix/master.cf" => 0640,
- "$ap::config->{clamav_confdir}/clamd.conf" => 0640,
- "$ap::config->{clamav_confdir}/freshclam.conf" => 0640,
- "$ap::config->{sysconfdir}/amavisd/amavisd.conf" => 0640,
- "$ap::config->{sasl_confdir}/saslauthd.conf" => 0600,
- "$ap::config->{imap_confdir}/imapd.conf" => oct($ap::config->{'imap_confperm'}),
- "$ap::config->{webserver_confdir}/apache.conf" => 0640,
- "$ap::config->{webserver_confdir}/apache.local" => 0640,
- "$ap::config->{webserver_confdir}/php.ini" => 0640,
- "$ap::config->{ftpserver_confdir}/proftpd.conf" => 0640,
- "$ap::config->{sysconfdir}/openldap/slapd.conf" => 0640,
- "$ap::config->{ldapserver_dir}/DB_CONFIG" => 0640,
- "$ap::config->{sysconfdir}/openldap/ldap.conf" => 0644,
- "$ap::config->{sysconfdir}/postfix/transport" => 0640,
- "$ap::config->{sysconfdir}/postfix/virtual" => 0640,
- "$ap::config->{imap_confdir}/cyrus.conf" => oct($ap::config->{'imap_confperm'}),
- "$ap::config->{imap_confdir}/imapd.group" => oct($ap::config->{'imap_confperm'}));
-
-my %ownership = (
- "$ap::config->{sysconfdir}/rc.conf" => "kolab:kolab",
- "$ap::config->{webadmindir}/php/admin/include/session_vars.php" => "kolab:kolab-n",
- "$ap::config->{sysconfdir}/resmgr/freebusy.conf" => "kolab:kolab-n",
- "$ap::config->{sysconfdir}/resmgr/fbview.conf" => "kolab:kolab-n",
- "$ap::config->{sysconfdir}/resmgr/resmgr.conf" => "kolab:kolab-n",
- "$ap::config->{sysconfdir}/postfix/main.cf" => "root:root",
- "$ap::config->{sysconfdir}/postfix/ldapdistlist.cf" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
- "$ap::config->{sysconfdir}/postfix/ldaptransport.cf" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
- "$ap::config->{sysconfdir}/postfix/ldapvirtual.cf" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
- "$ap::config->{sysconfdir}/postfix/master.cf" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
- "$ap::config->{clamav_confdir}/clamd.conf" => "kolab:kolab-r",
- "$ap::config->{clamav_confdir}/freshclam.conf" => "kolab:kolab-r",
- "$ap::config->{sysconfdir}/amavisd/amavisd.conf" => "kolab:kolab-r",
- "$ap::config->{sasl_confdir}/saslauthd.conf" => "kolab:kolab",
- "$ap::config->{imap_confdir}/imapd.conf" => "$ap::config->{imap_usr}:$ap::config->{imap_grp}",
- "$ap::config->{webserver_confdir}/apache.conf" => "kolab:kolab-n",
- "$ap::config->{webserver_confdir}/apache.local" => "kolab:kolab-n",
- "$ap::config->{webserver_confdir}/php.ini" => "kolab:kolab-n",
- "$ap::config->{ftpserver_confdir}/proftpd.conf" => "kolab:kolab-n",
- "$ap::config->{sysconfdir}/openldap/ldap.conf" => "$ap::config->{ldapserver_usr}:$ap::config->{ldapserver_grp}",
- "$ap::config->{sysconfdir}/openldap/slapd.conf" => "$ap::config->{ldapserver_usr}:$ap::config->{ldapserver_grp}",
- "$ap::config->{ldapserver_dir}/DB_CONFIG" => "$ap::config->{ldapserver_usr}:$ap::config->{ldapserver_grp}",
- "$ap::config->{sysconfdir}/postfix/transport" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
- "$ap::config->{sysconfdir}/postfix/virtual" => "$ap::config->{postfix_usr}:$ap::config->{postfix_grp}",
- "$ap::config->{imap_confdir}/cyrus.conf" => "$ap::config->{imap_usr}:$ap::config->{imap_grp}",
- "$ap::config->{imap_confdir}/imapd.group" => "$ap::config->{imap_usr}:$ap::config->{imap_grp}");
-
-
sub rebuildTemplates
{
my $key;
@@ -746,10 +767,12 @@
Kolab::log('T', 'Regenerating configuration files', KOLAB_DEBUG );
+ Kolab::log('T', 'Loading meta-template data', KOLAB_DEBUG );
loadMetaTemplates( $templatedir, \%templates, \%permissions, \%ownership );
foreach $key (keys %templates) {
my $tpl = $templates{$key};
+ #print STDOUT "Rebuilding $key => $templates{$key}\n";
build($key, $tpl, $ownership{$tpl}, $permissions{$tpl} );
}
More information about the commits
mailing list