From 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 14 Jul 2018 21:03:06 +0100 Subject: gentoo resync : 14.07.2018 --- app-admin/sysklogd/Manifest | 14 ++ .../sysklogd-1.4.2-caen-owl-klogd-drop-root.diff | 162 +++++++++++++++++++++ .../sysklogd-1.4.2-caen-owl-syslogd-bind.diff | 103 +++++++++++++ .../sysklogd-1.4.2-caen-owl-syslogd-drop-root.diff | 118 +++++++++++++++ app-admin/sysklogd/files/sysklogd-1.5-build.patch | 20 +++ .../sysklogd/files/sysklogd-1.5-debian-cron.patch | 38 +++++ .../sysklogd/files/sysklogd-1.5-glibc-2.24.patch | 11 ++ .../files/sysklogd-1.5-syslog-func-collision.patch | 103 +++++++++++++ app-admin/sysklogd/files/sysklogd.confd | 6 + app-admin/sysklogd/files/sysklogd.logrotate | 8 + app-admin/sysklogd/files/sysklogd.rc7 | 74 ++++++++++ app-admin/sysklogd/metadata.xml | 11 ++ app-admin/sysklogd/sysklogd-1.5.1-r1.ebuild | 69 +++++++++ 13 files changed, 737 insertions(+) create mode 100644 app-admin/sysklogd/Manifest create mode 100644 app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-klogd-drop-root.diff create mode 100644 app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-syslogd-bind.diff create mode 100644 app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-syslogd-drop-root.diff create mode 100644 app-admin/sysklogd/files/sysklogd-1.5-build.patch create mode 100644 app-admin/sysklogd/files/sysklogd-1.5-debian-cron.patch create mode 100644 app-admin/sysklogd/files/sysklogd-1.5-glibc-2.24.patch create mode 100644 app-admin/sysklogd/files/sysklogd-1.5-syslog-func-collision.patch create mode 100644 app-admin/sysklogd/files/sysklogd.confd create mode 100644 app-admin/sysklogd/files/sysklogd.logrotate create mode 100644 app-admin/sysklogd/files/sysklogd.rc7 create mode 100644 app-admin/sysklogd/metadata.xml create mode 100644 app-admin/sysklogd/sysklogd-1.5.1-r1.ebuild (limited to 'app-admin/sysklogd') diff --git a/app-admin/sysklogd/Manifest b/app-admin/sysklogd/Manifest new file mode 100644 index 000000000000..b135cec01488 --- /dev/null +++ b/app-admin/sysklogd/Manifest @@ -0,0 +1,14 @@ +AUX sysklogd-1.4.2-caen-owl-klogd-drop-root.diff 4315 BLAKE2B 41b42e8f07abc905be77600e161065b063630e7e7ae92932b4d6165cab83f23e87fb521f7c0b36ce9ee42d99c5914a47605df277c9fce666dcb48ee93a3b918e SHA512 1a5cf4a5dec3ecaa8258110820b64d6a8e1e768e841a3f0ade8d7827b91e73c2d8a49a9d8b74566373133627af88dd46d14e83ae1940a0b2e6cd6fe8710a7e7a +AUX sysklogd-1.4.2-caen-owl-syslogd-bind.diff 3242 BLAKE2B 93a53fc525bab3ebac577e02d381bc69beab1cf69136aedaf06e6c8e4b6fbe78cb68f705d42d9dde2f315c93cf12594bd8d2c80d0f6773d604c465b5b99bed56 SHA512 995c240fc54681445f68f7681173e1e1860aaab309edc8ac3531881c63c8889f009a7fd622d37145e80fe187410b80c28554140d6a6660134ca87a1c8d13570d +AUX sysklogd-1.4.2-caen-owl-syslogd-drop-root.diff 3245 BLAKE2B 9c0459edcdfd6c453aa6b379e698c4343d9110c329d01fb5481beb9533dc0a33aa812a2fe6a039c3ffe8b2458aaa1ce581195c2702a0b4e23c7a196a2d97e840 SHA512 87865e069f9c78990660cf29a37ba1ded7cc078ea8f05af63fc6068c470d1881181387477dccb830d96af05f352959181619380d61afccf3a11d213372e68852 +AUX sysklogd-1.5-build.patch 626 BLAKE2B 03fe37ad2095f88cfa5cf3b79ece26acf4d70f9a0817482e5a509044baca0a8e2f8a122bb90f0a8ffedc42342183d26071347354cd4946398b011124d9c2ff15 SHA512 aa8ce937733bb24f6b4bc4a47e40df99697c554276a29a21201b76354b902875bbeb7387520f3b7f8e05a76b16d3c4431bf775c85480fd9e31b78d499b5605fa +AUX sysklogd-1.5-debian-cron.patch 913 BLAKE2B 20c0fc489b5ed90576f02f400817537ba6a59dd3521de2bacbc97964748792069bbeb1a656e4384ce8edfca320c9f212f4f04f2c4c49374f9cd5b0b59bb30c2f SHA512 5af0a61e5fb8dd78c30fa42d747b4de3a4f68b80b86a2f53447d2277c98d72972c242ffe5649c30a9f08f30e27974fd3bfe4a5537fa1c7b8658312b0550b28e0 +AUX sysklogd-1.5-glibc-2.24.patch 279 BLAKE2B 635ad71844161a13f5c95e670db49c486a856556f10ccd04ea7f4b9cb1252aa9788a2f4e17864d4e0155fd3ca148862a48ce0c4808e389d37f146087088e60be SHA512 35d92a0f1665d38201bdb2f4d4c0e5f17a6086f7a38e489ac4820cdff166419992253fa6c73e321c73e209e4b41a6e2363e19060ef48f18fef8c5ea65ac2664e +AUX sysklogd-1.5-syslog-func-collision.patch 2273 BLAKE2B 7aa2ccaf4bb1663c7c71f0d9f67c17f39b6c61b4706352bf779eb9a790e2fed8753afeaa4c2234739513500383593ee2f59a87485378fb554589e0e9a77f61ad SHA512 1fc3e215a45d95dd11ca2d1713f9a3f416e82b9d60127da62d904071f02ec1e934aa099a20d09a7c1eea37f9d93dbaa0e0ce8118af9b58b92d781cc26659e5fc +AUX sysklogd.confd 113 BLAKE2B 392d4c0ac09d5dd85d01e4d57cb541271e3c09ce90671d6bfcbecfde64184c94603929bee0fe3ae2d65af2b6283919b8a6517c1e551f870d4c0e25bf1ffad051 SHA512 4553d85e93fb07e7d4a6ed0b47a3ea2044a5605adaac05223724c32a60bb8ae96d99ca95965c3931640beef234e976c1141b83f603aa8c6e8aca1dec20ca807c +AUX sysklogd.logrotate 402 BLAKE2B 2aba98bcef0516602268132507248ea44097541ac5659427f24a286661c500e6ff92b387f184bba84d0f10669ff9c917d7c8ee613c7fdb3a472434485b5f8c78 SHA512 655b25bc92c6d73807b11b0d64f97d619c067efb9fc16ee9c2aba5ba349b13991a22c83e7adaafb95e17578b17992992cab16d18b7bdb2be7d4fc876df5824f7 +AUX sysklogd.rc7 1447 BLAKE2B 352be79eca7a99213557f29110a53eca85dfbc11e134eac48801b5d61ebca9e77beadbee10c7f86267fe3509e17352468f9f777d25a875d583292a409d5db071 SHA512 f3c8f00fbf65833735d57927fe25c6299103bbc0b8fa548103b4f2f06f0dc2aa2276f12326ff7477f4ba491a96ccd30fe01cc53e841b0ccee83c4dacabb5a94e +DIST sysklogd-1.5.1.tar.gz 90011 BLAKE2B c40bd8d5769f7d3d4141d602c74ac41e05a140743d18c4923d9368da7ba193ccb89a6837173994f0b7a9c290cc23f64513040434d7ab8df81b5d09b73b0263ad SHA512 a72196a1a172d25be1c4791ef6256fe71fa2ba8c1383d230e646e93f8a65c3a57c535189726325da4c792fdb2e9cb119bba43c878816a8e78e78189fd32b12b7 +DIST sysklogd_1.5-6.diff.gz 25677 BLAKE2B 3cb1f596490998b6002d4656a2321a500ce9941a37737c0b9d4702bbb87d7bc9ba21b68e06d175e3c1714a701adc6b3312e18a556ebc9ef395d8968762830cb5 SHA512 816961a835a43057569f62fd20d9f7b5e0bfcfcb173b68947457708504db3ce47e635956c8a9564f9bd577d8f3c49dfc725d321dfd3370b2de918363c30f838e +EBUILD sysklogd-1.5.1-r1.ebuild 1703 BLAKE2B 1b5f75d79a86e05f3b7f71523f794a1bcf4cce6b0242dd8564204edcb886c1c9e7a450f25e00e3899f159643dc9d65da38d8c40fbe25becda0522359485b4347 SHA512 f7355db8d66f1b73b09381aa43f9d7112646229bf2a68facc9cf2a5fdf290f95adbc7bd48203473f7d2a21ba608c23aba267d0a5875c5f6b464bff5d1b2752de +MISC metadata.xml 378 BLAKE2B b2ff06a70503694dcc5349aebb2d043cb74c10463e137c7bdd9ee6b5c1241e67fab49c201d08858b200a3007bea36e1d0ae1460e569b0b9e6f8281cf39c58c48 SHA512 9d7311cf197ebeec7e989d97d08a35360242ee0aa467e38e1715c6a425e1e279ddd75da8e2856c1238f357741d67bd67d07841425d7dcc3f8f964def8f02d15c diff --git a/app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-klogd-drop-root.diff b/app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-klogd-drop-root.diff new file mode 100644 index 000000000000..40b8817d4e28 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-klogd-drop-root.diff @@ -0,0 +1,162 @@ +http://cvsweb.openwall.com/cgi/cvsweb.cgi/~checkout~/Owl/packages/sysklogd/sysklogd-1.4.2-caen-owl-klogd-drop-root.diff?rev=1.2;content-type=text%2Fplain +diff -upk.orig sysklogd-1.4.2.orig/klogd.8 sysklogd-1.4.2/klogd.8 +--- sysklogd-1.4.2.orig/klogd.8 2005-03-11 16:12:09 +0000 ++++ sysklogd-1.4.2/klogd.8 2005-08-18 14:37:47 +0000 +@@ -18,6 +19,12 @@ klogd \- Kernel Log Daemon + .RB [ " \-f " + .I fname + ] ++.RB [ " \-u " ++.I username ++] ++.RB [ " \-j " ++.I chroot_dir ++] + .RB [ " \-iI " ] + .RB [ " \-n " ] + .RB [ " \-o " ] +@@ -53,6 +60,20 @@ stderr. + .BI "\-f " file + Log messages to the specified filename rather than to the syslog facility. + .TP ++.BI "\-u " username ++Tells klogd to become the specified user and drop root privileges before ++starting logging. ++.TP ++.BI "\-j " chroot_dir ++Tells klogd to ++.BR chroot (2) ++into this directory after initializing. ++This option is only valid if the \-u option is also used to run klogd ++without root privileges. ++Note that the use of this option will prevent \-i and \-I from working ++unless you set up the chroot directory in such a way that klogd can still ++read the kernel module symbols. ++.TP + .BI "\-i \-I" + Signal the currently executing klogd daemon. Both of these switches control + the loading/reloading of symbol information. The \-i switch signals the +diff -upk.orig sysklogd-1.4.2.orig/klogd.c sysklogd-1.4.2/klogd.c +--- sysklogd-1.4.2.orig/klogd.c 2005-08-18 12:29:52 +0000 ++++ sysklogd-1.4.2/klogd.c 2005-08-18 14:37:47 +0000 +@@ -261,6 +261,8 @@ + #include + #include + #include ++#include ++#include + #include "klogd.h" + #include "ksyms.h" + #ifndef TESTING +@@ -315,6 +317,9 @@ static enum LOGSRC {none, proc, kernel} + int debugging = 0; + int symbols_twice = 0; + ++char *server_user = NULL; ++char *chroot_dir = NULL; ++int log_flags = 0; + + /* Function prototypes. */ + extern int ksyslog(int type, char *buf, int len); +@@ -535,8 +540,9 @@ static enum LOGSRC GetKernelLogSrc(void) + * First do a stat to determine whether or not the proc based + * file system is available to get kernel messages from. + */ +- if ( use_syscall || +- ((stat(_PATH_KLOG, &sb) < 0) && (errno == ENOENT)) ) ++ if (!server_user && ++ (use_syscall || ++ ((stat(_PATH_KLOG, &sb) < 0) && (errno == ENOENT)))) + { + /* Initialize kernel logging. */ + ksyslog(1, NULL, 0); +@@ -983,6 +989,27 @@ static void LogProcLine(void) + } + + ++static int drop_root(void) ++{ ++ struct passwd *pw; ++ ++ if (!(pw = getpwnam(server_user))) return -1; ++ ++ if (!pw->pw_uid) return -1; ++ ++ if (chroot_dir) { ++ if (chdir(chroot_dir)) return -1; ++ if (chroot(".")) return -1; ++ } ++ ++ if (setgroups(0, NULL)) return -1; ++ if (setgid(pw->pw_gid)) return -1; ++ if (setuid(pw->pw_uid)) return -1; ++ ++ return 0; ++} ++ ++ + int main(argc, argv) + + int argc; +@@ -1000,7 +1027,7 @@ int main(argc, argv) + chdir ("/"); + #endif + /* Parse the command-line. */ +- while ((ch = getopt(argc, argv, "c:df:iIk:nopsvx2")) != EOF) ++ while ((ch = getopt(argc, argv, "c:df:u:j:iIk:nopsvx2")) != EOF) + switch((char)ch) + { + case '2': /* Print lines with symbols twice. */ +@@ -1022,6 +1049,10 @@ int main(argc, argv) + case 'I': + SignalDaemon(SIGUSR2); + return(0); ++ case 'j': /* chroot 'j'ail */ ++ chroot_dir = optarg; ++ log_flags |= LOG_NDELAY; ++ break; + case 'k': /* Kernel symbol file. */ + symfile = optarg; + break; +@@ -1037,6 +1068,9 @@ int main(argc, argv) + case 's': /* Use syscall interface. */ + use_syscall = 1; + break; ++ case 'u': /* Run as this user */ ++ server_user = optarg; ++ break; + case 'v': + printf("klogd %s.%s\n", VERSION, PATCHLEVEL); + exit (1); +@@ -1045,6 +1079,10 @@ int main(argc, argv) + break; + } + ++ if (chroot_dir && !server_user) { ++ fputs("'-j' is only valid with '-u'\n", stderr); ++ exit(1); ++ } + + /* Set console logging level. */ + if ( log_level != (char *) 0 ) +@@ -1158,7 +1196,7 @@ int main(argc, argv) + } + } + else +- openlog("kernel", 0, LOG_KERN); ++ openlog("kernel", log_flags, LOG_KERN); + + + /* Handle one-shot logging. */ +@@ -1191,6 +1229,11 @@ int main(argc, argv) + } + } + ++ if (server_user && drop_root()) { ++ syslog(LOG_ALERT, "klogd: failed to drop root"); ++ Terminate(); ++ } ++ + /* The main loop. */ + while (1) + { diff --git a/app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-syslogd-bind.diff b/app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-syslogd-bind.diff new file mode 100644 index 000000000000..ad311a512c0f --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-syslogd-bind.diff @@ -0,0 +1,103 @@ +http://cvsweb.openwall.com/cgi/cvsweb.cgi/~checkout~/Owl/packages/sysklogd/sysklogd-1.4.2-caen-owl-syslogd-bind.diff?rev=1.1;content-type=text%2Fplain +diff -upk.orig sysklogd-1.4.2.orig/sysklogd.8 sysklogd-1.4.2/sysklogd.8 +--- sysklogd-1.4.2.orig/sysklogd.8 2004-07-09 17:33:32 +0000 ++++ sysklogd-1.4.2/sysklogd.8 2005-08-18 14:40:25 +0000 +@@ -15,6 +15,9 @@ sysklogd \- Linux system logging utiliti + .I config file + ] + .RB [ " \-h " ] ++.RB [ " \-i " ++.I IP address ++] + .RB [ " \-l " + .I hostlist + ] +@@ -104,6 +107,13 @@ Specifying this switch on the command li + This can cause syslog loops that fill up hard disks quite fast and + thus needs to be used with caution. + .TP ++.BI "\-i " "IP address" ++If ++.B syslogd ++is configured to accept log input from a UDP port, specify an IP address ++to bind to, rather than the default of INADDR_ANY. The address must be in ++dotted quad notation, DNS host names are not allowed. ++.TP + .BI "\-l " "hostlist" + Specify a hostname that should be logged only with its simple hostname + and not the fqdn. Multiple hosts may be specified using the colon +diff -upk.orig sysklogd-1.4.2.orig/syslogd.c sysklogd-1.4.2/syslogd.c +--- sysklogd-1.4.2.orig/syslogd.c 2005-08-18 14:33:22 +0000 ++++ sysklogd-1.4.2/syslogd.c 2005-08-18 14:40:25 +0000 +@@ -774,6 +774,8 @@ char **LocalHosts = NULL; /* these hosts + int NoHops = 1; /* Can we bounce syslog messages through an + intermediate host. */ + ++char *bind_addr = NULL; /* bind UDP port to this interface only */ ++ + extern int errno; + + /* Function prototypes. */ +@@ -878,7 +880,7 @@ int main(argc, argv) + funix[i] = -1; + } + +- while ((ch = getopt(argc, argv, "a:dhf:l:m:np:rs:v")) != EOF) ++ while ((ch = getopt(argc, argv, "a:dhf:i:l:m:np:rs:v")) != EOF) + switch((char)ch) { + case 'a': + if (nfunix < MAXFUNIX) +@@ -895,9 +897,17 @@ int main(argc, argv) + case 'h': + NoHops = 0; + break; ++ case 'i': ++ if (bind_addr) { ++ fprintf(stderr, "Only one -i argument allowed, " ++ "the first one is taken.\n"); ++ break; ++ } ++ bind_addr = optarg; ++ break; + case 'l': + if (LocalHosts) { +- fprintf (stderr, "Only one -l argument allowed," \ ++ fprintf(stderr, "Only one -l argument allowed, " + "the first one is taken.\n"); + break; + } +@@ -1244,7 +1254,7 @@ int main(argc, argv) + int usage() + { + fprintf(stderr, "usage: syslogd [-drvh] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \ +- " [-s domainlist] [-f conffile]\n"); ++ " [-s domainlist] [-f conffile] [-i IP address]\n"); + exit(1); + } + +@@ -1286,15 +1296,22 @@ static int create_inet_socket() + int fd, on = 1; + struct sockaddr_in sin; + ++ memset(&sin, 0, sizeof(sin)); ++ sin.sin_family = AF_INET; ++ sin.sin_port = LogPort; ++ if (bind_addr) { ++ if (!inet_aton(bind_addr, &sin.sin_addr)) { ++ logerror("syslog: not a valid IP address to bind to."); ++ return -1; ++ } ++ } ++ + fd = socket(AF_INET, SOCK_DGRAM, 0); + if (fd < 0) { + logerror("syslog: Unknown protocol, suspending inet service."); + return fd; + } + +- memset(&sin, 0, sizeof(sin)); +- sin.sin_family = AF_INET; +- sin.sin_port = LogPort; + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, \ + (char *) &on, sizeof(on)) < 0 ) { + logerror("setsockopt(REUSEADDR), suspending inet"); diff --git a/app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-syslogd-drop-root.diff b/app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-syslogd-drop-root.diff new file mode 100644 index 000000000000..8c3f571f3ca2 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd-1.4.2-caen-owl-syslogd-drop-root.diff @@ -0,0 +1,118 @@ +http://cvsweb.openwall.com/cgi/cvsweb.cgi/~checkout~/Owl/packages/sysklogd/sysklogd-1.4.2-caen-owl-syslogd-drop-root.diff?rev=1.1;content-type=text%2Fplain +diff -upk.orig sysklogd-1.4.2.orig/sysklogd.8 sysklogd-1.4.2/sysklogd.8 +--- sysklogd-1.4.2.orig/sysklogd.8 2005-08-18 14:40:25 +0000 ++++ sysklogd-1.4.2/sysklogd.8 2005-08-18 14:41:26 +0000 +@@ -32,6 +32,9 @@ sysklogd \- Linux system logging utiliti + .RB [ " \-s " + .I domainlist + ] ++.RB [ " \-u" ++.IB username ++] + .RB [ " \-v " ] + .LP + .SH DESCRIPTION +@@ -161,6 +164,19 @@ is specified and the host logging resolv + no domain would be cut, you will have to specify two domains like: + .BR "\-s north.de:infodrom.north.de" . + .TP ++.BI "\-u " "username" ++This causes the ++.B syslogd ++daemon to become the named user before starting up logging. ++ ++Note that when this option is in use, ++.B syslogd ++will open all log files as root when the daemon is first started; ++however, after a ++.B SIGHUP ++the files will be reopened as the non-privileged user. You should ++take this into account when deciding the ownership of the log files. ++.TP + .B "\-v" + Print version and exit. + .LP +diff -upk.orig sysklogd-1.4.2.orig/syslogd.c sysklogd-1.4.2/syslogd.c +--- sysklogd-1.4.2.orig/syslogd.c 2005-08-18 14:40:25 +0000 ++++ sysklogd-1.4.2/syslogd.c 2005-08-18 14:41:26 +0000 +@@ -524,6 +524,10 @@ static char sccsid[] = "@(#)syslogd.c 5. + #include + #include + #include ++ ++#include ++#include ++ + #ifndef TESTING + #include "pidfile.h" + #endif +@@ -775,6 +779,7 @@ int NoHops = 1; /* Can we bounce syslog + intermediate host. */ + + char *bind_addr = NULL; /* bind UDP port to this interface only */ ++char *server_user = NULL; /* user name to run server as */ + + extern int errno; + +@@ -827,6 +832,21 @@ static int set_nonblock_flag(int desc) + return fcntl(desc, F_SETFL, flags | O_NONBLOCK); + } + ++static int drop_root(void) ++{ ++ struct passwd *pw; ++ ++ if (!(pw = getpwnam(server_user))) return -1; ++ ++ if (!pw->pw_uid) return -1; ++ ++ if (initgroups(server_user, pw->pw_gid)) return -1; ++ if (setgid(pw->pw_gid)) return -1; ++ if (setuid(pw->pw_uid)) return -1; ++ ++ return 0; ++} ++ + int main(argc, argv) + int argc; + char **argv; +@@ -880,7 +900,7 @@ int main(argc, argv) + funix[i] = -1; + } + +- while ((ch = getopt(argc, argv, "a:dhf:i:l:m:np:rs:v")) != EOF) ++ while ((ch = getopt(argc, argv, "a:dhf:i:l:m:np:rs:u:v")) != EOF) + switch((char)ch) { + case 'a': + if (nfunix < MAXFUNIX) +@@ -933,6 +953,9 @@ int main(argc, argv) + } + StripDomains = crunch_list(optarg); + break; ++ case 'u': ++ server_user = optarg; ++ break; + case 'v': + printf("syslogd %s.%s\n", VERSION, PATCHLEVEL); + exit (0); +@@ -1100,6 +1123,11 @@ int main(argc, argv) + kill (ppid, SIGTERM); + #endif + ++ if (server_user && drop_root()) { ++ dprintf("syslogd: failed to drop root\n"); ++ exit(1); ++ } ++ + /* Main loop begins here. */ + for (;;) { + int nfds; +@@ -1254,7 +1282,7 @@ int main(argc, argv) + int usage() + { + fprintf(stderr, "usage: syslogd [-drvh] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \ +- " [-s domainlist] [-f conffile] [-i IP address]\n"); ++ " [-s domainlist] [-f conffile] [-i IP address] [-u username]\n"); + exit(1); + } + diff --git a/app-admin/sysklogd/files/sysklogd-1.5-build.patch b/app-admin/sysklogd/files/sysklogd-1.5-build.patch new file mode 100644 index 000000000000..12f4822cd265 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd-1.5-build.patch @@ -0,0 +1,20 @@ +respect env CC/CFLAGS/CPPFLAGS/LDFLAGS + +--- Makefile ++++ Makefile +@@ -17,14 +17,12 @@ + # along with this program; if not, write to the Free Software + # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +-CC= gcc + #SKFLAGS= -g -DSYSV -Wall + #LDFLAGS= -g +-SKFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce ++SKFLAGS= $(CFLAGS) $(CPPFLAGS) -DSYSV -Wall -fno-strength-reduce + # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE + # $(shell getconf LFS_SKFLAGS) +-LDFLAGS= -s + + # Look where your install program is. + INSTALL = /usr/bin/install diff --git a/app-admin/sysklogd/files/sysklogd-1.5-debian-cron.patch b/app-admin/sysklogd/files/sysklogd-1.5-debian-cron.patch new file mode 100644 index 000000000000..7f6c2a79b0b2 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd-1.5-debian-cron.patch @@ -0,0 +1,38 @@ +--- debian/cron.daily ++++ debian/cron.daily +@@ -20,10 +20,6 @@ + # Written by Martin Schulze . + # $Id: cron.daily,v 1.14 2007-05-28 16:33:34 joey Exp $ + +-test -x /usr/sbin/syslogd-listfiles || exit 0 +-test -x /sbin/syslogd || exit 0 +-test -f /usr/share/sysklogd/dummy || exit 0 +- + set -e + + cd /var/log +@@ -41,4 +37,4 @@ + + # Restart syslogd + # +-/etc/init.d/sysklogd reload-or-restart > /dev/null ++/etc/init.d/sysklogd --quiet reload +--- debian/cron.weekly ++++ debian/cron.weekly +@@ -19,10 +19,6 @@ + # Written by Ian A. Murdock . + # $Id: cron.weekly,v 1.11 2007-05-28 16:33:34 joey Exp $ + +-test -x /usr/sbin/syslogd-listfiles || exit 0 +-test -x /sbin/syslogd || exit 0 +-test -f /usr/share/sysklogd/dummy || exit 0 +- + set -e + + cd /var/log +@@ -40,4 +36,4 @@ + + # Restart syslogd + # +-/etc/init.d/sysklogd reload-or-restart > /dev/null ++/etc/init.d/sysklogd --quiet reload diff --git a/app-admin/sysklogd/files/sysklogd-1.5-glibc-2.24.patch b/app-admin/sysklogd/files/sysklogd-1.5-glibc-2.24.patch new file mode 100644 index 000000000000..fcddb7574590 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd-1.5-glibc-2.24.patch @@ -0,0 +1,11 @@ +--- sysklogd-1.5.1/syslogd.c ++++ sysklogd-1.5.1/syslogd.c +@@ -2094,7 +2094,7 @@ + (void) signal(SIGCHLD, reapchild); /* reset signal handler -ASP */ + wait ((int *)0); + #else +- union wait status; ++ int status; + + while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0) + ; diff --git a/app-admin/sysklogd/files/sysklogd-1.5-syslog-func-collision.patch b/app-admin/sysklogd/files/sysklogd-1.5-syslog-func-collision.patch new file mode 100644 index 000000000000..76912a265565 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd-1.5-syslog-func-collision.patch @@ -0,0 +1,103 @@ +http://bugs.gentoo.org/342601 + +rename local "syslog" and "vsyslog" functions to avoid conflicts with glibc's + +patch by Dmitriy Matrosov + +--- sysklogd-1.5/klogd.c ++++ sysklogd-1.5/klogd.c +@@ -258,7 +262,6 @@ + #if !defined(__GLIBC__) + #include + #endif /* __GLIBC__ */ +-#include + #include + #include + #include +@@ -637,7 +640,7 @@ + } + argl += 3; + } +- syslog(priority, fmt, argl); ++ syslog_own(priority, fmt, argl); + va_end(ap); + #ifdef TESTING + putchar('\n'); +@@ -646,7 +649,7 @@ + } + + va_start(ap, fmt); +- vsyslog(priority, fmt, ap); ++ vsyslog_own(priority, fmt, ap); + va_end(ap); + #ifdef TESTING + printf ("\n"); +@@ -1205,7 +1208,7 @@ + } + + if (server_user && drop_root()) { +- syslog(LOG_ALERT, "klogd: failed to drop root"); ++ syslog_own(LOG_ALERT, "klogd: failed to drop root"); + Terminate(); + } + +--- sysklogd-1.5/klogd.h ++++ sysklogd-1.5/klogd.h +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + + /* Function prototypes. */ +@@ -38,3 +43,5 @@ + extern char * ExpandKadds(char *, char *); + extern void SetParanoiaLevel(int); + extern void Syslog(int priority, char *fmt, ...); ++extern void syslog_own(int, const char *, ...); ++extern void vsyslog_own(int, const char *, va_list); +--- sysklogd-1.5/ksym_mod.c ++++ sysklogd-1.5/ksym_mod.c +@@ -95,7 +98,6 @@ + #if !defined(__GLIBC__) + #include + #endif /* __GLIBC__ */ +-#include + #include + #include + +--- sysklogd-1.5/syslog.c ++++ sysklogd-1.5/syslog.c +@@ -75,6 +79,10 @@ + + #define _PATH_LOGNAME "/dev/log" + ++ ++void syslog_own(int, const char *, ...); ++void vsyslog_own(int, const char *, va_list); ++ + static int LogFile = -1; /* fd for log */ + static int connected; /* have done connect */ + static int LogStat = 0; /* status bits, set by openlog() */ +@@ -82,17 +90,17 @@ + static int LogFacility = LOG_USER; /* default facility code */ + + void +-syslog(int pri, const char *fmt, ...) ++syslog_own(int pri, const char *fmt, ...) + { + va_list ap; + + va_start(ap, fmt); +- vsyslog(pri, fmt, ap); ++ vsyslog_own(pri, fmt, ap); + va_end(ap); + } + + void +-vsyslog(pri, fmt, ap) ++vsyslog_own(pri, fmt, ap) + int pri; + const char *fmt; + va_list ap; diff --git a/app-admin/sysklogd/files/sysklogd.confd b/app-admin/sysklogd/files/sysklogd.confd new file mode 100644 index 000000000000..c9735739117d --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd.confd @@ -0,0 +1,6 @@ +# Config file for /etc/init.d/sysklogd + +SYSLOGD="-m 0" +# send warnings and above to the console +KLOGD="-c 3 -2" + diff --git a/app-admin/sysklogd/files/sysklogd.logrotate b/app-admin/sysklogd/files/sysklogd.logrotate new file mode 100644 index 000000000000..8148a2ab2948 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd.logrotate @@ -0,0 +1,8 @@ +/var/log/auth.log /var/log/daemon.log /var/log/debug /var/log/kern.log /var/log/lpr.log /var/log/mail.err /var/log/mail.info /var/log/mail.log /var/log/mail.warn /var/log/messages /var/log/news/news.crit /var/log/news/news.err /var/log/news/news.notice /var/log/syslog /var/log/user.log { + create 640 root root + sharedscripts + missingok + postrotate + /etc/init.d/sysklogd -q reload + endscript +} diff --git a/app-admin/sysklogd/files/sysklogd.rc7 b/app-admin/sysklogd/files/sysklogd.rc7 new file mode 100644 index 000000000000..787fe3d752d7 --- /dev/null +++ b/app-admin/sysklogd/files/sysklogd.rc7 @@ -0,0 +1,74 @@ +#!/sbin/openrc-run +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later + +extra_started_commands="reload" + +depend() { + need clock hostname + provide logger +} + +start_daemon() { + local retval=0 + local daemon="$1" + local options="$2" + + [ -z "${daemon}" ] && return 1 + + ebegin "sysklogd -> start: ${daemon}" + start-stop-daemon --start --exec /usr/sbin/"${daemon}" \ + --pidfile /var/run/"${daemon}".pid -- ${options} + retval=$? + eend ${retval} "Failed to start ${daemon}" + + return ${retval} +} + +stop_daemon() { + local retval=0 + local daemon="$1" + + [ -z "${daemon}" ] && return 1 + + ebegin "sysklogd -> stop: ${daemon}" + # syslogd can be stubborn some times (--retry 15)... + start-stop-daemon --stop --retry 15 --quiet --pidfile /var/run/"${daemon}".pid + retval=$? + eend ${retval} "Failed to stop ${daemon}" + + return ${retval} +} + +start() { + start_daemon "syslogd" "${SYSLOGD}" || return 1 + + # klogd do not always start proper if started too early + sleep 1 + + if ! start_daemon "klogd" "${KLOGD}" ; then + stop_daemon "syslogd" + return 1 + fi + + return 0 +} + +stop() { + stop_daemon "klogd" || return 1 + stop_daemon "syslogd" || return 1 + return 0 +} + +reload() { + local ret=0 + + ebegin "Reloading configuration" + + start-stop-daemon --signal HUP --pidfile /var/run/syslogd.pid + ret=$((${ret} + $?)) + start-stop-daemon --signal USR1 --pidfile /var/run/klogd.pid + ret=$((${ret} + $?)) + + eend ${ret} +} diff --git a/app-admin/sysklogd/metadata.xml b/app-admin/sysklogd/metadata.xml new file mode 100644 index 000000000000..094ccd37b3fd --- /dev/null +++ b/app-admin/sysklogd/metadata.xml @@ -0,0 +1,11 @@ + + + + + base-system@gentoo.org + Gentoo Base System + + + use app-admin/logrotate for rotating logs rather than custom cron scripts + + diff --git a/app-admin/sysklogd/sysklogd-1.5.1-r1.ebuild b/app-admin/sysklogd/sysklogd-1.5.1-r1.ebuild new file mode 100644 index 000000000000..ea099c26f115 --- /dev/null +++ b/app-admin/sysklogd/sysklogd-1.5.1-r1.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +inherit eutils flag-o-matic toolchain-funcs + +DEB_PV="1.5-6" +DESCRIPTION="Standard log daemons" +HOMEPAGE="http://www.infodrom.org/projects/sysklogd/" +SRC_URI="http://www.infodrom.org/projects/sysklogd/download/${P}.tar.gz + mirror://debian/pool/main/s/sysklogd/${PN}_${DEB_PV}.diff.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86" +IUSE="logrotate" +RESTRICT="test" + +DEPEND="" +RDEPEND="dev-lang/perl + sys-apps/debianutils" + +DOCS=( ANNOUNCE CHANGES NEWS README.1st README.linux ) + +PATCHES=( + "${WORKDIR}"/${PN}_${DEB_PV}.diff + + "${FILESDIR}"/${PN}-1.5-debian-cron.patch + "${FILESDIR}"/${PN}-1.5-build.patch + + # CAEN/OWL security patches + "${FILESDIR}"/${PN}-1.4.2-caen-owl-syslogd-bind.diff + "${FILESDIR}"/${PN}-1.4.2-caen-owl-syslogd-drop-root.diff + "${FILESDIR}"/${PN}-1.4.2-caen-owl-klogd-drop-root.diff + + "${FILESDIR}"/${PN}-1.5-syslog-func-collision.patch #342601 + "${FILESDIR}"/${PN}-1.5-glibc-2.24.patch #604232 +) + +src_prepare() { + epatch "${PATCHES[@]}" +} + +src_configure() { + append-lfs-flags + tc-export CC +} + +src_install() { + dosbin syslogd klogd debian/syslog-facility debian/syslogd-listfiles + doman *.[1-9] debian/syslogd-listfiles.8 + insinto /etc + doins debian/syslog.conf + if use logrotate ; then + insinto /etc/logrotate.d + newins "${FILESDIR}"/sysklogd.logrotate sysklogd + else + exeinto /etc/cron.daily + newexe debian/cron.daily syslog + exeinto /etc/cron.weekly + newexe debian/cron.weekly syslog + fi + + einstalldocs + + newinitd "${FILESDIR}"/sysklogd.rc7 sysklogd + newconfd "${FILESDIR}"/sysklogd.confd sysklogd +} -- cgit v1.2.3