bin/59708: [patch] add sSMTP support for Mail selection in
sysinstall
Clement Laforet
sheepkiller at cultdeadsheep.org
Wed Nov 26 04:20:23 PST 2003
>Number: 59708
>Category: bin
>Synopsis: [patch] add sSMTP support for Mail selection in sysinstall
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Wed Nov 26 04:20:19 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Clement Laforet
>Release: FreeBSD 5.2-BETA i386
>Organization:
cotds.org
>Environment:
System: FreeBSD lucifer.cultdeadsheep.org 5.2-BETA FreeBSD 5.2-BETA #0: Sat Nov 22 21:09:27 CET 2003 clement at lucifer.cultdeadsheep.org:/usr/obj/usr/src/sys/LUCIFER i386
>Description:
MTA proposed by sysinstall are full features ones, and are not appropriate
for satellite systems. sSMTP is a small MTA/sendmail emulator which only
forwards mails to a mailhub.
package is small (17kb) and can be added to disc1.
http://lists.freebsd.org/pipermail/freebsd-qa/2003-September/000127.html
>How-To-Repeat:
N/A.
>Fix:
--- sysintall-ssmtp.diff begins here ---
Index: src/usr.sbin/sysinstall/config.c
===================================================================
RCS file: /WORK/REPO/FreeBSD/src/usr.sbin/sysinstall/config.c,v
retrieving revision 1.216
diff -u -r1.216 config.c
--- src/usr.sbin/sysinstall/config.c 28 Sep 2003 05:21:23 -0000 1.216
+++ src/usr.sbin/sysinstall/config.c 26 Nov 2003 11:52:51 -0000
@@ -1263,3 +1263,66 @@
return DITEM_SUCCESS;
}
+
+int
+configMTASsmtp(dialogMenuItem *self)
+{
+ int ret;
+ FILE *perconf, *mailerconf;
+
+ ret = package_add("ssmtp");
+
+ if(DITEM_STATUS(ret) == DITEM_FAILURE) {
+ msgConfirm("An error occurred while adding the ssmtp package\n"
+ "Please change installation media and try again.");
+ return ret;
+ }
+
+ variable_set2(VAR_SENDMAIL_ENABLE, "NONE", 1);
+
+ /* Update periodic.conf */
+ perconf = fopen("/etc/periodic.conf", "a");
+ if (perconf == NULL) {
+ /* Not really a serious problem, so we do not abort */
+ msgConfirm("Unable to open /etc/periodic.conf.\n"
+ "The daily cleanup scripts might generate errors when\n"
+ "trying to run some sendmail only cleanup scripts.\n");
+ } else {
+ fprintf(perconf, "# --- Generated by sysinstall ---\n");
+ fprintf(perconf, "daily_clean_hoststat_enable=\"NO\"\n");
+ fprintf(perconf, "daily_status_include_submit_mailq=\"NO\"\n");
+ fprintf(perconf, "daily_status_mail_rejects_enable=\"NO\"\n");
+ fprintf(perconf, "daily_submit_queuerun=\"NO\"\n");
+ fclose(perconf);
+ }
+
+ /* Update mailer.conf */
+ vsystem("mv -f /etc/mail/mailer.conf /etc/mail/mailer.conf.old");
+ mailerconf = fopen("/etc/mail/mailer.conf", "w");
+ if (mailerconf == NULL) {
+ /* Not really a serious problem, so we do not abort */
+ msgConfirm("Unable to open /etc/mailer.conf.\n"
+ "Some programs which use the sendmail wrappers may not work.\n"
+ "Please consult the documentation for the sSMTP port on how\n"
+ "to correct this.");
+ } else {
+ fprintf(mailerconf, "# --- Generated by sysinstall ---\n");
+ fprintf(mailerconf, "# Execute sSMTP instead of sendmail\n");
+ fprintf(mailerconf, "#\n");
+ fprintf(mailerconf, "sendmail /usr/local/sbin/ssmtp\n");
+ fprintf(mailerconf, "send-mail /usr/local/sbin/ssmtp\n");
+ fprintf(mailerconf, "mailq /usr/local/sbin/ssmtp\n");
+ fprintf(mailerconf, "newaliases /usr/local/sbin/ssmtp\n");
+ fprintf(mailerconf, "hoststat /usr/bin/true\n");
+ fprintf(mailerconf, "purgestat /usr/bin/true\n");
+ fclose(mailerconf);
+ }
+
+ msgConfirm("sSMTP is now installed and enabled as the default MTA.\n"
+ "Please check that the configuration works as expected.\n"
+ "See the ssmtp (8) man page for more information.\n"
+ "Don't forget to configure /usr/local/etc/ssmtp/ssmtp.conf.\n");
+
+ return DITEM_SUCCESS;
+}
+
Index: src/usr.sbin/sysinstall/menus.c
===================================================================
RCS file: /WORK/REPO/FreeBSD/src/usr.sbin/sysinstall/menus.c,v
retrieving revision 1.382
diff -u -r1.382 menus.c
--- src/usr.sbin/sysinstall/menus.c 24 Nov 2003 15:27:20 -0000 1.382
+++ src/usr.sbin/sysinstall/menus.c 26 Nov 2003 11:52:51 -0000
@@ -1483,8 +1483,9 @@
"Selecting Sendmail local disables sendmail's network socket for\n"
"incoming mail, but still enables sendmail for local and outbound mail.\n"
"The Postfix option will install the Postfix MTA from the ports\n"
- "collection. The Exim option will install the Exim MTA from the ports\n"
- "collection. To return to the previous menu, select Exit.",
+ "collection. The Exim option will install the Exim MTA from the ports\n"
+ "collection. The Ssmtp option will install the sSMTP MTA from the ports\n"
+ "collection. To return to the previous menu, select Exit.",
NULL,
NULL,
{
@@ -1496,6 +1497,8 @@
NULL, configMTAPostfix, NULL, NULL },
{ "Exim", "Use the Exim MTA",
NULL, configMTAExim, NULL, NULL },
+ { "Ssmtp", "Use the sSMTP MTA (forwards mails to a mailhub)",
+ NULL, configMTASsmtp, NULL, NULL },
{ "None", "Do not install an MTA",
dmenuVarCheck, dmenuSetVariable, NULL, "sendmail_enable=NONE" },
{ "X Exit", "Exit this menu (returning to previous)",
Index: src/usr.sbin/sysinstall/sysinstall.h
===================================================================
RCS file: /WORK/REPO/FreeBSD/src/usr.sbin/sysinstall/sysinstall.h,v
retrieving revision 1.252
diff -u -r1.252 sysinstall.h
--- src/usr.sbin/sysinstall/sysinstall.h 2 Nov 2003 08:58:57 -0000 1.252
+++ src/usr.sbin/sysinstall/sysinstall.h 26 Nov 2003 11:52:51 -0000
@@ -530,6 +530,7 @@
extern int configNFSServer(dialogMenuItem *self);
extern int configMTAPostfix(dialogMenuItem *self);
extern int configMTAExim(dialogMenuItem *self);
+extern int configMTASsmtp(dialogMenuItem *self);
extern int configRpcBind(dialogMenuItem *self);
extern int configWriteRC_conf(dialogMenuItem *self);
extern int configSecurityProfile(dialogMenuItem *self);
--- sysintall-ssmtp.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list