Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54866 - in /trunk/mail/src: MailServer.ycp YaPI/MailServer.pm
  • From: varkoly@xxxxxxxxxxxxxxxx
  • Date: Wed, 21 Jan 2009 16:43:58 -0000
  • Message-id: <E1LPgBK-0006My-NH@xxxxxxxxxxxxxxxx>
Author: varkoly
Date: Wed Jan 21 17:43:58 2009
New Revision: 54866

URL: http://svn.opensuse.org/viewcvs/yast?rev=54866&view=rev
Log:
bnc467562 - Yast mail doesn't install needed Spamassassin Package for
SPAM learning extension for Mailserver

Modified:
trunk/mail/src/MailServer.ycp
trunk/mail/src/YaPI/MailServer.pm

Modified: trunk/mail/src/MailServer.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/mail/src/MailServer.ycp?rev=54866&r1=54865&r2=54866&view=diff
==============================================================================
--- trunk/mail/src/MailServer.ycp (original)
+++ trunk/mail/src/MailServer.ycp Wed Jan 21 17:43:58 2009
@@ -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 = false;
+global boolean clamav = 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("clamav");
+ spamassassin = 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 */
@@ -564,39 +561,69 @@
// 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",
+ if((boolean)MailPrevention["VirusScanning"]:false)
+ {
+ to_install = "";
+ 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(["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");
+ {
+ 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::Restart("clamd");
- Service::Restart("freshclam");
- Service::Restart("amavis");
- }
+ 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);

@@ -636,38 +663,29 @@
}

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);
+ 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(Service::Status("cyrus") > 0) {
+ Service::Start("cyrus");
+ Service::Enable("cyrus");
+ }
} else {
if(cyrus_installed) {
Service::Stop("cyrus");

Modified: trunk/mail/src/YaPI/MailServer.pm
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/mail/src/YaPI/MailServer.pm?rev=54866&r1=54865&r2=54866&view=diff
==============================================================================
--- trunk/mail/src/YaPI/MailServer.pm (original)
+++ trunk/mail/src/YaPI/MailServer.pm Wed Jan 21 17:43:58 2009
@@ -1212,6 +1212,7 @@
$MailPrevention{'SpamLearning'} = YaST::YCP::Boolean(1);
}
}
+ $imap->logout();
}

return \%MailPrevention;
@@ -1509,13 +1510,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
@@ -1526,22 +1527,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");
}
+ $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->Write(".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;
@@ -2012,6 +2017,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'});
@@ -2096,6 +2104,20 @@
SCR->Execute('.mail.cyrusconf.toggleService', 'pop3s');
}
}
+ #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->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();
+ }
}
elsif( $MailLocalDelivery->{'Type'} eq 'none')
{

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages