|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
[PATCH][FIX][snapshot-19991123] postconf -e is sensitive to umask/group settings
Matthias Andree (mandree
dosis.uni-dortmund.de)
26 Nov 1999 02:45:16 +0100
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Wietse Venema: "Re: [PATCH][FIX][snapshot-19991123] postconf -e is sensitive to umask/group settings"
- Previous message: Matthias Andree: "chroot setup tool for SuSE Linux 6.2 servers running postfix"
- Next in thread: Wietse Venema: "Re: [PATCH][FIX][snapshot-19991123] postconf -e is sensitive to umask/group settings"
- Reply: Wietse Venema: "Re: [PATCH][FIX][snapshot-19991123] postconf -e is sensitive to umask/group settings"
Hi, Wietse,
while I appreciate the new -e option of postconf, it has a bug which can
end up breaking the entire system:
Procedure to verify (assumed that $config_directory == /etc/postfix):
su
umask 077
ls -l /etc/postfix/main.cf
postconf -e x_for_demonstration_only=true
ls -l /etc/postfix/main.cf
After that, $sendmail_path will break deliveries by unprivileged users
since it cannot read the main.cf any more. Besides that, it may happen
that postconf is not invoked with group root, which would leave it
belonging to another group (this is rather cosmetic).
Below is a patch which alleviates these problems. You may of course
choose to omit the chown() lines if you find them inappropriate.
diff -cr snapshot-19991123/HISTORY snapshot-19991123-ma1/HISTORY
*** snapshot-19991123/HISTORY Tue Nov 23 14:00:55 1999
--- snapshot-19991123-ma1/HISTORY Fri Nov 26 02:41:30 1999
***************
*** 3291,3293 ****
--- 3291,3300 ----
19991122
Bugfix: missing absolute path in INSTALL.sh broke fresh install.
+
+ 19991126
+
+ Bugfix: postconf -e was sensitive to umask and could thus leave
+ main.cf with 0600 after edit, breaking the entire system.
+ main.cf is now forced to mode 0644 after edit (patch by Matthias
+ Andree). File: postconf/postconf.c.
diff -cr snapshot-19991123/postconf/postconf.c snapshot-19991123-ma1/postconf/postconf.c
*** snapshot-19991123/postconf/postconf.c Fri Nov 19 03:29:27 1999
--- snapshot-19991123-ma1/postconf/postconf.c Fri Nov 26 02:37:44 1999
***************
*** 349,359 ****
--- 349,364 ----
/*
* When all is well, rename the temp file to the original one.
+ * Set sane permissions and ownership independently of umask setting.
*/
if (vstream_fclose(src))
msg_fatal("read %s: %m", path);
if (vstream_fclose(dst))
msg_fatal("write %s: %m", temp);
+ if (chmod(temp, 0644))
+ msg_fatal("chmod %s to 0644: %m", temp);
+ if (chown(temp, 0, 0))
+ msg_fatal("chown %s to root.root: %m", temp);
if (rename(temp, path) < 0)
msg_fatal("rename %s to %s: %m", temp, path);
-- Matthias AndreeHi! I'm the infamous .signature virus! Copy me into your ~/.signature to help me spread!
- Next message: Wietse Venema: "Re: [PATCH][FIX][snapshot-19991123] postconf -e is sensitive to umask/group settings"
- Previous message: Matthias Andree: "chroot setup tool for SuSE Linux 6.2 servers running postfix"
- Next in thread: Wietse Venema: "Re: [PATCH][FIX][snapshot-19991123] postconf -e is sensitive to umask/group settings"
- Reply: Wietse Venema: "Re: [PATCH][FIX][snapshot-19991123] postconf -e is sensitive to umask/group settings"
This archive was generated by hypermail 2.0b3 on Thu Nov 25 1999 - 21:07:04 CST