summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /www-servers/thttpd/files
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'www-servers/thttpd/files')
-rw-r--r--www-servers/thttpd/files/thttpd-fix-world-readable-log.patch59
-rw-r--r--www-servers/thttpd/files/thttpd-renamed-htpasswd.patch108
-rw-r--r--www-servers/thttpd/files/thttpd.conf.sample38
-rw-r--r--www-servers/thttpd/files/thttpd.confd.135
-rw-r--r--www-servers/thttpd/files/thttpd.init.134
-rw-r--r--www-servers/thttpd/files/thttpd.logrotate12
-rw-r--r--www-servers/thttpd/files/thttpd.service12
7 files changed, 298 insertions, 0 deletions
diff --git a/www-servers/thttpd/files/thttpd-fix-world-readable-log.patch b/www-servers/thttpd/files/thttpd-fix-world-readable-log.patch
new file mode 100644
index 000000000000..5c011bac52b5
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd-fix-world-readable-log.patch
@@ -0,0 +1,59 @@
+From d2e186dbd58d274a0dea9b59357edc8498b5388d Mon Sep 17 00:00:00 2001
+From: "Anthony G. Basile" <blueness@gentoo.org>
+Date: Tue, 26 Feb 2013 14:28:26 -0500
+Subject: [PATCH] src/thttpd.c: Fix world readable log, CVE-2013-0348.
+
+Make sure that the logfile is created or reopened as read/write
+by thttpd user only.
+
+X-gentoo-Bug: 458896
+X-gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=458896
+Reported-by: Agostino Sarubbo <ago@gentoo.org>
+Signed-off-by: Anthony G. Basile <basile@opensource.dyc.edu>
+---
+ src/thttpd.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/thttpd.c b/src/thttpd.c
+index 019b8c0..f33a7a7 100644
+--- a/src/thttpd.c
++++ b/src/thttpd.c
+@@ -326,6 +326,7 @@ static void
+ re_open_logfile( void )
+ {
+ FILE* logfp;
++ int retchmod;
+
+ if ( no_log || hs == (httpd_server*) 0 )
+ return;
+@@ -335,7 +336,8 @@ re_open_logfile( void )
+ {
+ syslog( LOG_NOTICE, "re-opening logfile" );
+ logfp = fopen( logfile, "a" );
+- if ( logfp == (FILE*) 0 )
++ retchmod = chmod( logfile, S_IRUSR|S_IWUSR );
++ if ( logfp == (FILE*) 0 || retchmod != 0 )
+ {
+ syslog( LOG_CRIT, "re-opening %.80s - %m", logfile );
+ return;
+@@ -355,6 +357,7 @@ main( int argc, char** argv )
+ gid_t gid = 32767;
+ char cwd[MAXPATHLEN+1];
+ FILE* logfp;
++ int retchmod;
+ int num_ready;
+ int cnum;
+ connecttab* c;
+@@ -424,7 +427,8 @@ main( int argc, char** argv )
+ else
+ {
+ logfp = fopen( logfile, "a" );
+- if ( logfp == (FILE*) 0 )
++ retchmod = chmod( logfile, S_IRUSR|S_IWUSR );
++ if ( logfp == (FILE*) 0 || retchmod != 0 )
+ {
+ syslog( LOG_CRIT, "%.80s - %m", logfile );
+ perror( logfile );
+--
+1.7.12.4
+
diff --git a/www-servers/thttpd/files/thttpd-renamed-htpasswd.patch b/www-servers/thttpd/files/thttpd-renamed-htpasswd.patch
new file mode 100644
index 000000000000..31e68429dbd6
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd-renamed-htpasswd.patch
@@ -0,0 +1,108 @@
+diff --git a/configure.ac b/configure.ac
+index 2c2dfae..e028a0d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -42,12 +42,6 @@ if test "x${WEBDIR}" = "x" ; then
+ WEBDIR='/usr/local/www'
+ fi
+
+-AC_ARG_VAR(WEBGROUP, [The group that the web server will run as])
+-
+-if test "x${WEBGROUP}" = "x" ; then
+- WEBGROUP='thttpd'
+-fi
+-
+ AC_CONFIG_FILES([Makefile
+ docs/Makefile
+ extras/Makefile
+diff --git a/docs/Makefile.am b/docs/Makefile.am
+index 303c25f..2823290 100644
+--- a/docs/Makefile.am
++++ b/docs/Makefile.am
+@@ -1 +1 @@
+-dist_man_MANS = htpasswd.1 makeweb.1 redirect.8 ssi.8 syslogtocern.8 thttpd.8
++dist_man_MANS = th_htpasswd.1 makeweb.1 redirect.8 ssi.8 syslogtocern.8 thttpd.8
+diff --git a/docs/htpasswd.1 b/docs/htpasswd.1
+deleted file mode 100644
+index 1124b02..0000000
+--- a/docs/htpasswd.1
++++ /dev/null
+@@ -1,16 +0,0 @@
+-.TH htpasswd 1 "05 May 1998"
+-.SH NAME
+-htpasswd - manipulate HTTP-server password files
+-.SH SYNOPSIS
+-.B htpasswd
+-.RB [ -c ]
+-.I passwordfile
+-.I username
+-.SH DESCRIPTION
+-.PP
+-Sets a user's password in an httpd-style password file.
+-The -c flag creates a new file.
+-.SH AUTHOR
+-Rob McCool.
+-Modified 29aug97 by Jef Poskanzer to accept new password on stdin,
+-if stdin is a pipe or file. This is necessary for use from CGI.
+diff --git a/docs/th_htpasswd.1 b/docs/th_htpasswd.1
+new file mode 100644
+index 0000000..f524af9
+--- /dev/null
++++ b/docs/th_htpasswd.1
+@@ -0,0 +1,16 @@
++.TH th_htpasswd 1 "05 May 1998"
++.SH NAME
++th_htpasswd - manipulate HTTP-server password files
++.SH SYNOPSIS
++.B th_htpasswd
++.RB [ -c ]
++.I passwordfile
++.I username
++.SH DESCRIPTION
++.PP
++Sets a user's password in an httpd-style password file.
++The -c flag creates a new file.
++.SH AUTHOR
++Rob McCool.
++Modified 29aug97 by Jef Poskanzer to accept new password on stdin,
++if stdin is a pipe or file. This is necessary for use from CGI.
+diff --git a/docs/thttpd.8 b/docs/thttpd.8
+index a0fd334..78af884 100644
+--- a/docs/thttpd.8
++++ b/docs/thttpd.8
+@@ -270,7 +270,7 @@ called .htpasswd by default.
+ This file is formatted as the familiar colon-separated
+ username/encrypted-password pair, records delimited by newlines.
+ The protection does not carry over to subdirectories.
+-The utility program htpasswd(1) is included to help create and
++The utility program th_htpasswd(1) is included to help create and
+ modify .htpasswd files.
+ .PP
+ Relevant thttpd.h option: AUTH_FILE
+@@ -562,7 +562,7 @@ This is a little tricky to set up correctly, for instance if you are using
+ chroot() then the log file must be within the chroot tree, but it's
+ definitely doable.
+ .SH "SEE ALSO"
+-redirect(8), ssi(8), makeweb(1), htpasswd(1), syslogtocern(8), weblog_parse(1), http_get(1)
++redirect(8), ssi(8), makeweb(1), th_htpasswd(1), syslogtocern(8), weblog_parse(1), http_get(1)
+ .SH THANKS
+ .PP
+ Many thanks to contributors, reviewers, testers:
+diff --git a/extras/Makefile.am b/extras/Makefile.am
+index b1f3b4d..ffd19d7 100644
+--- a/extras/Makefile.am
++++ b/extras/Makefile.am
+@@ -1,11 +1,7 @@
+ AM_CPPFLAGS = -DWEBDIR='"$(WEBDIR)"'
+
+-sbin_PROGRAMS = makeweb htpasswd
++sbin_PROGRAMS = makeweb th_htpasswd
+ makeweb_SOURCES = makeweb.c
+-htpasswd_SOURCES = htpasswd.c
++th_htpasswd_SOURCES = th_htpasswd.c
+
+ dist_sbin_SCRIPTS = syslogtocern
+-
+-install-exec-hook:
+- chgrp $(WEBGROUP) $(DESTDIR)$(sbindir)/makeweb
+- chmod 2751 $(DESTDIR)$(sbindir)/makeweb
diff --git a/www-servers/thttpd/files/thttpd.conf.sample b/www-servers/thttpd/files/thttpd.conf.sample
new file mode 100644
index 000000000000..462bd0c198d0
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd.conf.sample
@@ -0,0 +1,38 @@
+## /etc/thttpd.conf
+##
+## do not leave empty lines in here!
+## format is: key=value
+##
+## run in debug-mode?
+#debug
+##
+## what interface to bind to?
+## (default is binding to any interface)
+#host=www.example.org
+port=80
+user=thttpd
+##
+## CGI:
+## ? match a single char
+## * matches any string excluding "/"
+## ** matches any string including "/"
+## separate multiple patterns with "|"
+#cgipat=**.sh|**.cgi
+##
+## chroot:
+chroot
+#nochroot
+##
+logfile=/var/log/thttpd.log
+pidfile=/var/run/thttpd.pid
+##
+charset=iso-8859-1
+##
+## control the caching: (in secs)
+#maxage 60
+##
+## virtual hosting:
+#vhost
+##
+## cache-control: send this "max-age" in all HTTP-responses:
+#max-age=0
diff --git a/www-servers/thttpd/files/thttpd.confd.1 b/www-servers/thttpd/files/thttpd.confd.1
new file mode 100644
index 000000000000..b5f630e7ecc2
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd.confd.1
@@ -0,0 +1,35 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+## Config file for /etc/init.d/thttpd
+
+## the startup-dir of thttpd is the docroot, so we specify it here
+## and the init-script does a "cd" prior to startup:
+THTTPD_DOCROOT="/var/www/localhost"
+
+## There are 2 ways to configure thttpd:
+## 1) specify all params on the cmd-line
+## 2) use a config-file (and start with "-C <conf-file>")
+
+## For additional thttpd instances, run:
+# ln -s /etc/init.d/thttpd /etc/init.d/thttpd.$NAME
+# cp /etc/conf.d/thttpd /etc/conf.d/thttpd.$NAME
+
+## Note: 1) and 2) can be mixed but
+## the init-script set PID (option -i) to
+## /var/run/thttpd.$NAME.run
+## and logfile (option -l) to
+## /var/log/thttpd.$NAME.log
+##
+## We choose 1) here -- if you have a more complicated setup read
+## thttpd(8) for details on 2).
+
+THTTPD_OPTS="-p 80 -u thttpd -r"
+
+## For a more complex setup (e.g. cgi-support) use an external configfile:
+## comment the THTTPD_OPTS line above und use the one below.
+#THTTPD_OPTS="-C /etc/thttpd/thttpd.conf"
+
+## If you know what you are doing you can add cgi-support with the line below;
+## but you _should_ use the extern-configfile version!
+#THTTPD_OPTS="$THTTPD_OPTS -c **.cgi|**.sh"
diff --git a/www-servers/thttpd/files/thttpd.init.1 b/www-servers/thttpd/files/thttpd.init.1
new file mode 100644
index 000000000000..415ead79d6a6
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd.init.1
@@ -0,0 +1,34 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v3 or later
+
+depend() {
+ need net
+ use dns logger netmount
+ after sshd
+}
+
+checkconfig() {
+ if [ ! -d "$THTTPD_DOCROOT" ]; then
+ eend 1 "THTTPD_DOCROOT not set correctly in /etc/conf.d/${SVCNAME}"
+ fi
+}
+
+start() {
+ ebegin "Starting ${SVCNAME}"
+
+ checkconfig || return 1
+
+ start-stop-daemon --quiet --start --exec /usr/sbin/thttpd \
+ --pidfile /var/run/${SVCNAME}.pid --chdir "$THTTPD_DOCROOT" -- \
+ -i /var/run/${SVCNAME}.pid \
+ -l /var/log/${SVCNAME}.log \
+ ${THTTPD_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --quiet --stop --pidfile /var/run/${SVCNAME}.pid
+ eend $?
+}
diff --git a/www-servers/thttpd/files/thttpd.logrotate b/www-servers/thttpd/files/thttpd.logrotate
new file mode 100644
index 000000000000..7e75c813524a
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd.logrotate
@@ -0,0 +1,12 @@
+/var/log/thttpd.log {
+ daily
+ rotate 5
+ compress
+ delaycompress
+ missingok
+ notifempty
+ sharedscripts
+ postrotate
+ kill -HUP `cat /var/run/thttpd.pid 2>/dev/null` 2>/dev/null || true
+ endscript
+}
diff --git a/www-servers/thttpd/files/thttpd.service b/www-servers/thttpd/files/thttpd.service
new file mode 100644
index 000000000000..4e56c0877d70
--- /dev/null
+++ b/www-servers/thttpd/files/thttpd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Fork of thttpd, a small, fast, multiplexing webserver.
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/thttpd.pid
+WorkingDirectory=/var/www/localhost
+ExecStart=/usr/sbin/thttpd -C /etc/thttpd/thttpd.conf
+
+[Install]
+WantedBy=multi-user.target