Author: varkoly
Date: Wed Jan 27 15:40:56 2010
New Revision: 60558
URL: http://svn.opensuse.org/viewcvs/yast?rev=60558&view=rev
Log:
Merging with trunk
Modified:
branches/SuSE-Code-11-SP1-Branch/mail/agents/MasterCFParser.pm
branches/SuSE-Code-11-SP1-Branch/mail/agents/sysconfig.mail
branches/SuSE-Code-11-SP1-Branch/mail/package/yast2-mail.changes
branches/SuSE-Code-11-SP1-Branch/mail/src/Mail.ycp
branches/SuSE-Code-11-SP1-Branch/mail/src/MailServer.ycp
branches/SuSE-Code-11-SP1-Branch/mail/src/MailServerLDAP.pm
branches/SuSE-Code-11-SP1-Branch/mail/src/YaPI/MailServer.pm
branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_complex.ycp
branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_dialogs.ycp
branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_helps.ycp
branches/SuSE-Code-11-SP1-Branch/mail/src/suse-mailserver.schema
branches/SuSE-Code-11-SP1-Branch/mail/src/ui.ycp
branches/SuSE-Code-11-SP1-Branch/mail/src/widgets.ycp
branches/SuSE-Code-11-SP1-Branch/mail/users-plugin/users_plugin_mail_groups.ycp
branches/SuSE-Code-11-SP1-Branch/mail/yast2-mail.spec.in
Modified: branches/SuSE-Code-11-SP1-Branch/mail/agents/MasterCFParser.pm
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/mail/agents/MasterCFParser.pm?rev=60558&r1=60557&r2=60558&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/mail/agents/MasterCFParser.pm (original)
+++ branches/SuSE-Code-11-SP1-Branch/mail/agents/MasterCFParser.pm Wed Jan 27 15:40:56 2010
@@ -71,7 +71,6 @@
package MasterCFParser;
use strict;
-use Data::Dumper;
no warnings 'redefine';
######################################################################################
@@ -140,8 +139,10 @@
while( defined $CFA[$c+1] && $CFA[$c+1] =~ /^\s+/ ) {
$line .= $CFA[++$c];
}
-
- push @$cfa, line2service($line);
+ if( $line =~ /\w+/ )
+ { #avoid emty lines
+ push @$cfa, line2service($line);
+ }
}
$this->{MCF} = $cfa;
return 0;
@@ -247,7 +248,10 @@
next if defined $s->{comment};
$foundmatches = 0;
foreach my $fs ( keys %$fsrv ) {
- $foundmatches++ if $fsrv->{$fs} eq $s->{$fs};
+ if( defined $fsrv->{$fs} && defined $s->{$fs} )
+ {
+ $foundmatches++ if $fsrv->{$fs} eq $s->{$fs};
+ }
}
push @$retsrv, $s if $foundmatches == $nrkeys;
}
@@ -420,7 +424,11 @@
my $line = '';
if( defined $srv->{comment} ) {
$line = $srv->{comment};
- } else {
+ }
+ elsif( defined $srv->{service} && defined $srv->{type} && defined $srv->{private} &&
+ defined $srv->{unpriv} && defined $srv->{chroot} && defined $srv->{wakeup} &&
+ defined $srv->{maxproc} && defined $srv->{command} )
+ {
$line =
sprintf("%-8s %-5s %-6s %-7s %-7s %-8s %-7s %s",
$srv->{service},
Modified: branches/SuSE-Code-11-SP1-Branch/mail/agents/sysconfig.mail
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/mail/agents/sysconfig.mail?rev=60558&r1=60557&r2=60558&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/mail/agents/sysconfig.mail (original)
+++ branches/SuSE-Code-11-SP1-Branch/mail/agents/sysconfig.mail Wed Jan 27 15:40:56 2010
@@ -30,13 +30,13 @@
# If set to "no" or empty then only mail from localhost
# will be accepted.
#
-SMTPD_LISTEN_REMOTE="yes"
+SMTPD_LISTEN_REMOTE="no"
## Type: yesno
## Default: no
#
# Set this to "yes" if the yast2 mail module must not
-# start with the with the vizard for asking the
+# start with the wizard for asking the
# configuration type of the mail server.
#
SKIP_ASK="no"
Modified: branches/SuSE-Code-11-SP1-Branch/mail/package/yast2-mail.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/mail/package/yast2-mail.changes?rev=60558&r1=60557&r2=60558&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/mail/package/yast2-mail.changes (original)
+++ branches/SuSE-Code-11-SP1-Branch/mail/package/yast2-mail.changes Wed Jan 27 15:40:56 2010
@@ -1,4 +1,35 @@
-------------------------------------------------------------------
+Wed Jan 27 15:28:16 CET 2010 - varkoly@suse.de
+
+- Apply jsuchomes changes from bnc#559145
+ Export and Import smtp_use_TLS: no yes may
+ Export and Import smtp_use_TLS
+- Adjusted .desktop file(s) to wrap /sbin/yast2/ calls in xdg-su
+ where root privileges are needed, removed X-KDE-SubstituteUID key
+ (bnc#540627)
+- bnc#555814 â VUL-0: SMTPD_LISTEN_REMOTE="yes" by default
+- bnc#532518 â YaST in translation (use 'YaST' instead of 'YaST2')
+- Reorganize ldap tables
+- remove redefinition of read_attribute
+- bnc#491113 - fetchmail demon is started though disabled in runlevel
+ editor when configuring email via network services
+- bnc#488677 - yast2-mail "Advanced config" overwrites mailman settings
+- alias map ldap search must be sub
+- bnc#490688 â rename mail server module from "Mail Transfer Agent" to "Mail Server"
+- If starting the virus scanner freshclam have to be started also
+- bnc#483639 - yast2 mail server's master.cf parser do not writes some lines
+- saslauthd and cyrus must be started and enabled by YaPI
+- Serial of SOA Record must not be greater then 4294967295
+- bnc#467589 - Cyrus don't create Directory for new LDAP User at first run.
+- bnc#467562 - Yast mail doesn't install needed Spamassassin Package for SPAM learning extension for Mailserver
+- bnc#466748 - yast2-mail-plugins broken
+- avoid undefined variables in the MasterCFParser
+- make progress bar by WriteDialog visable
+- bnc#463589 - YaST2 Mail Server & amavisd
+- the myhostname in /etc/amavisd.conf must be set to FQHN
+- bnc#463430 - Mail to a shared folder can couse infinit loop
+
+-------------------------------------------------------------------
Fri Dec 12 06:37:41 CET 2008 - varkoly@suse.de
- bnc#458553 - YaSt2 Mail module do not install cyrus-sasl-saslauthd
Modified: branches/SuSE-Code-11-SP1-Branch/mail/src/Mail.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/mail/src/Mail.ycp?rev=60558&r1=60557&r2=60558&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/mail/src/Mail.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/mail/src/Mail.ycp Wed Jan 27 15:40:56 2010
@@ -103,7 +103,7 @@
/**
* Do the MTA use TLS for sending the email.
*/
- global boolean smtp_use_TLS = true;
+ global string smtp_use_TLS = "yes";
/**
* Mail will appear to come from this domain. Applies also for the
@@ -133,16 +133,10 @@
/**
* When should fetchmail run:
* <dl>
- * <dt> `manual <dd>
- * <dt> `ppp <dd> for a ppp conection, /etc/ppp/ip-{up,down}.d
- * <dt> `network <dd> for any network connection,
- * /etc/sysconfig/network/if-{up,down}.d
- * </dl>
- * #22903
- * Unused yet!
- * #37139, just enable rcfetchmail.
+ * <dt> "manual" <dd>
+ * <dt> "daemon" <dd>
*/
- global symbol fetchmail_mode = `manual;
+ global string fetchmail_mode = "manual";
/**
*List of maps:
@@ -333,7 +327,7 @@
* @return Whether rcfetchmail should run
*/
define boolean RunFetchmailGlobally () ``{
- return size (fetchmail) > 0;
+ return ( fetchmail_mode == "daemon" && size (fetchmail) > 0 );
}
/**
@@ -453,7 +447,7 @@
}
else if (mta == `postfix)
{
- smtp_use_TLS = ( (string) SCR::Read (.sysconfig.postfix.POSTFIX_SMTP_TLS_CLIENT) == "yes" );
+ smtp_use_TLS = (string) SCR::Read (.sysconfig.postfix.POSTFIX_SMTP_TLS_CLIENT);
outgoing_mail_server = (string)
SCR::Read (.sysconfig.postfix.POSTFIX_RELAYHOST);
}
@@ -544,9 +538,10 @@
{
return false;
}
- // read 4
- // TODO
- fetchmail_mode = `manual;
+ if( Service::Enabled ("fetchmail") )
+ {
+ fetchmail_mode = "daemon";
+ }
// if we are testing as non-root, it will fail, that's OK
map out = (map) SCR::Execute (.target.bash_output, "/usr/bin/id --user");
@@ -559,7 +554,7 @@
// %1 is a file name,
// %2 is a long file name - leave it on a separate line
Report::Error (sformat(_("Error reading file %1. The file must have
-a fixed format to be readable by YaST2. For details, see
+a fixed format to be readable by YaST. For details, see
%2"),
"/etc/fetchmailrc",
"/usr/share/doc/packages/yast2-mail/fetchmailrc.txt"));
@@ -635,6 +630,14 @@
}
/**
+ * Wrapper for global Read function, without the callback argument
+ */
+ global boolean ReadWithoutCallback () {
+ block<boolean> abort_block = ``{ return false; };
+ return Read (abort_block);
+ }
+
+ /**
* Make up data for screnshots
*/
global define void Fake () ``{
@@ -681,7 +684,7 @@
* Part of Write.
* @return success
*/
- define boolean WriteGeneral () ``{
+ global define boolean WriteGeneral () ``{
// create_config
// if the user wanted it false, we did not proceed
SCR::Write (.sysconfig.mail.MAIL_CREATE_CONFIG, "yes");
@@ -788,14 +791,7 @@
else if (mta == `postfix)
{
SCR::Write (.sysconfig.postfix.POSTFIX_RELAYHOST, outgoing_mail_server);
- if( smtp_use_TLS )
- {
- SCR::Write (.sysconfig.postfix.POSTFIX_SMTP_TLS_CLIENT, "yes");
- }
- else
- {
- SCR::Write (.sysconfig.postfix.POSTFIX_SMTP_TLS_CLIENT, "no");
- }
+ SCR::Write (.sysconfig.postfix.POSTFIX_SMTP_TLS_CLIENT, smtp_use_TLS);
}
else
{
@@ -823,7 +819,7 @@
* Part of Write.
* @return success
*/
- define boolean WriteMasquerading () ``{
+ global define boolean WriteMasquerading () ``{
// from_header
SCR::Write (.sysconfig.mail.FROM_HEADER, from_header);
// masquerade_other_domains
@@ -869,7 +865,7 @@
* Part of Write.
* @return success
*/
- define boolean WriteDownloading () ``{
+ global define boolean WriteDownloading () ``{
// fetchmail
// TODO ?other settings: autofetch? at device up?
SCR::Write (.mail.fetchmail.accounts, fetchmail);
@@ -895,7 +891,7 @@
* Part of Write.
* @return success
*/
- define boolean WriteAliasesAndVirtual () ``{
+ global define boolean WriteAliasesAndVirtual () ``{
// aliases
if (! MailAliases::WriteAliases ())
{
@@ -928,7 +924,7 @@
* Part of Write.
* @return success
*/
- define boolean WriteSmtpAuth () ``{
+ global define boolean WriteSmtpAuth () ``{
// TODO how to remove the only entry?
// filter it out in the dialog?
if (enable_smtp_auth != nil)
@@ -962,7 +958,7 @@
* Part of Write.
* @return success
*/
- define boolean WriteFlush () ``{
+ global define boolean WriteFlush () ``{
//flush the agents
map paths = $[
"/etc/sysconfig/mail": .sysconfig.mail,
@@ -1020,7 +1016,7 @@
* Part of Write.
* @return success
*/
- define boolean WriteSuSEconfig () ``{
+ global define boolean WriteSuSEconfig () ``{
//run SuSEconfig with the necessary modules
// TODO other modules using FROM_HEADER?
integer ret = 0;
@@ -1052,7 +1048,7 @@
* Part of Write.
* @return success
*/
- define boolean WriteServices () ``{
+ global define boolean WriteServices () ``{
if (amavis_service)
{
Service::Stop ("amavis");
@@ -1173,6 +1169,13 @@
return true;
}
+ /**
+ * Wrapper for global Write function, without the callback argument
+ */
+ global boolean WriteWithoutCallback () {
+ block<boolean> abort_block = ``{ return false; };
+ return Write (abort_block);
+ }
/**
* Get all mail settings from the first parameter
@@ -1230,6 +1233,7 @@
MailAliases::FilterRootAlias ();
// MailAliases::merge_aliases = settings["merge_aliases"]: false;
virtual_users = settings["virtual_users"]: [];
+ smtp_use_TLS = settings["smtp_use_TLS"]: "yes";
smtp_auth = settings["smtp_auth"]: [];
y2debug ("after %1", settings); // may contain passwords
return true;
@@ -1257,6 +1261,7 @@
// "merge_aliases": MailAliases::merge_aliases,
"virtual_users": virtual_users,
"smtp_auth": smtp_auth,
+ "smtp_use_TLS": smtp_use_TLS,
];
if (mta == `postfix)
{
Modified: branches/SuSE-Code-11-SP1-Branch/mail/src/MailServer.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/mail/src/MailServer.ycp?rev=60558&r1=60557&r2=60558&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/mail/src/MailServer.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/mail/src/MailServer.ycp Wed Jan 27 15:40:56 2010
@@ -162,7 +162,6 @@
global boolean pam_ldap_installed = false;
global boolean nss_ldap_installed = false;
global boolean procmail_installed = false;
-global boolean amavis_installed = false;
global boolean ldap_installed = false;
global boolean cyrus_installed = false;
global boolean postfix_installed = false;
@@ -170,6 +169,9 @@
global boolean sasl_installed = false;
global boolean saslauthd_installed = false;
global boolean plugins_installed = false;
+global boolean amavis_installed = false;
+global boolean spamassassin_installed=false;
+global boolean clamav_installed = false;
/*
* Help funktion to check the DNS Settings
@@ -268,10 +270,12 @@
postfix_installed = Installed("postfix");
fetchmail_installed = Installed("fetchmail");
ldap_installed = Installed("yast2-ldap-client");
- amavis_installed = Installed("amavisd-new");
sasl_installed = Installed("cyrus-sasl-plain");
saslauthd_installed = Installed("cyrus-sasl-saslauthd");
plugins_installed = Installed("yast2-mail-plugins");
+ amavis_installed = Installed("amavisd-new");
+ clamav_installed = Installed("clamav");
+ spamassassin_installed= Installed("spamassassin");
string to_install = "";
list<string> l_to_install = [];
@@ -310,13 +314,6 @@
l_to_install = add( l_to_install, "yast2-mail-plugins" );
to_install = to_install + "yast2-mail-plugins\n";
}
- if(!amavis_installed)
- {
- l_to_install = add( l_to_install, "amavisd-new" );
- to_install = to_install + "amavisd-new\n";
- l_to_install = add( l_to_install, "clamav" );
- to_install = to_install + "clamav\n";
- }
if(to_install != "")
{
if ( Report::AnyQuestion ("",_("You have not installed all needed packages.") +
@@ -504,13 +501,13 @@
/* Progress stage 1/7 */
_("Write mail server global settings"),
/* Progress stage 2/7 */
- _("Write mail server transports"),
+ _("Write mail server local delivery settings"),
/* Progress stage 3/7 */
- _("Write mail server prevention settings"),
+ _("Write mail server transports"),
/* Progress stage 4/7 */
- _("Write mail server relaying settings"),
+ _("Write mail server prevention settings"),
/* Progress stage 5/7 */
- _("Write mail server local delivery settings"),
+ _("Write mail server relaying settings"),
/* Progress stage 6/3 */
_("Write mail fetching jobs"),
/* Progress stage 7/7 */
@@ -519,13 +516,13 @@
/* Progress stage 1/7 */
_("Writing mail server global settings..."),
/* Progress stage 2/7 */
- _("Writing mail server transports..."),
+ _("Writing mail server local delivery settings..."),
/* Progress stage 3/7 */
- _("Writing mail server prevention settings..."),
+ _("Writing mail server transports..."),
/* Progress stage 4/7 */
- _("Writing mail server relaying settings..."),
+ _("Writing mail server prevention settings..."),
/* Progress stage 5/7 */
- _("Writing mail server local delivery settings..."),
+ _("Writing mail server relaying settings..."),
/* Progress stage 6/3 */
_("Writing mail fetching jobs..."),
/* Progress stage 7/7 */
@@ -550,66 +547,6 @@
}
sleep(sl);
- // write mail transports
- if(Abort()) return false;
- Progress::NextStep();
- if( (boolean)MailTransports["Changed"]:false ) {
- // First we have to clean up TLS Sites
- if( ! YaPI::MailServer::WriteMailTransports(MailTransports,AdminPassword) ) {
- Report::Error(_("Cannot write mail server transports."));
- }
- }
- sleep(sl);
-
- // write mail preventions
- if(Abort()) return false;
- Progress::NextStage();
- if((boolean)MailPrevention["VirusScanning"]:false) {
- if(! amavis_installed)
- {
- if ( Report::AnyQuestion ("",_("You have not installed all needed packages.") +
- "\n clamav \n amavisd-new \n",
- Label::InstallButton(),
- Label::AbortButton(),
- `focus_yes))
- {
- Package::DoInstall(["clamav","amavisd-new"]);
- Service::Start("clamd");
- Service::Start("freshclam");
- Service::Start("amavis");
- y2milestone("Installing amavis");
- }
- else
- {
- return false;
- }
- }
- Service::Enable("amavis");
- Service::Enable("clamd");
- Service::Enable("freshclam");
- }
- if( (boolean)MailPrevention["Changed"]:false ) {
- if( ! YaPI::MailServer::WriteMailPrevention(MailPrevention,AdminPassword) ) {
- Report::Error(_("Cannot write mail server preventions."));
- }
- if((boolean)MailPrevention["VirusScanning"]:false) {
- Service::Restart("clamd");
- Service::Restart("freshclam");
- Service::Restart("amavis");
- }
- }
- sleep(sl);
-
- // write mail realaying
- if(Abort()) return false;
- Progress::NextStage();
- if( (boolean)MailRelaying["Changed"]:false ) {
- if( ! YaPI::MailServer::WriteMailRelaying(MailRelaying,AdminPassword) ) {
- Report::Warning(_("Cannot write the mail server relay settings."));
- }
- }
- sleep(sl);
-
// write mail local delivery
// first we looking for if all the needed packages are installed
if(MailLocalDelivery["Type"]:"none" == "procmail"){
@@ -636,38 +573,26 @@
}
if(MailLocalDelivery["Type"]:"none" == "cyrus") {
- if(!cyrus_installed)
- {
- if ( Report::AnyQuestion ("",_("You have not installed all needed packages.") +
- "\n cyrus-imapd \n",
- Label::InstallButton(),
- Label::AbortButton(),
- `focus_yes))
- {
- Package::DoInstall(["cyrus-imapd"]);
- SCR::UnmountAgent(.etc.imapd_conf);
- }
- else
- {
- return false;
- }
- }
- string crypted = Users::CryptPassword(AdminPassword, "system", "foo");
- SCR::Write(.target.passwd.cyrus, crypted);
-
- list Values = SCR::Dir(.etc.imapd_conf);
- SCR::Write(.etc.imapd_conf.allowplaintext,"yes");
- if(!contains(Values,"unixhierarchysep")) {
- SCR::Write(.etc.imapd_conf.unixhierarchysep,"yes");
- }
- if(!contains(Values,"allowplainwithouttls")) {
- SCR::Write(.etc.imapd_conf.allowplainwithouttls,"yes");
- }
- SCR::Write(.etc.imapd_conf,nil);
- if(Service::Status("cyrus") > 0) {
- Service::Start("cyrus");
- Service::Enable("cyrus");
- }
+ if(!cyrus_installed)
+ {
+ if ( Report::AnyQuestion ("",_("You have not installed all needed packages.") +
+ "\n cyrus-imapd \n",
+ Label::InstallButton(),
+ Label::AbortButton(),
+ `focus_yes))
+ {
+ Package::DoInstall(["cyrus-imapd"]);
+ SCR::UnmountAgent(.etc.imapd_conf);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ string crypted = Users::CryptPassword(AdminPassword, "system", "foo");
+ SCR::Write(.target.passwd.cyrus, crypted);
+ y2milestone("--- Enabling cyrus --");
+ Service::Enable("cyrus");
} else {
if(cyrus_installed) {
Service::Stop("cyrus");
@@ -681,7 +606,102 @@
Report::Warning(_("Cannot write the mail server local delivery settings."));
}
if(MailLocalDelivery["Type"]:"none" == "cyrus") {
- Service::Reload("cyrus");
+ y2milestone("--- Stop cyrus --");
+ Service::Stop("cyrus");
+ y2milestone("--- Start cyrus --");
+ Service::Start("cyrus");
+ sleep(10000);
+ YaPI::MailServer::CreateRootMailbox(AdminPassword);
+ }
+ }
+ sleep(sl);
+
+ // write mail transports
+ if(Abort()) return false;
+ Progress::NextStep();
+ if( (boolean)MailTransports["Changed"]:false ) {
+ // First we have to clean up TLS Sites
+ if( ! YaPI::MailServer::WriteMailTransports(MailTransports,AdminPassword) ) {
+ Report::Error(_("Cannot write mail server transports."));
+ }
+ }
+ sleep(sl);
+
+ // write mail preventions
+ if(Abort()) return false;
+ Progress::NextStage();
+ if((boolean)MailPrevention["VirusScanning"]:false)
+ {
+ string to_install = "";
+ list<string> l_to_install = [];
+ if(!amavis_installed)
+ {
+ l_to_install = add( l_to_install, "amavisd-new" );
+ to_install = to_install + "\n amavisd-new";
+ if(!clamav_installed)
+ {
+ l_to_install = add( l_to_install, "clamav" );
+ to_install = to_install + "\n clamav";
+ }
+ if(!spamassassin_installed)
+ {
+ l_to_install = add( l_to_install, "spamassassin" );
+ to_install = to_install + "\n spamassassin";
+ }
+ if(! amavis_installed || !clamav_installed || !spamassassin_installed)
+ {
+ if ( Report::AnyQuestion ("",_("You have not installed all needed packages.") +
+ to_install,
+ Label::InstallButton(),
+ Label::AbortButton(),
+ `focus_yes))
+ {
+ Package::DoInstall(l_to_install);
+ y2milestone("Installing amavis");
+ }
+ else
+ {
+ return false;
+ }
+ Service::Start("clamd");
+ Service::Start("freshclam");
+ Service::Start("amavis");
+ }
+ Service::Enable("amavis");
+ Service::Enable("clamd");
+ Service::Enable("freshclam");
+ }
+ }
+ if( (boolean)MailPrevention["Changed"]:false ) {
+ if( ! YaPI::MailServer::WriteMailPrevention(MailPrevention,AdminPassword) ) {
+ Report::Error(_("Cannot write mail server preventions."));
+ }
+ if((boolean)MailPrevention["VirusScanning"]:false) {
+ Service::Enable("amavis");
+ Service::Enable("clamd");
+ Service::Enable("freshclam");
+ Service::Restart("clamd");
+ Service::Restart("freshclam");
+ Service::Restart("amavis");
+ }
+ else
+ {
+ Service::Stop("clamd");
+ Service::Stop("freshclam");
+ Service::Stop("amavis");
+ Service::Disable("amavis");
+ Service::Disable("clamd");
+ Service::Disable("freshclam");
+ }
+ }
+ sleep(sl);
+
+ // write mail realaying
+ if(Abort()) return false;
+ Progress::NextStage();
+ if( (boolean)MailRelaying["Changed"]:false ) {
+ if( ! YaPI::MailServer::WriteMailRelaying(MailRelaying,AdminPassword) ) {
+ Report::Warning(_("Cannot write the mail server relay settings."));
}
}
sleep(sl);
Modified: branches/SuSE-Code-11-SP1-Branch/mail/src/MailServerLDAP.pm
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/mail/src/MailServerLDAP.pm?rev=60558&r1=60557&r2=60558&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/mail/src/MailServerLDAP.pm (original)
+++ branches/SuSE-Code-11-SP1-Branch/mail/src/MailServerLDAP.pm Wed Jan 27 15:40:56 2010
@@ -55,7 +55,8 @@
my $indices = YaPI::LdapServer->ReadIndex( $ldapMap->[2]->{'suffix'} );
my @attrs = ( "SuSEMailClient", "SUSEMailAcceptAddress", "zoneName",
"SuSEMailDomainMasquerading", "relativeDomainName", "suseMailDomainType",
- "suseTLSPerSitePeer", "SuSEMailTransportDestination" );
+ "suseTLSPerSitePeer", "SuSEMailTransportDestination",
+ "suseDeliveryToFolder", "suseDeliveryToMember" );
foreach my $attr (@attrs){
my $curindex;
if (! defined $indices->{$attr} ) {
Modified: branches/SuSE-Code-11-SP1-Branch/mail/src/YaPI/MailServer.pm
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/mail/src/YaPI/MailServer.pm?rev=60558&r1=60557&r2=60558&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/mail/src/YaPI/MailServer.pm (original)
+++ branches/SuSE-Code-11-SP1-Branch/mail/src/YaPI/MailServer.pm Wed Jan 27 15:40:56 2010
@@ -197,9 +197,8 @@
$GlobalSettings{'MaximumMailSize'} = read_attribute($MainCf,'message_size_limit');
#
- $GlobalSettings{'Banner'} = `postconf -h smtpd_banner`;
- $GlobalSettings{'Interfaces'} = `postconf -h inet_interfaces`;
- chomp $GlobalSettings{'Banner'};
+ chomp( $GlobalSettings{'Banner'} = `postconf -h smtpd_banner`);
+ chomp($GlobalSettings{'Interfaces'} = `postconf -h inet_interfaces`);
# Determine if relay host is used
$GlobalSettings{'SendingMail'}{'RelayHost'}{'Name'} = read_attribute($MainCf,'relayhost');
@@ -348,7 +347,14 @@
'command' => 'smtp' });
if(! defined $smtpsrv )
{
- SCR->Execute('.mail.postfix.mastercf.addService', { 'service' => 'smtp', 'command' => 'smtp' });
+ SCR->Execute('.mail.postfix.mastercf.addService', { 'service' => 'smtp',
+ 'type' => 'inet',
+ 'private' => 'n',
+ 'unpriv' => '-',
+ 'chroot' => 'n',
+ 'wakeup' => '-',
+ 'maxproc' => '-',
+ 'command' => 'smtpd' });
}
}
@@ -1161,44 +1167,38 @@
}
# Now we looking for if vscan (virusscanning) is started.
- my $vscan = SCR->Execute('.mail.postfix.mastercf.findService',
+ my $vscanin = SCR->Execute('.mail.postfix.mastercf.findService',
{ 'service' => 'localhost:10025',
'command' => 'smtpd'} );
- my $smtp = SCR->Execute('.mail.postfix.mastercf.findService',
- { 'service' => 'smtp',
- 'command' => 'smtpd'});
-#print STDERR "SMTP";
-#print STDERR Dumper ($smtp);
-#print STDERR "VSCAN";
-#print STDERR Dumper ($vscan);
- if( defined $smtp->[0] && defined $smtp->[0]->{'options'} )
- {
- if( $smtp->[0]->{'options'}->{'content_filter'} eq 'smtp:[127.0.0.1]:10024' && $vscan )
- {
- $MailPrevention{'VirusScanning'} = YaST::YCP::Boolean(1);
- if( ! open(IN,$aconf) )
- {
- return "Error: $!";
- }
- my @ACONF = <IN>;
- close(IN);
- my $ismax = 0;
- foreach ( @ACONF )
- {
- s/\s+//g;
+ my $vscanout = SCR->Execute('.mail.postfix.mastercf.findService',
+ { 'service' => 'amavis',
+ 'command' => 'lmtp'} );
+ my $content_filter = read_attribute($MainCf,'content_filter');
+
+ if( $content_filter eq 'amavis:[127.0.0.1]:10024' && $vscanin && $vscanout)
+ {
+ $MailPrevention{'VirusScanning'} = YaST::YCP::Boolean(1);
+ if( ! open(IN,$aconf) )
+ {
+ return "Error: $!";
+ }
+ my @ACONF = <IN>;
+ close(IN);
+ my $ismax = 0;
+ foreach ( @ACONF )
+ {
+ s/\s+//g;
if ( /^\$max_servers=(\d+)/ )
{
- $MailPrevention{'VSCount'} = YaST::YCP::Integer($1);
+ $MailPrevention{'VSCount'} = YaST::YCP::Integer($1);
}
$ismax = 1;
- }
- if( !$ismax )
- {
- $MailPrevention{'VSCount'} = YaST::YCP::Integer(5);
- }
- }
+ }
+ if( !$ismax )
+ {
+ $MailPrevention{'VSCount'} = YaST::YCP::Integer(2);
+ }
}
-
# make IMAP connection
my $imap = new Net::IMAP($imaphost, Debug => 0);
if( $imap )
@@ -1211,6 +1211,7 @@
$MailPrevention{'SpamLearning'} = YaST::YCP::Boolean(1);
}
}
+ $imap->logout();
}
return \%MailPrevention;
@@ -1276,11 +1277,9 @@
if($MailPrevention->{'BasicProtection'} eq 'hard')
{
#Write hard settings
- write_attribute($MainCf,'smtpd_sender_restrictions','ldap:/etc/postfix/ldapaccess.cf, reject_unknown_sender_domain');
write_attribute($MainCf,'smtpd_helo_required','yes');
write_attribute($MainCf,'smtpd_helo_restrictions','permit_mynetworks, reject_invalid_hostname');
write_attribute($MainCf,'strict_rfc821_envelopes','yes');
- write_attribute($MainCf,'local_recipient_maps','$alias_maps, ldap:/etc/postfix/ldaplocal_recipient_maps.cf');
if( $clnt_restrictions ne '')
{
write_attribute($MainCf,'smtpd_client_restrictions',"permit_mynetworks, $clnt_restrictions, ldap:/etc/postfix/ldapaccess.cf, reject_unknown_client");
@@ -1293,11 +1292,9 @@
elsif($MailPrevention->{'BasicProtection'} eq 'medium')
{
#Write medium settings
- write_attribute($MainCf,'smtpd_sender_restrictions','ldap:/etc/postfix/ldapaccess.cf, reject_unknown_sender_domain');
write_attribute($MainCf,'smtpd_helo_required','yes');
write_attribute($MainCf,'smtpd_helo_restrictions','');
write_attribute($MainCf,'strict_rfc821_envelopes','no');
- write_attribute($MainCf,'local_recipient_maps','$alias_maps, ldap:/etc/postfix/ldaplocal_recipient_maps.cf');
if( $clnt_restrictions ne '')
{
write_attribute($MainCf,'smtpd_client_restrictions',"$clnt_restrictions, ldap:/etc/postfix/ldapaccess.cf");
@@ -1310,12 +1307,10 @@
elsif($MailPrevention->{'BasicProtection'} eq 'off')
{
# Write off settings
- write_attribute($MainCf,'smtpd_sender_restrictions','ldap:/etc/postfix/ldapaccess.cf');
write_attribute($MainCf,'smtpd_helo_required','no');
write_attribute($MainCf,'smtpd_helo_restrictions','');
write_attribute($MainCf,'strict_rfc821_envelopes','no');
write_attribute($MainCf,'smtpd_client_restrictions','ldap:/etc/postfix/ldapaccess.cf');
- write_attribute($MainCf,'local_recipient_maps','$alias_maps, ldap:/etc/postfix/ldaplocal_recipient_maps.cf');
}
else
{
@@ -1372,34 +1367,64 @@
code => "VIRUS_SCANNER_FAILED",
description => "activating the virus scanner failed: $err");
}
- if( SCR->Execute('.mail.postfix.mastercf.findService',
- { 'service' => 'smtp', 'command' => 'smtpd' }))
- {
- SCR->Execute('.mail.postfix.mastercf.modifyService',
- { 'service' => 'smtp',
- 'command' => 'smtpd',
- 'maxproc' => $MailPrevention->{'VSCount'},
- 'options' => { 'content_filter' => 'smtp:[127.0.0.1]:10024' } } );
- }
- else
+ # This is only for systems updated from SLES10
+ my $smtps = SCR->Execute('.mail.postfix.mastercf.findService',
+ { 'service' => 'smtps', 'command' => 'smtpd' });
+ if( ref($smtps) eq 'ARRAY' && defined $smtps->[0]->{options} )
+ {
+ my $opts = $smtps->[0]->{options};
+ if ( defined $opts->{'content_filter'} )
+ {
+ delete $opts->{'content_filter'};
+ SCR->Execute('.mail.postfix.mastercf.modifyService',
+ { 'service' => 'smtps',
+ 'command' => 'smtpd',
+ 'maxproc' => '-',
+ 'options' => $opts } );
+ }
+ }
+ my $smtp = SCR->Execute('.mail.postfix.mastercf.findService',
+ { 'service' => 'smtp', 'command' => 'smtpd' });
+ if( ref($smtp) eq 'ARRAY' && defined $smtp->[0]->{options} )
+ {
+ my $opts = $smtp->[0]->{options};
+ if ( defined $opts->{'content_filter'} )
+ {
+ delete $opts->{'content_filter'};
+ SCR->Execute('.mail.postfix.mastercf.modifyService',
+ { 'service' => 'smtp',
+ 'command' => 'smtpd',
+ 'maxproc' => '-',
+ 'options' => $opts } );
+ }
+ }
+ # End This is only for systems updated from SLES10
+ if( SCR->Execute('.mail.postfix.mastercf.findService',
+ { 'service' => 'localhost:10025', 'command' => 'smtpd' }))
{
- SCR->Execute('.mail.postfix.mastercf.addService',
- { 'service' => 'smtp',
- 'command' => 'smtpd',
+ SCR->Execute('.mail.postfix.mastercf.deleteService',
+ { 'service' => 'localhost:10025', 'command' => 'smtpd' });
+ }
+ if( SCR->Execute('.mail.postfix.mastercf.findService',
+ { 'service' => 'amavis', 'command' => 'lmtp' }))
+ {
+ SCR->Execute('.mail.postfix.mastercf.deleteService',
+ { 'service' => 'amavis', 'command' => 'lmtp' });
+ }
+ # create smtpd pocess for getting back the emails
+ SCR->Execute('.mail.postfix.mastercf.addService',
+ { 'service' => 'amavis',
+ 'command' => 'lmtp',
+ 'type' => 'unix',
+ 'private' => '-',
+ 'unpriv' => '-',
+ 'chroot' => '-',
+ 'wakeup' => '-',
'maxproc' => $MailPrevention->{'VSCount'},
- 'options' => { 'content_filter' => 'smtp:[127.0.0.1]:10024' } } );
- }
- my $smtps = SCR->Execute('.mail.postfix.mastercf.findService',
- { 'service' => 'smtps', 'command' => 'smtpd' });
- if( ref($smtps) eq 'ARRAY' && defined $smtps->[0]->{options} )
- {
- my $opts = $smtps->[0]->{options};
- $opts->{'content_filter'} = 'smtp:[127.0.0.1]:10024';
- SCR->Execute('.mail.postfix.mastercf.modifyService',
- { 'service' => 'smtps',
- 'command' => 'smtpd',
- 'options' => $opts } );
- }
+ 'options' => { lmtp_data_done_timeout => 1200,
+ lmtp_send_xforward_command => 'yes',
+ disable_dns_lookups => 'yes',
+ max_use => 20 } } );
SCR->Execute('.mail.postfix.mastercf.addService',
{ 'service' => 'localhost:10025',
'command' => 'smtpd',
@@ -1409,34 +1434,42 @@
'chroot' => 'n',
'wakeup' => '-',
'maxproc' => '-',
- 'options' => { 'content_filter' => '' } } );
+ 'options' => { content_filter => '',
+ relay_recipient_maps => '',
+ smtpd_delay_reject => 'no',
+ smtpd_restriction_classes => '',
+ smtpd_client_restrictions => '',
+ smtpd_helo_restrictions => '',
+ smtpd_sender_restrictions => '',
+ smtpd_recipient_restrictions => 'permit_mynetworks,reject',
+ smtpd_data_restrictions => 'reject_unauth_pipelining',
+ smtpd_end_of_data_restrictions => '',
+ mynetworks => '127.0.0.0/8',
+ smtpd_error_sleep_time => '0',
+ smtpd_soft_error_limit => '1001',
+ smtpd_hard_error_limit => '1000',
+ smtpd_client_connection_count_limit => '0',
+ smtpd_client_connection_rate_limit => '0',
+ receive_override_options => 'no_header_body_checks,no_unknown_recipient_checks'
+ }
+ } );
+ write_attribute($MainCf,'content_filter','amavis:[127.0.0.1]:10024');
}
else
{
- SCR->Execute('.mail.postfix.mastercf.deleteService',
- { 'service' => 'localhost:10025', 'command' => 'smtpd' });
- SCR->Execute('.mail.postfix.mastercf.modifyService',
- { 'service' => 'smtp', 'command' => 'smtpd', 'options' => {} } );
-
- my $smtps = SCR->Execute('.mail.postfix.mastercf.findService',
- { 'service' => 'smtps', 'command' => 'smtpd' });
- if( ref($smtps) eq 'ARRAY' && defined $smtps->[0]->{options} )
- {
- my $opts = $smtps->[0]->{options};
- delete $opts->{'content_filter'};
- SCR->Execute('.mail.postfix.mastercf.modifyService',
- { 'service' => 'smtps',
- 'command' => 'smtpd',
- 'options' => $opts });
- }
- Service->Stop('amavis');
- Service->Stop('clamd');
- Service->Disable('amavis');
- Service->Disable('clamd');
+ SCR->Execute('.mail.postfix.mastercf.deleteService',
+ { 'service' => 'localhost:10025', 'command' => 'smtpd' });
+ SCR->Execute('.mail.postfix.mastercf.deleteService',
+ { 'service' => 'amavis', 'command' => 'lmtp' });
+ write_attribute($MainCf,'content_filter','');
+
+ Service->Stop('amavis');
+ Service->Stop('clamd');
+ Service->Disable('amavis');
+ Service->Disable('clamd');
}
# now we looks if the ldap entries in the main.cf for the access table are OK.
- check_ldap_configuration('local_recipient_maps',$ldapMap);
check_ldap_configuration('access',$ldapMap);
SCR->Write('.mail.postfix.main.table',$MainCf);
SCR->Write('.mail.postfix.main',undef);
@@ -1468,13 +1501,13 @@
setfacl -m u:vscan:rx /var/spool/imap /var/spool/imap/{NoSpam,NewSpam}
setfacl -m m::rx /var/spool/imap /var/spool/imap/{NoSpam,NewSpam}
-su - vscan -c "/usr/bin/sa-learn --sync"
+/usr/bin/sa-learn --sync --dbpath /var/spool/amavis/.spamassassin/
(
for i in `ls /var/spool/imap/NewSpam/[0-9]* 2> /dev/null`
do
setfacl -m user:vscan:r-x $i
echo $i
- su - vscan -c "/usr/bin/sa-learn --spam $i"
+ /usr/bin/sa-learn --spam --dbpath /var/spool/amavis/.spamassassin/ $i
rm $i
done
) >> $LOG 2>&1
@@ -1485,22 +1518,26 @@
do
setfacl -m user:vscan:r-x $i
echo $i
- su - vscan -c "/usr/bin/sa-learn --ham $i"
+ /usr/bin/sa-learn --ham --dbpath /var/spool/amavis/.spamassassin/ $i
rm $i
done
) >> $LOG 2>&1
su - cyrus -c "reconstruct NoSpam" &>/dev/null
+chown -R vscan /var/spool/amavis/.spamassassin/
setfacl -b /var/spool/imap /var/spool/imap/{NoSpam,NewSpam}
';
SCR->Write(".target.string","/etc/cron.hourly/lern-spam",$lernspam);
- SCR->Write(".target.bash","chmod 755 /etc/cron.hourly/lern-spam");
+ SCR->Execute(".target.bash","chmod 755 /etc/cron.hourly/lern-spam");
}
+ $imap->logout();
}
else
{
- SCR->Write(".target.bash","test -e /etc/cron.hourly/lern-spam && rm /etc/cron.hourly/lern-spam");
- $ret = $imap->delete('NewSpam');
+ SCR->Execute(".target.bash","test -e /etc/cron.hourly/lern-spam && rm /etc/cron.hourly/lern-spam");
+ $ret = $imap->delete('NewSpam');
+ $ret = $imap->delete('NoSpam');
+ $imap->logout();
}
}
return 1;
@@ -1597,7 +1634,7 @@
my $smtpd_recipient_restrictions = read_attribute($MainCf,'smtpd_recipient_restrictions');
my $smtpd_sasl_auth_enable = read_attribute($MainCf,'smtpd_sasl_auth_enable');
my $smtpd_use_tls = read_attribute($MainCf,'smtpd_use_tls');
- my $smtpd_enforce_tls = read_attribute($MainCf,'smtpd_enforce_tls');
+ my $smtpd_enforce_tls = read_attribute($MainCf,'smtpd_enforce_tls') || 'no';
my $smtpd_tls_auth_only = read_attribute($MainCf,'smtpd_tls_auth_only');
if($smtpd_use_tls eq 'no')
{
@@ -1643,7 +1680,6 @@
}
y2milestone("-- WriteMailRelaying --");
-#print STDERR Dumper([$MailRelaying]);
# Make LDAP Connection
my $ldapMap = $self->ReadLDAPDefaults($AdminPassword);
if( !$ldapMap )
@@ -1787,7 +1823,7 @@
my %MailLocalDelivery = (
'Changed' => YaST::YCP::Boolean(0),
'Type' => '',
- 'MailboxSizeLimit'=> '',
+ 'MailboxSizeLimit'=> 0,
'FallBackMailbox' => '',
'SpoolDirectory' => '',
'QuotaLimit' => 90,
@@ -1915,13 +1951,7 @@
#print STDERR Dumper([$MailLocalDelivery]);
if( $MailLocalDelivery->{'Type'} ne 'none')
{
- write_attribute($MainCf,'mydestination','$myhostname, localhost.$mydomain, $mydomain, ldap:/etc/postfix/ldapmydestination.cf');
- write_attribute($MainCf,'virtual_alias_maps', 'ldap:/etc/postfix/ldaplocal_recipient_maps.cf');
- write_attribute($MainCf,'virtual_alias_domains','ldap:/etc/postfix/ldapvirtual_alias_maps.cf');
- write_attribute($MainCf,'alias_maps','hash:/etc/aliases, ldap:/etc/postfix/ldapalias_maps_member.cf, ldap:/etc/postfix/ldapalias_maps.cf');
- check_ldap_configuration('alias_maps',$ldapMap);
- check_ldap_configuration('alias_maps_member',$ldapMap);
- check_ldap_configuration('virtual_alias_maps',$ldapMap);
+ write_ldap_maps($MainCf,$ldapMap);
}
if( $MailLocalDelivery->{'Type'} eq 'local')
{
@@ -1970,6 +2000,9 @@
SCR->Write('.etc.imapd_conf.quotawarn',$MailLocalDelivery->{'QuotaLimit'});
SCR->Write('.etc.imapd_conf.timeout',$MailLocalDelivery->{'ImapIdleTime'});
SCR->Write('.etc.imapd_conf.poptimeout',$MailLocalDelivery->{'PopIdleTime'});
+ SCR->Write('.etc.imapd_conf.allowplaintext','yes');
+ SCR->Write('.etc.imapd_conf.unixhierarchysep','yes');
+ SCR->Write('.etc.imapd_conf.allowplainwithouttls','yes');
if($MailLocalDelivery->{'FallBackMailbox'} ne '' )
{
SCR->Write('.etc.imapd_conf.lmtp_luser_relay',$MailLocalDelivery->{'FallBackMailbox'});
@@ -2054,6 +2087,24 @@
SCR->Execute('.mail.cyrusconf.toggleService', 'pop3s');
}
}
+ Service->Enable('saslauthd');
+ Service->Enable('cyrus');
+ if( !Service->Status('saslauthd') )
+ {
+ Service->Restart('saslauthd');
+ }
+ else
+ {
+ Service->Start('saslauthd');
+ }
+ if( !Service->Status('cyrus') )
+ {
+ Service->Restart('cyrus');
+ }
+ else
+ {
+ Service->Start('cyrus');
+ }
}
elsif( $MailLocalDelivery->{'Type'} eq 'none')
{
@@ -2075,6 +2126,31 @@
return 1;
}
+BEGIN { $TYPEINFO{CreateRootMailbox} =["function", "any", "string"]; }
+sub CreateRootMailbox {
+ my $self = shift;
+ my $AdminPassword = shift;
+
+ #Create mailbox for root
+ my $imap = new Net::IMAP($imaphost, Debug => 0);
+ if( $imap )
+ {
+ my $ret = $imap->login($imapadm, $AdminPassword);
+ if($$ret{Status} eq "ok")
+ {
+ $ret = $imap->select('usr/root');
+ if( $ret->{Status} ne 'ok' )
+ {
+ $ret = $imap->create('user/root');
+ $ret = $imap->setacl('user/root', 'cyrus', "lrswipkxtea");
+ $ret = $imap->setacl('user/root', 'root', "lrswipkxtea");
+ $ret = $imap->setacl('user/root', 'anyone', "" );
+ }
+ }
+ $imap->logout();
+ }
+}
+
BEGIN { $TYPEINFO{ReadFetchingMail} =["function", "any", "string"]; }
sub ReadFetchingMail {
my $self = shift;
@@ -2323,43 +2399,38 @@
}
else
{
- # This is a new domain, we create it.
- # We create all the DNS attributes. `hostname -f` is the NS entry.
- my $serial = POSIX::strftime("%Y%m%d%H%M",localtime);
- my $host = `hostname -f`; chomp $host;
- my $tmp = { 'Objectclass' => [ 'dNSZone','suseMailDomain' ],
- 'zoneName' => $name,
- 'suseMailDomainType' => $type,
- 'suseMailDomainMasquerading' => $masquerading,
+ # This is a new domain, we create it.
+ # We create all the DNS attributes. `hostname -f` is the NS and MX entry.
+ my $serial = POSIX::strftime("%Y%m%d%H",localtime);
+ my $host = `hostname -f`; chomp $host;
+ my $tmp = { 'Objectclass' => [ 'dNSZone','suseMailDomain' ],
+ 'zoneName' => $name,
+ 'suseMailDomainType' => $type,
+ 'suseMailDomainMasquerading' => $masquerading,
'relativeDomainName' => '@',
'dNSClass' => 'IN',
'dNSTTL' => '86400',
+ 'nSRecord' => $host.'.',
+ 'mXRecord' => '40 '.$host.'.',
'sOARecord' => $host.'. root.'.$host.'. '.$serial.' 10800 3600 302400 43200'
- };
- if(! SCR->Write('.ldap.add',{ "dn" => $DN } ,$tmp)){
- my $ldapERR = SCR->Read(".ldap.error");
- return $self->SetError(summary => "LDAP add failed",
- code => "SCR_WRITE_FAILED",
- description => $ldapERR->{'code'}." : ".$ldapERR->{'msg'});
- }
+ };
+ if(! SCR->Write('.ldap.add',{ "dn" => $DN } ,$tmp)){
+ my $ldapERR = SCR->Read(".ldap.error");
+ return $self->SetError(summary => "LDAP add failed",
+ code => "SCR_WRITE_FAILED",
+ description => $ldapERR->{'code'}." : ".$ldapERR->{'msg'});
+ }
}
}
# First we read the main.cf
my $MainCf = SCR->Read('.mail.postfix.main.table');
- write_attribute($MainCf,'masquerade_domains','ldap:/etc/postfix/ldapmasquerade_domains.cf');
write_attribute($MainCf,'masquerade_classes','envelope_sender, header_sender, header_recipient');
write_attribute($MainCf,'masquerade_exceptions','root');
- write_attribute($MainCf,'mydestination','$myhostname, localhost.$mydomain, $mydomain, ldap:/etc/postfix/ldapmydestination.cf');
- write_attribute($MainCf,'virtual_alias_maps', 'ldap:/etc/postfix/ldaplocal_recipient_maps.cf');
- write_attribute($MainCf,'virtual_alias_domains','ldap:/etc/postfix/ldapvirtual_alias_maps.cf');
+ write_ldap_maps($MainCf,$ldapMap);
SCR->Write('.mail.postfix.main.table',$MainCf);
SCR->Write('.mail.postfix.main',undef);
- check_ldap_configuration('masquerade_domains',$ldapMap);
- check_ldap_configuration('mydestination',$ldapMap);
- check_ldap_configuration('local_recipient_maps',$ldapMap);
- check_ldap_configuration('virtual_alias_maps',$ldapMap);
return 1;
}
@@ -2519,9 +2590,27 @@
code => "SCR_INIT_FAILED",
description => $ldapERR->{'code'}." : ".$ldapERR->{'msg'});
}
- if( ! SCR->Write('.ldap.add',
- { "dn" => $uBase },
- $configOBJ->{$uBase} ) )
+ if( ! SCR->Write('.ldap.add', { "dn" => $uBase }, $configOBJ->{$uBase} ) )
+ {
+ my $ldapERR = SCR->Read(".ldap.error");
+ return $self->SetError(summary => "LDAP add failed",
+ code => "SCR_INIT_FAILED",
+ description => $ldapERR->{'code'}." : ".$ldapERR->{'msg'});
+ }
+ $uBase = "ou=Aliases,ou=Mailserver,".$ldapMap->{'ldap_domain'};
+ $configOBJ->{$uBase}->{'objectClass'} = 'organizationalUnit';
+ $configOBJ->{$uBase}->{'ou'} = 'Aliases';
+ if( ! SCR->Write('.ldap.add', { "dn" => $uBase }, $configOBJ->{$uBase} ) )
+ {
+ my $ldapERR = SCR->Read(".ldap.error");
+ return $self->SetError(summary => "LDAP add failed",
+ code => "SCR_INIT_FAILED",
+ description => $ldapERR->{'code'}." : ".$ldapERR->{'msg'});
+ }
+ $uBase = "ou=Canonical,ou=Mailserver,".$ldapMap->{'ldap_domain'};
+ $configOBJ->{$uBase}->{'objectClass'} = 'organizationalUnit';
+ $configOBJ->{$uBase}->{'ou'} = 'Canonical';
+ if( ! SCR->Write('.ldap.add', { "dn" => $uBase }, $configOBJ->{$uBase} ) )
{
my $ldapERR = SCR->Read(".ldap.error");
return $self->SetError(summary => "LDAP add failed",
@@ -2845,30 +2934,10 @@
SCR->Execute('.mail.postfix.mastercf.deleteService', {'service' => 'tlsmgr','command' => 'tlsmgr'});
}
}
- #Setup the ldap tables;
- # Transport
- check_ldap_configuration('transport_maps',$ldapMap);
- write_attribute($MainCf,'transport_maps','ldap:/etc/postfix/ldaptransport_maps.cf');
- # smtp_tls_per_site
- check_ldap_configuration('smtp_tls_per_site',$ldapMap);
- write_attribute($MainCf,'smtp_tls_per_site','ldap:/etc/postfix/ldapsmtp_tls_per_site.cf');
- #
- write_attribute($MainCf,'masquerade_domains','ldap:/etc/postfix/ldapmasquerade_domains.cf');
write_attribute($MainCf,'masquerade_classes','envelope_sender, header_sender, header_recipient');
write_attribute($MainCf,'masquerade_exceptions','root');
- write_attribute($MainCf,'content_filter','');
- write_attribute($MainCf,'mydestination','$myhostname, localhost.$mydomain, $mydomain, ldap:/etc/postfix/ldapmydestination.cf');
- write_attribute($MainCf,'virtual_alias_maps', 'ldap:/etc/postfix/ldaplocal_recipient_maps.cf');
- write_attribute($MainCf,'virtual_alias_domains','ldap:/etc/postfix/ldapvirtual_alias_maps.cf');
- write_attribute($MainCf,'alias_maps','hash:/etc/aliases, ldap:/etc/postfix/ldapalias_maps.cf, ldap:/etc/postfix/ldapalias_maps_member.cf');
- check_ldap_configuration('transport_maps',$ldapMap);
- check_ldap_configuration('smtp_tls_per_site',$ldapMap);
- check_ldap_configuration('masquerade_domains',$ldapMap);
- check_ldap_configuration('mydestination',$ldapMap);
- check_ldap_configuration('local_recipient_maps',$ldapMap);
- check_ldap_configuration('virtual_alias_maps',$ldapMap);
- check_ldap_configuration('alias_maps',$ldapMap);
- check_ldap_configuration('alias_maps_member',$ldapMap);
+ #Setup the ldap tables;
+ write_ldap_maps($MainCf,$ldapMap);
SCR->Write('.mail.postfix.main.table',$MainCf);
SCR->Write('.mail.postfix.main',undef);
SCR->Write('.mail.postfix.mastercf',undef);
@@ -2877,22 +2946,6 @@
return 1;
}
-# some helper funktions
-sub read_attribute {
- my $config = shift;
- my $attribute = shift;
-
- foreach(@{$config})
- {
- if($_->{"key"} eq $attribute)
- {
- return $_->{"value"};
- }
- }
- return '';
-}
-
-
sub activate_virus_scanner {
my $VSCount = shift || 5;
use File::Copy;
@@ -2908,16 +2961,28 @@
my @ACONF = <IN>;
close(IN);
- my $isclam = 0;
- my $ismax = 0;
+ my $isclam = 0;
+ my $ismax = 0;
+ my $ismyhostname = 0;
+ my $myhostname = `hostname -f`; chomp $myhostname;
+ my $mydomain = `hostname -d`; chomp $mydomain;
foreach my $l ( @ACONF )
{
if ( $l =~ s/^\$max_servers = .*;/\$max_servers = $VSCount;/ )
{
- #fix bnc#450888 : remove the supplementary entries
next if $ismax;
$ismax = 1;
}
+ if ( $l =~ s/^\$myhostname = .*;/\$myhostname = '$myhostname';/ )
+ {
+ next if $ismyhostname;
+ $ismyhostname = 1;
+ }
+ if ( $l =~ s/^\$mydomain = .*;/\$mydomain = '$mydomain';/ )
+ {
+ push @CONF, $l;
+ next ;
+ }
$l =~ s/(.*)/# $1/ if $l =~ /bypass_virus_checks_acl.*=.*qw\( \./;
if( $isclam || $l =~ /Clam Antivirus-clamd/ )
{
@@ -2931,14 +2996,20 @@
}
push @CONF, $l;
}
+ pop @CONF;
if( !$ismax )
{
- push @CONF, '$max_servers = '.$VSCount;
+ push @CONF, '$max_servers = '.$VSCount.";\n";
+ }
+ if( !$ismyhostname )
+ {
+ push @CONF, '$myhostname = '."'$myhostname';\n";
}
if( ! open(OUT,">$aconf.new") )
{
return "Error: $!";
}
+ push @CONF, '1;';
print OUT @CONF;
close(OUT);
@@ -2968,8 +3039,10 @@
move("$aconf.new",$aconf);
move("$cconf.new",$cconf);
Service->Enable('amavis');
+ Service->Enable('freshclam');
Service->Enable('clamd');
Service->Start('amavis');
+ Service->Start('freshclam');
Service->Start('clamd');
return "";
}
@@ -3001,6 +3074,70 @@
return 1;
}
+sub read_attribute {
+ my $config = shift;
+ my $attribute = shift;
+ my $a = undef;
+ foreach(@{$config})
+ {
+ if($_->{"key"} eq $attribute)
+ {
+ return $_->{"value"} if defined $_->{"value"};
+ }
+ }
+ chomp( $a = `postconf -h $attribute` );
+ return $a if( defined $a );
+ return undef;
+}
+
+# Internal helper Funktion to write the ldap maps
+sub write_ldap_maps($$)
+{
+ my( $MainCf, $ldapMap ) = @_;
+
+ my $alias_maps = read_attribute($MainCf,'alias_maps');
+ if($alias_maps !~ /ldap:\/etc\/postfix\/ldapalias_maps_folder.cf/)
+ {
+ $alias_maps .= ', ldap:/etc/postfix/ldapalias_maps_folder.cf';
+ }
+ if($alias_maps !~ /ldap:\/etc\/postfix\/ldapalias_maps.cf/)
+ {
+ $alias_maps .= ', ldap:/etc/postfix/ldapalias_maps.cf';
+ }
+ write_attribute($MainCf,'alias_maps',$alias_maps);
+ my $masquerade_domains = read_attribute($MainCf,'masquerade_domains');
+ if($masquerade_domains !~ /ldap:\/etc\/postfix\/ldapmasquerade_domains.cf/)
+ {
+ $masquerade_domains .= ', ldap:/etc/postfix/ldapmasquerade_domains.cf';
+ }
+ write_attribute($MainCf,'masquerade_domains',$masquerade_domains);
+ my $mydestination = read_attribute($MainCf,'mydestination');
+ if($mydestination !~ /ldap:\/etc\/postfix\/ldapmydestination.cf/ )
+ {
+ $mydestination .= ', ldap:/etc/postfix/ldapmydestination.cf';
+ }
+ write_attribute($MainCf,'mydestination',$mydestination);
+ write_attribute($MainCf,'smtpd_sender_restrictions','ldap:/etc/postfix/ldapaccess.cf');
+ write_attribute($MainCf,'smtp_tls_per_site','ldap:/etc/postfix/ldapsmtp_tls_per_site.cf');
+ write_attribute($MainCf,'transport_maps','ldap:/etc/postfix/ldaptransport_maps.cf');
+ write_attribute($MainCf,'virtual_alias_maps', 'ldap:/etc/postfix/ldapuser_recipient_maps.cf, ldap:/etc/postfix/ldapvalias_maps_both.cf, ldap:/etc/postfix/ldapvalias_maps_member.cf, ldap:/etc/postfix/ldapvalias_maps_folder.cf, ldap:/etc/postfix/ldapvalias_maps_forward.cf');
+ write_attribute($MainCf,'virtual_alias_domains','ldap:/etc/postfix/ldapvirtual_alias_domains.cf');
+ check_ldap_configuration('access',$ldapMap);
+ check_ldap_configuration('alias_maps',$ldapMap);
+ check_ldap_configuration('alias_maps_folder',$ldapMap);
+ check_ldap_configuration('masquerade_domains',$ldapMap);
+ check_ldap_configuration('mydestination',$ldapMap);
+ check_ldap_configuration('smtp_tls_per_site',$ldapMap);
+ check_ldap_configuration('transport_maps',$ldapMap);
+ check_ldap_configuration('user_recipient_maps',$ldapMap);
+ check_ldap_configuration('valias_maps_both',$ldapMap);
+ check_ldap_configuration('valias_maps_member',$ldapMap);
+ check_ldap_configuration('valias_maps_folder',$ldapMap);
+ check_ldap_configuration('valias_maps_forward',$ldapMap);
+ check_ldap_configuration('virtual_alias_domains',$ldapMap);
+
+}
+
# Internal helper Funktion to check if a needed ldap table is correctly defined
# in the main.cf. If not so the neccesary entries will be created.
sub check_ldap_configuration {
@@ -3009,71 +3146,97 @@
my $changes = 0;
my %query_filter = (
- 'transport_maps' => '(&(objectClass=suseMailTransport)(suseMailTransportDestination=%s))',
- 'smtp_tls_per_site' => '(&(objectClass=suseMailTransport)(suseMailTransportDestination=%s))',
- 'access' => '(&(objectClass=suseMailAccess)(suseMailClient=%s))',
- 'local_recipient_maps'=> '(&(objectClass=suseMailRecipient)(|(suseMailAcceptAddress=%s)(uid=%s)))',
- 'alias_maps' => '(&(objectClass=suseMailRecipient)(cn=%s))',
- 'alias_maps_member' => '(&(objectClass=suseMailRecipient)(cn=%s)(suseDeliveryToMember=yes))',
- 'mynetworks' => '(&(objectClass=suseMailMyNetworks)(suseMailClient=%s))',
- 'masquerade_domains' => '(&(objectClass=suseMailDomain)(zoneName=%s)(suseMailDomainMasquerading=yes))',
- 'mydestination' => '(&(objectClass=suseMailDomain)(zoneName=%s)(relativeDomainName=@)(!(suseMailDomainType=virtual)))',
- 'virtual_alias_maps' => '(&(objectClass=suseMailDomain)(zoneName=%s)(relativeDomainName=@)(suseMailDomainType=virtual))',
- 'canonical_maps' => '(&(objectClass=suseCanonicalTable)(tableKey=%s)(valueType=both))',
- 'recipient_canonical_maps' => '(&(objectClass=suseCanonicalTable)(tableKey=%s)(valueType=recipient))',
- 'sender_canonical_maps' => '(&(objectClass=suseCanonicalTable)(tableKey=%s)(valueType=sender))'
+ 'access' => '(&(objectClass=suseMailAccess)(suseMailClient=%s))',
+ 'alias_maps' => '(&(objectClass=suseMailTable)(tableKey=%s))',
+ 'alias_maps_folder' => '(&(objectClass=suseMailRecipient)(cn=%s)(suseDeliveryToFolder=yes))',
+ 'masquerade_domains' => '(&(objectClass=suseMailDomain)(zoneName=%s)(suseMailDomainMasquerading=yes))',
+ 'mydestination' => '(&(objectClass=suseMailDomain)(zoneName=%s)(relativeDomainName=@)(!(suseMailDomainType=virtual)))',
+ 'mynetworks' => '(&(objectClass=suseMailMyNetworks)(suseMailClient=%s))',
+ 'smtp_tls_per_site' => '(&(objectClass=suseMailTransport)(suseMailTransportDestination=%s))',
+ 'transport_maps' => '(&(objectClass=suseMailTransport)(suseMailTransportDestination=%s))',
+ 'user_recipient_maps' => '(&(objectClass=suseMailRecipient)(suseMailAcceptAddress=%s))',
+ 'valias_maps_both' => '(&(objectClass=suseMailRecipient)(suseMailAcceptAddress=%s)(suseDeliveryToMember=yes)(suseDeliveryToFolder=yes))',
+ 'valias_maps_member' => '(&(objectClass=suseMailRecipient)(suseMailAcceptAddress=%s)(suseDeliveryToMember=yes)(!(suseDeliveryToFolder=yes)))',
+ 'valias_maps_folder' => '(&(objectClass=suseMailRecipient)(suseMailAcceptAddress=%s)(!(suseDeliveryToMember=yes))(suseDeliveryToFolder=yes))',
+ 'valias_maps_forward' => '(&(objectClass=suseMailRecipient)(suseMailAcceptAddress=%s)(!(suseDeliveryToMember=yes))(!(suseDeliveryToFolder=yes)))',
+ 'virtual_alias_domains' => '(&(objectClass=suseMailDomain)(zoneName=%s)(relativeDomainName=@)(suseMailDomainType=virtual))',
+ 'canonical_maps' => '(&(objectClass=suseCanonicalTable)(tableKey=%s)(valueType=both))',
+ 'recipient_canonical_maps'=> '(&(objectClass=suseCanonicalTable)(tableKey=%s)(valueType=recipient))',
+ 'sender_canonical_maps' => '(&(objectClass=suseCanonicalTable)(tableKey=%s)(valueType=sender))'
);
my %result_attribute = (
- 'transport_maps' => 'suseMailTransportNexthop',
- 'smtp_tls_per_site' => 'suseTLSPerSiteMode',
- 'access' => 'suseMailAction',
- 'local_recipient_maps'=> 'uid',
- 'alias_maps' => 'suseMailCommand,suseMailForwardAddress',
- 'alias_maps_member' => 'uid,suseMailForwardAddress',
- 'mynetworks' => 'suseMailClient',
- 'masquerade_domains' => 'zoneName',
- 'mydestination' => 'zoneName',
- 'virtual_alias_maps' => 'zoneName',
- 'canonical_maps' => 'tableValue',
- 'recipient_canonical_maps' => 'tableValue',
- 'sender_canonical_maps' => 'tableValue'
+ 'access' => 'suseMailAction',
+ 'alias_maps' => 'tableValue',
+ 'alias_maps_folder' => 'suseMailCommand',
+ 'masquerade_domains' => 'zoneName',
+ 'mydestination' => 'zoneName',
+ 'mynetworks' => 'suseMailClient',
+ 'transport_maps' => 'suseMailTransportNexthop',
+ 'valias_maps_both' => 'suseMailForwardAddress,cn,uid',
+ 'valias_maps_member' => 'suseMailForwardAddress,uid',
+ 'valias_maps_folder' => 'suseMailForwardAddress,cn',
+ 'valias_maps_forward' => 'suseMailForwardAddress',
+ 'virtual_alias_domains' => 'zoneName',
+ 'canonical_maps' => 'tableValue',
+ 'recipient_canonical_maps'=> 'tableValue',
+ 'smtp_tls_per_site' => 'suseMailTransportNexthop',
+ 'sender_canonical_maps' => 'tableValue',
+ 'user_recipient_maps' => 'uid,suseMailForwardAddress'
);
my %scope = (
- 'transport_maps' => 'one',
- 'smtp_tls_per_site' => 'one',
- 'access' => 'one',
- 'local_recipient_maps'=> 'one',
- 'alias_maps' => 'one',
- 'alias_maps_member' => 'one',
- 'mynetworks' => 'one',
- 'masquerade_domains' => 'sub',
- 'mydestination' => 'sub',
- 'virtual_alias_maps' => 'sub',
- 'canonical_maps' => 'one',
- 'recipient_canonical_maps' => 'one',
- 'sender_canonical_maps' => 'one'
+ 'access' => 'one',
+ 'alias_maps' => 'one',
+ 'alias_maps_folder' => 'one',
+ 'masquerade_domains' => 'sub',
+ 'mydestination' => 'sub',
+ 'mynetworks' => 'one',
+ 'transport_maps' => 'one',
+ 'smtp_tls_per_site' => 'one',
+ 'valias_maps_both' => 'one',
+ 'valias_maps_member' => 'one',
+ 'valias_maps_folder' => 'one',
+ 'valias_maps_forward' => 'one',
+ 'virtual_alias_domains' => 'sub',
+ 'canonical_maps' => 'one',
+ 'recipient_canonical_maps'=> 'one',
+ 'sender_canonical_maps' => 'one',
+ 'user_recipient_maps' => 'one'
);
my %base = (
- 'transport_maps' => $ldapMap->{'mail_config_dn'},
- 'smtp_tls_per_site' => $ldapMap->{'mail_config_dn'},
- 'access' => $ldapMap->{'mail_config_dn'},
- 'local_recipient_maps'=> $ldapMap->{'user_config_dn'},
- 'alias_maps' => $ldapMap->{'group_config_dn'},
- 'alias_maps_member' => $ldapMap->{'group_config_dn'},
- 'mynetworks' => $ldapMap->{'mail_config_dn'},
- 'masquerade_domains' => $ldapMap->{'dns_config_dn'},
- 'mydestination' => $ldapMap->{'dns_config_dn'},
- 'virtual_alias_maps' => $ldapMap->{'dns_config_dn'},
- 'canonical_maps' => $ldapMap->{'mail_config_dn'},
- 'recipient_canonical_maps' => $ldapMap->{'mail_config_dn'},
- 'sender_canonical_maps' => $ldapMap->{'mail_config_dn'}
+ 'access' => $ldapMap->{'mail_config_dn'},
+ 'alias_maps' => 'ou=Aliases,'.$ldapMap->{'mail_config_dn'},
+ 'alias_maps_folder' => $ldapMap->{'group_config_dn'},
+ 'masquerade_domains' => $ldapMap->{'dns_config_dn'},
+ 'mydestination' => $ldapMap->{'dns_config_dn'},
+ 'mynetworks' => $ldapMap->{'mail_config_dn'},
+ 'smtp_tls_per_site' => $ldapMap->{'mail_config_dn'},
+ 'transport_maps' => $ldapMap->{'mail_config_dn'},
+ 'valias_maps_both' => $ldapMap->{'group_config_dn'},
+ 'valias_maps_member' => $ldapMap->{'group_config_dn'},
+ 'valias_maps_folder' => $ldapMap->{'group_config_dn'},
+ 'valias_maps_forward' => $ldapMap->{'group_config_dn'},
+ 'virtual_alias_domains' => $ldapMap->{'dns_config_dn'},
+ 'canonical_maps' => 'ou=Canonical,'.$ldapMap->{'mail_config_dn'},
+ 'recipient_canonical_maps'=> 'ou=Canonical,'.$ldapMap->{'mail_config_dn'},
+ 'sender_canonical_maps' => 'ou=Canonical,'.$ldapMap->{'mail_config_dn'},
+ 'user_recipient_maps' => $ldapMap->{'user_config_dn'}
);
my %special_result_attribute = (
- 'alias_maps_member' => 'member',
+ 'valias_maps_both' => 'member',
+ 'valias_maps_member' => 'member'
);
+ my %terminal_result_attribute = (
+ 'valias_maps_both' => 'uid',
+ 'valias_maps_member' => 'uid'
+ );
+if( ! defined $result_attribute{$config} )
+{
+ print STDERR "BAJAVAN $config";
+ return;
+}
#First we read the whool main.cf configuration
my $LDAPCF = SCR->Read('.mail.ldaptable',$config);
@@ -3125,6 +3288,10 @@
{
$LDAPCF->{'special_result_attribute'} = $special_result_attribute{$config};
}
+ if(defined $terminal_result_attribute{$config})
+ {
+ $LDAPCF->{'terminal_result_attribute'} = $terminal_result_attribute{$config};
+ }
$LDAPCF->{'scope'} = $scope{$config};
SCR->Write('.mail.ldaptable',[$config,$LDAPCF]);
Modified: branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_complex.ycp?rev=60558&r1=60557&r2=60558&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_complex.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_complex.ycp Wed Jan 27 15:40:56 2010
@@ -127,6 +127,8 @@
*/
symbol WriteDialog()
{
+ Wizard::CreateDialog ();
+ Wizard::SetDesktopIcon("mail");
Wizard::RestoreHelp(HELPS["write"]:"");
boolean ret = MailServer::Write();
return ret ? `next : `abort;
Modified: branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_dialogs.ycp?rev=60558&r1=60557&r2=60558&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_dialogs.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/mail/src/mail-server_dialogs.ycp Wed Jan 27 15:40:56 2010
@@ -658,7 +658,7 @@
term MailPreventionDialog(string CID, string CIDRBL)
{
- y2milestone("--Start MailTransportsDialog ---");
+ y2milestone("--Start MailPreventionDialog ---");
list<term> AccessItems= [];
list<term> RBLItems = [];
string BasicProtection = (string)MailServer::MailPrevention["BasicProtection"]:"";
@@ -666,13 +666,12 @@
list