Mon, 20 Apr 2009 19:22:00 +0200
Change unfortunate but partly useful overreaching security tradeoff.
The principle of allocating each running process an individual system
user and group can have security benefits, however maintining a plethora
of users, groups, processes, file modes, file permissions, and even
nonportable file ACLs on a host serving from a hundred processes has
some security disadvantages. This tradeoff is even worse for systems
like OpenPKG which benefit from administration transparency through the
use of minimal system intrusion and only three usage privilege levels.
michael@146 | 1 | Index: makedefs |
michael@146 | 2 | --- makedefs.orig 2008-01-15 21:20:24 +0100 |
michael@146 | 3 | +++ makedefs 2008-01-24 12:31:48 +0100 |
michael@146 | 4 | @@ -132,6 +132,10 @@ |
michael@146 | 5 | ;; |
michael@146 | 6 | FreeBSD.7*) SYSTYPE=FREEBSD7 |
michael@146 | 7 | ;; |
michael@146 | 8 | + FreeBSD.7*) SYSTYPE=FREEBSD7 |
michael@146 | 9 | + ;; |
michael@146 | 10 | + FreeBSD.8*) SYSTYPE=FREEBSD8 |
michael@146 | 11 | + ;; |
michael@146 | 12 | OpenBSD.2*) SYSTYPE=OPENBSD2 |
michael@146 | 13 | ;; |
michael@146 | 14 | OpenBSD.3*) SYSTYPE=OPENBSD3 |
michael@146 | 15 | Index: src/util/file_limit.c |
michael@146 | 16 | --- src/util/file_limit.c.orig 2003-10-22 20:48:36 +0200 |
michael@146 | 17 | +++ src/util/file_limit.c 2008-01-24 12:31:48 +0100 |
michael@146 | 18 | @@ -80,12 +80,21 @@ |
michael@146 | 19 | void set_file_limit(off_t limit) |
michael@146 | 20 | { |
michael@146 | 21 | #ifdef USE_ULIMIT |
michael@146 | 22 | +#ifdef USE_SOFTLIMITONLY |
michael@146 | 23 | +#error "USE_ULIMIT and USE_SOFTLIMITONLY are mutual exclusive" |
michael@146 | 24 | +#endif |
michael@146 | 25 | if (ulimit(UL_SETFSIZE, limit / ULIMIT_BLOCK_SIZE) < 0) |
michael@146 | 26 | msg_fatal("ulimit: %m"); |
michael@146 | 27 | #else |
michael@146 | 28 | struct rlimit rlim; |
michael@146 | 29 | |
michael@146 | 30 | +#ifdef USE_SOFTLIMITONLY |
michael@146 | 31 | + if (getrlimit(RLIMIT_FSIZE, &rlim) < 0) |
michael@146 | 32 | + rlim.rlim_max = RLIM_INFINITY; |
michael@146 | 33 | + rlim.rlim_cur = limit; |
michael@146 | 34 | +#else |
michael@146 | 35 | rlim.rlim_cur = rlim.rlim_max = limit; |
michael@146 | 36 | +#endif |
michael@146 | 37 | if (setrlimit(RLIMIT_FSIZE, &rlim) < 0) |
michael@146 | 38 | msg_fatal("setrlimit: %m"); |
michael@146 | 39 | #ifdef SIGXFSZ |
michael@146 | 40 | Index: src/util/msg_syslog.c |
michael@146 | 41 | --- src/util/msg_syslog.c.orig 2006-06-15 20:07:16 +0200 |
michael@146 | 42 | +++ src/util/msg_syslog.c 2008-01-24 12:31:48 +0100 |
michael@146 | 43 | @@ -50,6 +50,11 @@ |
michael@146 | 44 | #include <syslog.h> |
michael@146 | 45 | #include <string.h> |
michael@146 | 46 | #include <time.h> |
michael@146 | 47 | +#ifdef USE_SOFTLIMITONLY |
michael@146 | 48 | +#include <sys/time.h> |
michael@146 | 49 | +#include <sys/resource.h> |
michael@146 | 50 | +#include <signal.h> |
michael@146 | 51 | +#endif |
michael@146 | 52 | |
michael@146 | 53 | /* Application-specific. */ |
michael@146 | 54 | |
michael@146 | 55 | @@ -144,6 +149,9 @@ |
michael@146 | 56 | |
michael@146 | 57 | static void msg_syslog_print(int level, const char *text) |
michael@146 | 58 | { |
michael@146 | 59 | +#ifdef USE_SOFTLIMITONLY |
michael@146 | 60 | + struct rlimit save, rlim; |
michael@146 | 61 | +#endif |
michael@146 | 62 | static int log_level[] = { |
michael@146 | 63 | LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_CRIT, |
michael@146 | 64 | }; |
michael@146 | 65 | @@ -154,6 +162,15 @@ |
michael@146 | 66 | if (level < 0 || level >= (int) (sizeof(log_level) / sizeof(log_level[0]))) |
michael@146 | 67 | msg_panic("msg_syslog_print: invalid severity level: %d", level); |
michael@146 | 68 | |
michael@146 | 69 | +#ifdef USE_SOFTLIMITONLY |
michael@146 | 70 | + if (getrlimit(RLIMIT_FSIZE, &save) < 0) { |
michael@146 | 71 | + save.rlim_cur = RLIM_INFINITY; |
michael@146 | 72 | + save.rlim_max = RLIM_INFINITY; |
michael@146 | 73 | + } |
michael@146 | 74 | + rlim.rlim_cur = save.rlim_max; |
michael@146 | 75 | + rlim.rlim_max = save.rlim_max; |
michael@146 | 76 | + (void)setrlimit(RLIMIT_FSIZE, &rlim); |
michael@146 | 77 | +#endif |
michael@146 | 78 | if (level == MSG_INFO) { |
michael@146 | 79 | syslog(syslog_facility | log_level[level], "%.*s", |
michael@146 | 80 | (int) MSG_SYSLOG_RECLEN, text); |
michael@146 | 81 | @@ -161,6 +178,9 @@ |
michael@146 | 82 | syslog(syslog_facility | log_level[level], "%s: %.*s", |
michael@146 | 83 | severity_name[level], (int) MSG_SYSLOG_RECLEN, text); |
michael@146 | 84 | } |
michael@146 | 85 | +#ifdef USE_SOFTLIMITONLY |
michael@146 | 86 | + (void)setrlimit(RLIMIT_FSIZE, &save); |
michael@146 | 87 | +#endif |
michael@146 | 88 | } |
michael@146 | 89 | |
michael@146 | 90 | /* msg_syslog_init - initialize */ |
michael@146 | 91 | Index: src/util/sys_defs.h |
michael@146 | 92 | --- src/util/sys_defs.h.orig 2008-01-15 01:51:44 +0100 |
michael@146 | 93 | +++ src/util/sys_defs.h 2008-01-24 12:32:41 +0100 |
michael@146 | 94 | @@ -24,7 +24,7 @@ |
michael@146 | 95 | * 4.4BSD and close derivatives. |
michael@146 | 96 | */ |
michael@146 | 97 | #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \ |
michael@146 | 98 | - || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \ |
michael@146 | 99 | + || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) || defined(FREEBSD8) \ |
michael@146 | 100 | || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \ |
michael@146 | 101 | || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \ |
michael@146 | 102 | || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \ |
michael@146 | 103 | Index: src/smtp/smtp_reuse.c |
michael@147 | 104 | --- src/smtp/smtp_reuse.c.orig 2008-12-04 01:06:42.000000000 +0100 |
michael@147 | 105 | +++ src/smtp/smtp_reuse.c 2009-04-06 20:38:18.974597344 +0200 |
michael@146 | 106 | @@ -216,7 +216,9 @@ |
michael@146 | 107 | /* |
michael@146 | 108 | * Avoid poor performance when TCP MSS > VSTREAM_BUFSIZE. |
michael@146 | 109 | */ |
michael@146 | 110 | +#if 0 |
michael@147 | 111 | vstream_tweak_sock(session->stream); |
michael@146 | 112 | +#endif |
michael@146 | 113 | |
michael@146 | 114 | /* |
michael@146 | 115 | * Update the list of used cached addresses. |