debian/0000775000000000000000000000000012304604773007176 5ustar debian/watch0000664000000000000000000000017512302651036010222 0ustar #git=git://git.fedorahosted.org/mod_nss.git version=3 http://directory.fedoraproject.org/wiki/Mod_nss .*/mod_nss-(.*).tar.gz debian/rules0000775000000000000000000000443312302651036010252 0ustar #!/usr/bin/make -f include /usr/share/quilt/quilt.make # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) UPSTREAM_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: *\(.*\)-.*$$/\1/ p' | sed -e 's/~.*//') MOD_MAJOR_VERSION := $(word 1, $(subst ., ,$(UPSTREAM_VERSION))) MOD_MINOR_VERSION := $(word 2, $(subst ., ,$(UPSTREAM_VERSION))) MOD_PATCH_VERSION := $(word 3, $(subst ., ,$(UPSTREAM_VERSION))) CFLAGS := -Wall -pipe ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 -fno-strict-aliasing endif CFLAGS += -g CONFIGURE_SWITCHES := --prefix=/usr \ --exec-prefix=/usr \ --sysconfdir=/usr \ --mandir=/usr/share/man \ --with-apxs=/usr/bin/apxs2 \ --enable-ecc configure: configure-stamp configure-stamp: $(QUILT_STAMPFN) ifneq "$(wildcard /usr/share/misc/config.sub)" "" cp -f /usr/share/misc/config.sub config.sub endif ifneq "$(wildcard /usr/share/misc/config.guess)" "" cp -f /usr/share/misc/config.guess config.guess endif autoreconf -i -f dh_testdir ./configure $(CONFIGURE_SWITCHES) touch $@ build: build-arch build-indep build-arch: build-stamp build-indep: build-stamp build-stamp: configure-stamp dh_testdir $(MAKE) touch $@ clean: clean-patched unpatch clean-patched: dh_testdir dh_testroot [ ! -f Makefile ] || $(MAKE) distclean rm -f build-stamp configure-stamp install-stamp config.log dh_clean install: build install-stamp install-stamp: dh_testdir dh_testroot dh_clean -k dh_installdirs # FIXME: brrrr mv $(CURDIR)/.libs/libmodnss.so $(CURDIR)/.libs/mod_nss.so touch install-stamp binary-indep: build install binary-arch: build install dh_testdir dh_testroot dh_installchangelogs -a dh_installdocs -a dh_install dh_apache2 dh_link -a dh_strip dh_compress -a dh_fixperms -a dh_installdeb -a dh_shlibdeps -a -L libapache2-mod-nss -l debian/libapache2-mod-nss/usr/lib/apache2/modules dh_gencontrol -a dh_md5sums -a dh_builddeb -a binary: binary-arch .PHONY: clean install build binary-indep binary-arch binary debian/source/0000775000000000000000000000000012302651036010466 5ustar debian/source/format0000664000000000000000000000001412302651036011674 0ustar 3.0 (quilt) debian/README.Debian0000664000000000000000000000120512302651036011225 0ustar libapache2-mod-nss for Debian ------------------------------------- You can enable this module using a2enmod: # a2enmod nss Once enabled, you need to run the 'gencert' wrapper script that will generate the NSS db's for you in /etc/libapache2-mod-nss: # /usr/share/libapache2-mod-nss/gencert /etc/libapache2-mod-nss # chown -R www-data: /etc/libapache2-mod-nss Then starting apache, the password is: httptest FIXME: should we aim for a standard location for all the machine-level certs generated/used by NSS? (if yes, for whom should it be readable writable?) -- Michele Baldessari , Tue, 12 May 2008 22:08:34 +0100 debian/changelog0000664000000000000000000000552312304604773011055 0ustar libapache2-mod-nss (1.0.8-4fakesync1) trusty-proposed; urgency=medium * Fake sync due to mismatching orig tarball. -- Artur Rona Sun, 02 Mar 2014 11:37:47 +0100 libapache2-mod-nss (1.0.8-4) unstable; urgency=medium * mod_nss-clientauth.patch: - Fix CVE-2011-4973: FakeBasicAuth authentication bypass. (Closes: #729626) * mod_nss-nssverifyclient.patch: - Fix CVE-2013-4566: incorrect handling of NSSVerifyClient in directory context. (Closes: #731627) * control: Bump policy to 3.9.5, no changes. -- Timo Aaltonen Mon, 03 Feb 2014 11:23:58 +0200 libapache2-mod-nss (1.0.8-3) unstable; urgency=low * watch: Add a comment about the upstream git tree. * mod_nss-overlapping_memcpy.patch: Patch from Fedora to use memmove instead of memcpy. (LP: #1093974) * mod_nss-httpd24.patch: Port to Apache 2.4. (Closes: #707064) * control, rules, libapache2-mod-nss.apache2: Port to apache2-dev. * control: Bump policy to 3.9.4, no changes. -- Timo Aaltonen Tue, 09 Jul 2013 16:25:25 +0300 libapache2-mod-nss (1.0.8-2) unstable; urgency=low * Add patches from Fedora: - mod_nss-conf.patch: Change some default config values (modified for Debian) - mod_nss-gencert.patch: Don't create a default password. - mod_nss-negotiate.patch: Add configuration options for new NSS negotiation API. - mod_nss-reverseproxy.patch: Use remote hostname set by mod_proxy to compare to CN in peer cert. - mod_nss-pcachesignal.patch: Ignore SIGHUP in nss_pcache. - mod_nss-wouldblock.patch: Fix an NSPR layer bug. - mod_nss-reseterror.patch: Reset NSPR error before calling PR_Read(). - mod_nss-lockpcache.patch: Lock around the pipe to nss_pcache for retrieving the token PIN. * Add flex to build-depends (FTBFS). * control: Add a VCS header to point to the git repository. * copyright: Use DEP5 format. * control: Bump standards version to 3.9.3, no changes. * watch: Fix the url. -- Timo Aaltonen Thu, 28 Jun 2012 11:11:06 +0300 libapache2-mod-nss (1.0.8-1) unstable; urgency=low * New upstream * Patch for softokn3 is not needed anymore * Add doc/mod_nss.html * Enable Elliptic Curve Cryptography * Fix build * Add ${misc:Depends} * Spelling fixes * Bumped policy to 3.8.3 * Switch to dpkg-source 3.0 (quilt) format * Bumped policy to 3.8.4 * Removed README.source * Added pkg-config, libtool & automake to B-D * Changed my email address * Fix compilation issues (QUILT_STAMPFN) -- Michele Baldessari Sun, 17 Oct 2010 14:12:42 +0200 libapache2-mod-nss (1.0.7-1) unstable; urgency=low * Initial release (Closes: #659092) * Added patch from RH 444348 -- Michele Baldessari Mon, 12 May 2008 22:05:09 +0200 debian/nss.load0000664000000000000000000000007212302651036010631 0ustar LoadModule nss_module /usr/lib/apache2/modules/mod_nss.so debian/patches/0000775000000000000000000000000012302654663010626 5ustar debian/patches/mod_nss-overlapping_memcpy.patch0000664000000000000000000000147012302651036017200 0ustar Bug 669118 memcpy of overlapping memory is no longer allowed by glibc. This is mod_ssl bug https://issues.apache.org/bugzilla/show_bug.cgi?id=45444 --- mod_nss-1.0.8.orig/nss_engine_io.c 2011-01-12 12:31:27.339425702 -0500 +++ mod_nss-1.0.8/nss_engine_io.c 2011-01-12 12:31:35.507405595 -0500 @@ -123,13 +123,13 @@ if (buffer->length > inl) { /* we have have enough to fill the caller's buffer */ - memcpy(in, buffer->value, inl); + memmove(in, buffer->value, inl); buffer->value += inl; buffer->length -= inl; } else { /* swallow remainder of the buffer */ - memcpy(in, buffer->value, buffer->length); + memmove(in, buffer->value, buffer->length); inl = buffer->length; buffer->value = NULL; buffer->length = 0; debian/patches/fix_build0000664000000000000000000000122112302651036012501 0ustar Fix build with Debian's libapr1-dev pkg Index: libapache2-mod-nss-1.0.8/configure.in =================================================================== --- libapache2-mod-nss-1.0.8.orig/configure.in 2010-05-24 00:57:20.000000000 +0200 +++ libapache2-mod-nss-1.0.8/configure.in 2010-05-24 00:57:30.000000000 +0200 @@ -66,7 +66,7 @@ if test -n "$APR_CONFIG"; then AC_MSG_RESULT([using $APR_CONFIG. Use --with-apr-config to specify another.]) - apr_inc=`$APR_CONFIG --includes` + apr_inc=`$APR_CONFIG --cppflags --cflags --includes` else AC_MSG_ERROR([neither apr-config nor apr-1-config were not found. use --with-apr-config to specify it.]) fi debian/patches/mod_nss-httpd24.patch0000664000000000000000000001254012302651036014571 0ustar diff -ru mod_nss/mod_nss.c mod_nss-1.0.8/mod_nss.c --- mod_nss/mod_nss.c 2012-06-12 12:23:29.961000000 -0700 +++ mod_nss-1.0.8/mod_nss.c 2012-06-12 12:00:35.957002099 -0700 @@ -349,7 +349,7 @@ ap_log_error(APLOG_MARK, APLOG_INFO, 0, c->base_server, "Connection to child %ld established " "(server %s, client %s)", c->id, sc->vhost_id, - c->remote_ip ? c->remote_ip : "unknown"); + c->client_ip ? c->client_ip : "unknown"); mctx = sslconn->is_proxy ? sc->proxy : sc->server; diff -ru mod_nss/mod_nss.h mod_nss-1.0.8/mod_nss.h --- mod_nss/mod_nss.h 2012-06-12 12:23:29.962000000 -0700 +++ mod_nss-1.0.8/mod_nss.h 2012-06-12 12:00:35.955002240 -0700 @@ -27,7 +27,6 @@ #include "http_protocol.h" #include "util_script.h" #include "util_filter.h" -#include "mpm.h" #include "apr.h" #include "apr_strings.h" #define APR_WANT_STRFUNC @@ -490,7 +489,7 @@ SECStatus nss_Init_Tokens(server_rec *s); /* Logging */ -void nss_log_nss_error(const char *file, int line, int level, server_rec *s); +void nss_log_nss_error(const char *file, int line, int module_index, int level, server_rec *s); void nss_die(void); /* NSS callback */ diff -ru mod_nss/nss_engine_init.c mod_nss-1.0.8/nss_engine_init.c --- mod_nss/nss_engine_init.c 2012-06-12 12:23:29.962000000 -0700 +++ mod_nss-1.0.8/nss_engine_init.c 2012-06-12 12:00:35.955002240 -0700 @@ -15,7 +15,7 @@ #include "mod_nss.h" #include "apr_thread_proc.h" -#include "ap_mpm.h" +#include "mpm_common.h" #include "secmod.h" #include "sslerr.h" #include "pk11func.h" diff -ru mod_nss/nss_engine_io.c mod_nss-1.0.8/nss_engine_io.c --- mod_nss/nss_engine_io.c 2012-06-12 12:23:29.963000000 -0700 +++ mod_nss-1.0.8/nss_engine_io.c 2012-06-12 12:00:35.956002167 -0700 @@ -621,13 +621,13 @@ PR_Close(ssl); /* log the fact that we've closed the connection */ - if (c->base_server->loglevel >= APLOG_INFO) { + if (c->base_server->log.level >= APLOG_INFO) { ap_log_error(APLOG_MARK, APLOG_INFO, 0, c->base_server, "Connection to child %ld closed " "(server %s, client %s)", c->id, nss_util_vhostid(c->pool, c->base_server), - c->remote_ip ? c->remote_ip : "unknown"); + c->client_ip ? c->client_ip : "unknown"); } /* deallocate the SSL connection */ @@ -1165,7 +1165,7 @@ filter_ctx = (nss_filter_ctx_t *)(fd->secret); c = filter_ctx->c; - return PR_StringToNetAddr(c->remote_ip, addr); + return PR_StringToNetAddr(c->client_ip, addr); } /* diff -ru mod_nss/nss_engine_kernel.c mod_nss-1.0.8/nss_engine_kernel.c --- mod_nss/nss_engine_kernel.c 2012-06-12 12:23:29.963000000 -0700 +++ mod_nss-1.0.8/nss_engine_kernel.c 2012-06-12 12:00:35.954002314 -0700 @@ -73,7 +73,7 @@ /* * Log information about incoming HTTPS requests */ - if (r->server->loglevel >= APLOG_INFO && ap_is_initial_req(r)) { + if (r->server->log.level >= APLOG_INFO && ap_is_initial_req(r)) { ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, "%s HTTPS request received for child %ld (server %s)", (r->connection->keepalives <= 0 ? @@ -530,7 +530,7 @@ ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, "Access to %s denied for %s " "(requirement expression not fulfilled)", - r->filename, r->connection->remote_ip); + r->filename, r->connection->client_ip); ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, "Failed expression: %s", req->cpExpr); diff -ru mod_nss/nss_engine_log.c mod_nss-1.0.8/nss_engine_log.c --- mod_nss/nss_engine_log.c 2012-06-12 12:23:29.964000000 -0700 +++ mod_nss-1.0.8/nss_engine_log.c 2012-06-12 12:00:35.955002240 -0700 @@ -321,7 +321,7 @@ exit(1); } -void nss_log_nss_error(const char *file, int line, int level, server_rec *s) +void nss_log_nss_error(const char *file, int line, int module_index, int level, server_rec *s) { const char *err; PRInt32 error; @@ -340,7 +340,7 @@ err = "Unknown"; } - ap_log_error(file, line, level, 0, s, + ap_log_error(file, line, module_index, level, 0, s, "SSL Library Error: %d %s", error, err); } diff -ru mod_nss/nss_engine_vars.c mod_nss-1.0.8/nss_engine_vars.c --- mod_nss/nss_engine_vars.c 2012-06-12 12:23:29.965000000 -0700 +++ mod_nss-1.0.8/nss_engine_vars.c 2012-06-12 12:00:35.948002812 -0700 @@ -178,7 +178,7 @@ && sslconn && sslconn->ssl) result = nss_var_lookup_ssl(p, c, var+4); else if (strcEQ(var, "REMOTE_ADDR")) - result = c->remote_ip; + result = c->client_ip; else if (strcEQ(var, "HTTPS")) { if (sslconn && sslconn->ssl) result = "on"; @@ -194,7 +194,7 @@ if (strlen(var) > 12 && strcEQn(var, "SSL_VERSION_", 12)) result = nss_var_lookup_nss_version(p, var+12); else if (strcEQ(var, "SERVER_SOFTWARE")) - result = (char *)ap_get_server_version(); + result = (char *)ap_get_server_banner(); else if (strcEQ(var, "API_VERSION")) { result = apr_psprintf(p, "%d", MODULE_MAGIC_NUMBER); resdup = FALSE; debian/patches/mod_nss-clientauth.patch0000664000000000000000000000345612302651036015446 0ustar The first fix is to retrieve the full certificate subject instead of just the CN for FakeBasicAuth and prefix it with / to be compatible with OpenSSL. The second always attempts to retrieve the client certificate in nss_hook_ReadReq(). https://bugzilla.redhat.com/show_bug.cgi?id=702437 --- mod_nss-1.0.8.orig/nss_engine_io.c 2011-05-10 15:45:49.000000000 -0400 +++ mod_nss-1.0.8.orig/nss_engine_io.c 2011-05-11 15:21:30.000000000 -0400 @@ -1364,13 +1364,9 @@ nss_AuthCertificate(void *arg, PRFileDes status = SSL_AuthCertificate(arg, socket, checksig, isServer); - if (status == SECSuccess) { - conn_rec *c = filter_ctx->c; - SSLConnRec *sslconn = myConnConfig(c); - - sslconn->client_cert = SSL_PeerCertificate(socket); - sslconn->client_dn = NULL; - } + /* The certificate is copied to sslconn->client_cert in + * nss_hook_ReadReq() + */ return status; } --- mod_nss-1.0.8.orig/nss_engine_kernel.c 2007-05-31 17:36:03.000000000 -0400 +++ mod_nss-1.0.8.orig/nss_engine_kernel.c 2011-05-11 15:30:38.000000000 -0400 @@ -84,6 +84,11 @@ int nss_hook_ReadReq(request_rec *r) nss_util_vhostid(r->pool, r->server)); } + if (sslconn->client_cert != NULL) + CERT_DestroyCertificate(sslconn->client_cert); + sslconn->client_cert = SSL_PeerCertificate(ssl); + sslconn->client_dn = NULL; + return DECLINED; } @@ -626,8 +631,8 @@ int nss_hook_UserCheck(request_rec *r) } if (!sslconn->client_dn) { - char * cp = CERT_GetCommonName(&sslconn->client_cert->subject); - sslconn->client_dn = apr_pstrdup(r->connection->pool, cp); + char * cp = CERT_NameToAscii(&sslconn->client_cert->subject); + sslconn->client_dn = apr_pstrcat(r->connection->pool, "/", cp, NULL); PORT_Free(cp); } debian/patches/series0000664000000000000000000000051012302651036012026 0ustar fix_build speling_fixes mod_nss-conf.patch mod_nss-gencert.patch mod_nss-wouldblock.patch mod_nss-negotiate.patch mod_nss-reverseproxy.patch mod_nss-pcachesignal.patch mod_nss-reseterror.patch mod_nss-lockpcache.patch mod_nss-overlapping_memcpy.patch mod_nss-httpd24.patch mod_nss-clientauth.patch mod_nss-nssverifyclient.patch debian/patches/mod_nss-nssverifyclient.patch0000664000000000000000000000142012302651036016522 0ustar diff -rupN mod_nss-1.0.8.patched/nss_engine_kernel.c mod_nss-1.0.8.989724/nss_engine_kernel.c --- mod_nss-1.0.8.patched/nss_engine_kernel.c 2007-05-31 14:36:03.000000000 -0700 +++ mod_nss-1.0.8.989724/nss_engine_kernel.c 2013-10-25 13:32:47.000000000 -0700 @@ -275,7 +275,7 @@ int nss_hook_Access(request_rec *r) if (verify == SSL_CVERIFY_REQUIRE) { SSL_OptionSet(ssl, SSL_REQUEST_CERTIFICATE, PR_TRUE); - SSL_OptionSet(ssl, SSL_REQUIRE_CERTIFICATE, SSL_REQUIRE_NO_ERROR); + SSL_OptionSet(ssl, SSL_REQUIRE_CERTIFICATE, SSL_REQUIRE_ALWAYS); } else if (verify == SSL_CVERIFY_OPTIONAL) { SSL_OptionSet(ssl, SSL_REQUEST_CERTIFICATE, PR_TRUE); SSL_OptionSet(ssl, SSL_REQUIRE_CERTIFICATE, SSL_REQUIRE_NEVER); debian/patches/speling_fixes0000664000000000000000000000167312302651036013406 0ustar Fix spelling typos Index: libapache2-mod-nss-1.0.8/nss_engine_log.c =================================================================== --- libapache2-mod-nss-1.0.8.orig/nss_engine_log.c 2010-05-24 00:58:02.000000000 +0200 +++ libapache2-mod-nss-1.0.8/nss_engine_log.c 2010-05-24 00:58:11.000000000 +0200 @@ -254,7 +254,7 @@ { 57, "SSL received an alert record with an unknown alert description" }, { 58, "SSL peer has closed the connection" }, { 59, "SSL peer was not expecting a handshake message it received" }, - { 60, "SSL peer was unable to succesfully decompress an SSL record it received" }, + { 60, "SSL peer was unable to successfully decompress an SSL record it received" }, { 61, "SSL peer was unable to negotiate an acceptable set of security parameters" }, { 62, "SSL peer rejected a handshake message for unacceptable content" }, { 63, "SSL peer does not support certificates of the type it received" }, debian/patches/mod_nss-lockpcache.patch0000664000000000000000000002012312302651036015370 0ustar diff -u --recursive mod_nss-1.0.8/mod_nss.c mod_nss-1.0.8.lock/mod_nss.c --- mod_nss-1.0.8/mod_nss.c 2011-03-02 16:19:52.000000000 -0500 +++ mod_nss-1.0.8.lock/mod_nss.c 2011-03-02 16:17:48.000000000 -0500 @@ -152,6 +152,8 @@ AP_INIT_RAW_ARGS("NSSLogLevel", ap_set_deprecated, NULL, OR_ALL, "SSLLogLevel directive is no longer supported - use LogLevel."), #endif + AP_INIT_TAKE1("User", set_user, NULL, RSRC_CONF, + "Apache user. Comes from httpd.conf."), AP_END_CMD }; diff -u --recursive mod_nss-1.0.8/mod_nss.h mod_nss-1.0.8.lock/mod_nss.h --- mod_nss-1.0.8/mod_nss.h 2011-03-02 16:19:52.000000000 -0500 +++ mod_nss-1.0.8.lock/mod_nss.h 2011-03-02 16:17:48.000000000 -0500 @@ -41,6 +41,9 @@ #include "apr_shm.h" #include "apr_global_mutex.h" #include "apr_optional.h" +#include +#include +#include #define MOD_NSS_VERSION AP_SERVER_BASEREVISION @@ -244,6 +247,9 @@ struct { void *pV1, *pV2, *pV3, *pV4, *pV5, *pV6, *pV7, *pV8, *pV9, *pV10; } rCtx; + + int semid; + const char *user; } SSLModConfigRec; typedef struct SSLSrvConfigRec SSLSrvConfigRec; @@ -412,6 +418,7 @@ const char *nss_cmd_NSSProxyCipherSuite(cmd_parms *, void *, const char *); const char *nss_cmd_NSSProxyNickname(cmd_parms *cmd, void *dcfg, const char *arg); const char *nss_cmd_NSSProxyCheckPeerCN(cmd_parms *cmd, void *dcfg, int flag); +const char *set_user(cmd_parms *cmd, void *dummy, const char *arg); /* module initialization */ int nss_init_Module(apr_pool_t *, apr_pool_t *, apr_pool_t *, server_rec *); diff -u --recursive mod_nss-1.0.8/nss_engine_config.c mod_nss-1.0.8.lock/nss_engine_config.c --- mod_nss-1.0.8/nss_engine_config.c 2011-03-02 16:19:52.000000000 -0500 +++ mod_nss-1.0.8.lock/nss_engine_config.c 2011-03-02 16:17:48.000000000 -0500 @@ -830,3 +830,12 @@ return NULL; } + +const char *set_user(cmd_parms *cmd, void *dummy, const char *arg) +{ + SSLModConfigRec *mc = myModConfig(cmd->server); + + mc->user = arg; + + return NULL; +} diff -u --recursive mod_nss-1.0.8/nss_engine_init.c mod_nss-1.0.8.lock/nss_engine_init.c --- mod_nss-1.0.8/nss_engine_init.c 2011-03-02 16:19:49.000000000 -0500 +++ mod_nss-1.0.8.lock/nss_engine_init.c 2011-03-02 16:17:48.000000000 -0500 @@ -312,6 +312,7 @@ int sslenabled = FALSE; int fipsenabled = FALSE; int threaded = 0; + struct semid_ds status; mc->nInitCount++; @@ -412,10 +413,26 @@ ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, "Init: %snitializing NSS library", mc->nInitCount == 1 ? "I" : "Re-i"); + /* The first pass through this function will create the semaphore that + * will be used to lock the pipe. The user is still root at that point + * so for any later calls the semaphore ops will fail with permission + * errors. So switch the user to the Apache user. + */ + if (mc->semid) { + uid_t user_id; + + user_id = ap_uname2id(mc->user); + semctl(mc->semid, 0, IPC_STAT, &status); + status.sem_perm.uid = user_id; + semctl(mc->semid,0,IPC_SET,&status); + } + /* Do we need to fire up our password helper? */ if (mc->nInitCount == 1) { const char * child_argv[5]; apr_status_t rv; + struct sembuf sb; + char sembuf[32]; if (mc->pphrase_dialog_helper == NULL) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, @@ -423,11 +440,31 @@ nss_die(); } + mc->semid = semget(IPC_PRIVATE, 1, IPC_CREAT | IPC_EXCL | 0600); + if (mc->semid == -1) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "Unable to obtain semaphore."); + nss_die(); + } + + /* Initialize the semaphore */ + sb.sem_num = 0; + sb.sem_op = 1; + sb.sem_flg = 0; + if ((semop(mc->semid, &sb, 1)) == -1) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "Unable to initialize semaphore."); + nss_die(); + } + + PR_snprintf(sembuf, 32, "%d", mc->semid); + child_argv[0] = mc->pphrase_dialog_helper; - child_argv[1] = fipsenabled ? "on" : "off"; - child_argv[2] = mc->pCertificateDatabase; - child_argv[3] = mc->pDBPrefix; - child_argv[4] = NULL; + child_argv[1] = sembuf; + child_argv[2] = fipsenabled ? "on" : "off"; + child_argv[3] = mc->pCertificateDatabase; + child_argv[4] = mc->pDBPrefix; + child_argv[5] = NULL; rv = apr_procattr_create(&mc->procattr, mc->pPool); diff -u --recursive mod_nss-1.0.8/nss_engine_pphrase.c mod_nss-1.0.8.lock/nss_engine_pphrase.c --- mod_nss-1.0.8/nss_engine_pphrase.c 2008-07-02 10:54:37.000000000 -0400 +++ mod_nss-1.0.8.lock/nss_engine_pphrase.c 2011-03-02 16:17:48.000000000 -0500 @@ -279,6 +279,16 @@ char buf[1024]; apr_status_t rv; apr_size_t nBytes = 1024; + struct sembuf sb; + + /* lock the pipe */ + sb.sem_num = 0; + sb.sem_op = -1; + sb.sem_flg = SEM_UNDO; + if (semop(parg->mc->semid, &sb, 1) == -1) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, + "Unable to reserve semaphore resource"); + } snprintf(buf, 1024, "RETR\t%s", token_name); rv = apr_file_write_full(parg->mc->proc.in, buf, strlen(buf), NULL); @@ -293,6 +303,13 @@ */ memset(buf, 0, sizeof(buf)); rv = apr_file_read(parg->mc->proc.out, buf, &nBytes); + sb.sem_op = 1; + if (semop(parg->mc->semid, &sb, 1) == -1) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, + "Unable to free semaphore resource"); + /* perror("semop free resource id"); */ + } + if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "Unable to read from pin store for slot: %s APR err: %d", PK11_GetTokenName(slot), rv); diff -u --recursive mod_nss-1.0.8/nss_pcache.c mod_nss-1.0.8.lock/nss_pcache.c --- mod_nss-1.0.8/nss_pcache.c 2011-03-02 16:19:55.000000000 -0500 +++ mod_nss-1.0.8.lock/nss_pcache.c 2011-03-02 16:19:10.000000000 -0500 @@ -21,6 +21,9 @@ #include #include #include +#include +#include +#include #include "nss_pcache.h" static char * getstr(const char * cmd, int el); @@ -70,6 +73,13 @@ unsigned char *crypt; }; +union semun { + int val; + struct semid_ds *buf; + unsigned short *array; + struct seminfo *__buf; +}; + /* * Node - for maintaining link list of tokens with cached PINs */ @@ -304,15 +314,19 @@ char * tokenName; char * tokenpw; int fipsmode = 0; + int semid = 0; + union semun semarg; - if (argc < 3 || argc > 4) { - fprintf(stderr, "Usage: nss_pcache \n"); + if (argc < 4 || argc > 5) { + fprintf(stderr, "Usage: nss_pcache \n"); exit(1); } signal(SIGHUP, SIG_IGN); - if (!strcasecmp(argv[1], "on")) + semid = strtol(argv[1], NULL, 10); + + if (!strcasecmp(argv[2], "on")) fipsmode = 1; /* Initialize NSPR */ @@ -322,7 +336,7 @@ PK11_ConfigurePKCS11(NULL,NULL,NULL, INTERNAL_TOKEN_NAME, NULL, NULL,NULL,NULL,8,1); /* Initialize NSS and open the certificate database read-only. */ - rv = NSS_Initialize(argv[2], argc == 4 ? argv[3] : NULL, argc == 4 ? argv[3] : NULL, "secmod.db", NSS_INIT_READONLY); + rv = NSS_Initialize(argv[3], argc == 4 ? argv[4] : NULL, argc == 5 ? argv[4] : NULL, "secmod.db", NSS_INIT_READONLY); if (rv != SECSuccess) { fprintf(stderr, "Unable to initialize NSS database: %d\n", rv); @@ -437,6 +451,11 @@ } freeList(pinList); PR_Close(in); + /* Remove the semaphore used for locking here. This is because this + * program only goes away when Apache shuts down so we don't have to + * worry about reloads. + */ + semctl(semid, 0, IPC_RMID, semarg); return 0; } Only in mod_nss-1.0.8.lock/: nss_pcache.c.orig Only in mod_nss-1.0.8.lock/: nss_pcache.c.rej debian/patches/mod_nss-reverseproxy.patch0000664000000000000000000001770712302651036016067 0ustar mod_proxy now sets the requested remote host name. Use this to compare to the CN value of the peer certificate and reject the request if they do not match (and we are have NSSProxyCheckPeerCN set to on). diff -u --recursive mod_nss-1.0.8.orig/docs/mod_nss.html mod_nss-1.0.8/docs/mod_nss.html --- mod_nss-1.0.8.orig/docs/mod_nss.html 2006-09-05 10:58:56.000000000 -0400 +++ mod_nss-1.0.8/docs/mod_nss.html 2010-05-13 11:25:42.000000000 -0400 @@ -1028,7 +1028,21 @@
Example

-NSSProxyNickname beta
+NSSProxyNickname beta
+
+
NSSProxyCheckPeerCN
+
+Compare the CN value of the peer certificate with the hostname being +requested. If this is set to on, the default, then the request will +fail if they do not match. If this is set to off then this comparison +is not done. Note that this test is your only protection against a +man-in-the-middle attack so leaving this as on is strongly recommended.
+
+Example
+
+NSSProcyCheckPeerCN +on
+

Environment Variables

Quite a few environment variables (for CGI and SSI) may be set depending on the NSSOptions configuration. It can be expensive to set @@ -1435,42 +1449,9 @@

Frequently Asked Questions

Q. Does mod_nss support mod_proxy?

-A. In order to use the mod_nss proxy support you will need to build -your own mod_proxy by applying a patch found in bug 36468. -The patch is needed so we can compare the hostname contained in the -remote certificate with the hostname you meant to visit. This prevents -man-in-the-middle attacks.
-
-You also have to change the SSL functions that mod_proxy looks to use. -You'll need to apply this patch:
-
-1038,1039c1038,1039
-< APR_DECLARE_OPTIONAL_FN(int, ssl_proxy_enable, (conn_rec *));
-< APR_DECLARE_OPTIONAL_FN(int, ssl_engine_disable, (conn_rec *));
----
-> APR_DECLARE_OPTIONAL_FN(int, nss_proxy_enable, (conn_rec *));
-> APR_DECLARE_OPTIONAL_FN(int, nss_engine_disable, (conn_rec *));
-1041,1042c1041,1042
-< static APR_OPTIONAL_FN_TYPE(ssl_proxy_enable) *proxy_ssl_enable = -NULL;
-< static APR_OPTIONAL_FN_TYPE(ssl_engine_disable) *proxy_ssl_disable -= NULL;
----
-> static APR_OPTIONAL_FN_TYPE(nss_proxy_enable) *proxy_ssl_enable = -NULL;
-> static APR_OPTIONAL_FN_TYPE(nss_engine_disable) *proxy_ssl_disable -= NULL;
-1069,1070c1069,1070
-<     proxy_ssl_enable = -APR_RETRIEVE_OPTIONAL_FN(ssl_proxy_enable);
-<     proxy_ssl_disable = -APR_RETRIEVE_OPTIONAL_FN(ssl_engine_disable);
----
->     proxy_ssl_enable = -APR_RETRIEVE_OPTIONAL_FN(nss_proxy_enable);
->     proxy_ssl_disable = -APR_RETRIEVE_OPTIONAL_FN(nss_engine_disable);
-

+A. Yes but you need to make sure that mod_ssl is not loaded. mod_proxy +provides a single interface for SSL providers and mod_nss defers to +mod_ssl +if it is loaded. diff -u --recursive mod_nss-1.0.8.orig/mod_nss.c mod_nss-1.0.8/mod_nss.c --- mod_nss-1.0.8.orig/mod_nss.c 2010-05-13 11:24:49.000000000 -0400 +++ mod_nss-1.0.8/mod_nss.c 2010-05-13 11:25:42.000000000 -0400 @@ -142,6 +142,8 @@ SSL_CMD_SRV(ProxyNickname, TAKE1, "SSL Proxy: client certificate Nickname to be for proxy connections " "(`nickname')") + SSL_CMD_SRV(ProxyCheckPeerCN, FLAG, + "SSL Proxy: check the peers certificate CN") #ifdef IGNORE /* Deprecated directives. */ @@ -238,23 +240,30 @@ SECStatus NSSBadCertHandler(void *arg, PRFileDesc * socket) { conn_rec *c = (conn_rec *)arg; + SSLSrvConfigRec *sc = mySrvConfig(c->base_server); PRErrorCode err = PR_GetError(); SECStatus rv = SECFailure; CERTCertificate *peerCert = SSL_PeerCertificate(socket); + const char *hostname_note; switch (err) { case SSL_ERROR_BAD_CERT_DOMAIN: - if (c->remote_host != NULL) { - rv = CERT_VerifyCertName(peerCert, c->remote_host); - if (rv != SECSuccess) { - char *remote = CERT_GetCommonName(&peerCert->subject); + if (sc->proxy_ssl_check_peer_cn == TRUE) { + if ((hostname_note = apr_table_get(c->notes, "proxy-request-hostname")) != NULL) { + apr_table_unset(c->notes, "proxy-request-hostname"); + rv = CERT_VerifyCertName(peerCert, hostname_note); + if (rv != SECSuccess) { + char *remote = CERT_GetCommonName(&peerCert->subject); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, + "SSL Proxy: Possible man-in-the-middle attack. The remove server is %s, we expected %s", remote, hostname_note); + PORT_Free(remote); + } + } else { ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, - "SSL Proxy: Possible man-in-the-middle attack. The remove server is %s, we expected %s", remote, c->remote_host); - PORT_Free(remote); + "SSL Proxy: I don't have the name of the host we're supposed to connect to so I can't verify that we are connecting to who we think we should be. Giving up."); } } else { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, - "SSL Proxy: I don't have the name of the host we're supposed to connect to so I can't verify that we are connecting to who we think we should be. Giving up. Hint: See Apache bug 36468."); + rv = SECSuccess; } break; default: diff -u --recursive mod_nss-1.0.8.orig/mod_nss.h mod_nss-1.0.8/mod_nss.h --- mod_nss-1.0.8.orig/mod_nss.h 2010-05-13 11:24:49.000000000 -0400 +++ mod_nss-1.0.8/mod_nss.h 2010-05-13 11:25:42.000000000 -0400 @@ -306,6 +306,7 @@ int vhost_id_len; modnss_ctx_t *server; modnss_ctx_t *proxy; + BOOL proxy_ssl_check_peer_cn; }; /* @@ -410,6 +411,7 @@ const char *nss_cmd_NSSProxyProtocol(cmd_parms *, void *, const char *); const char *nss_cmd_NSSProxyCipherSuite(cmd_parms *, void *, const char *); const char *nss_cmd_NSSProxyNickname(cmd_parms *cmd, void *dcfg, const char *arg); +const char *nss_cmd_NSSProxyCheckPeerCN(cmd_parms *cmd, void *dcfg, int flag); /* module initialization */ int nss_init_Module(apr_pool_t *, apr_pool_t *, apr_pool_t *, server_rec *); diff -u --recursive mod_nss-1.0.8.orig/nss_engine_config.c mod_nss-1.0.8/nss_engine_config.c --- mod_nss-1.0.8.orig/nss_engine_config.c 2010-05-13 11:24:49.000000000 -0400 +++ mod_nss-1.0.8/nss_engine_config.c 2010-05-13 11:25:42.000000000 -0400 @@ -140,6 +140,7 @@ sc->vhost_id_len = 0; /* set during module init */ sc->proxy = NULL; sc->server = NULL; + sc->proxy_ssl_check_peer_cn = TRUE; modnss_ctx_init_proxy(sc, p); @@ -214,6 +215,7 @@ cfgMergeBool(fips); cfgMergeBool(enabled); cfgMergeBool(proxy_enabled); + cfgMergeBool(proxy_ssl_check_peer_cn); modnss_ctx_cfg_merge_proxy(base->proxy, add->proxy, mrg->proxy); @@ -544,6 +546,15 @@ return NULL; } +const char *nss_cmd_NSSProxyCheckPeerCN(cmd_parms *cmd, void *dcfg, int flag) +{ + SSLSrvConfigRec *sc = mySrvConfig(cmd->server); + + sc->proxy_ssl_check_peer_cn = flag ? TRUE : FALSE; + + return NULL; +} + const char *nss_cmd_NSSEnforceValidCerts(cmd_parms *cmd, void *dcfg, int flag) debian/patches/mod_nss-negotiate.patch0000664000000000000000000001542712302651036015266 0ustar Index: libapache2-mod-nss/mod_nss.c =================================================================== --- libapache2-mod-nss.orig/mod_nss.c 2011-10-06 15:44:26.230899717 +0300 +++ libapache2-mod-nss/mod_nss.c 2011-10-06 16:40:25.630986828 +0300 @@ -97,6 +97,14 @@ SSL_CMD_SRV(Nickname, TAKE1, "SSL RSA Server Certificate nickname " "(`Server-Cert'") +#ifdef SSL_ENABLE_RENEGOTIATION + SSL_CMD_SRV(Renegotiation, FLAG, + "Enable SSL Renegotiation (default off) " + "(`on', `off')") + SSL_CMD_SRV(RequireSafeNegotiation, FLAG, + "If Rengotiation is allowed, require safe negotiation (default off) " + "(`on', `off')") +#endif #ifdef NSS_ENABLE_ECC SSL_CMD_SRV(ECCNickname, TAKE1, "SSL ECC Server Certificate nickname " Index: libapache2-mod-nss/mod_nss.h =================================================================== --- libapache2-mod-nss.orig/mod_nss.h 2011-10-06 15:44:26.230899717 +0300 +++ libapache2-mod-nss/mod_nss.h 2011-10-06 16:40:25.630986828 +0300 @@ -269,6 +269,10 @@ int tls; int tlsrollback; int enforce; +#ifdef SSL_ENABLE_RENEGOTIATION + int enablerenegotiation; + int requiresafenegotiation; +#endif const char *nickname; #ifdef NSS_ENABLE_ECC const char *eccnickname; @@ -383,6 +387,10 @@ const char *nss_cmd_NSSVerifyClient(cmd_parms *cmd, void *dcfg, const char *arg); const char *nss_cmd_NSSProtocol(cmd_parms *cmd, void *dcfg, const char *arg); const char *nss_cmd_NSSNickname(cmd_parms *cmd, void *dcfg, const char *arg); +#ifdef SSL_ENABLE_RENEGOTIATION +const char *nss_cmd_NSSRenegotiation(cmd_parms *cmd, void *dcfg, int flag); +const char *nss_cmd_NSSRequireSafeNegotiation(cmd_parms *cmd, void *dcfg, int flag); +#endif #ifdef NSS_ENABLE_ECC const char *nss_cmd_NSSECCNickname(cmd_parms *cmd, void *dcfg, const char *arg); #endif Index: libapache2-mod-nss/nss_engine_config.c =================================================================== --- libapache2-mod-nss.orig/nss_engine_config.c 2011-10-06 15:44:26.230899717 +0300 +++ libapache2-mod-nss/nss_engine_config.c 2011-10-06 16:40:25.630986828 +0300 @@ -78,6 +78,10 @@ mctx->tls = PR_FALSE; mctx->tlsrollback = PR_FALSE; +#ifdef SSL_ENABLE_RENEGOTIATION + mctx->enablerenegotiation = PR_FALSE; + mctx->requiresafenegotiation = PR_FALSE; +#endif mctx->enforce = PR_TRUE; mctx->nickname = NULL; #ifdef NSS_ENABLE_ECC @@ -174,6 +178,10 @@ cfgMerge(eccnickname, NULL); #endif cfgMerge(enforce, PR_TRUE); +#ifdef SSL_ENABLE_RENEGOTIATION + cfgMerge(enablerenegotiation, PR_FALSE); + cfgMerge(requiresafenegotiation, PR_FALSE); +#endif } static void modnss_ctx_cfg_merge_proxy(modnss_ctx_t *base, @@ -461,6 +469,26 @@ return NULL; } +#ifdef SSL_ENABLE_RENEGOTIATION +const char *nss_cmd_NSSRenegotiation(cmd_parms *cmd, void *dcfg, int flag) +{ + SSLSrvConfigRec *sc = mySrvConfig(cmd->server); + + sc->server->enablerenegotiation = flag ? PR_TRUE : PR_FALSE; + + return NULL; +} + +const char *nss_cmd_NSSRequireSafeNegotiation(cmd_parms *cmd, void *dcfg, int flag) +{ + SSLSrvConfigRec *sc = mySrvConfig(cmd->server); + + sc->server->requiresafenegotiation = flag ? PR_TRUE : PR_FALSE; + + return NULL; +} +#endif + #ifdef NSS_ENABLE_ECC const char *nss_cmd_NSSECCNickname(cmd_parms *cmd, void *dcfg, Index: libapache2-mod-nss/nss_engine_init.c =================================================================== --- libapache2-mod-nss.orig/nss_engine_init.c 2011-10-06 15:44:26.230899717 +0300 +++ libapache2-mod-nss/nss_engine_init.c 2011-10-06 16:40:25.630986828 +0300 @@ -548,6 +548,24 @@ nss_die(); } } +#ifdef SSL_ENABLE_RENEGOTIATION + if (SSL_OptionSet(mctx->model, SSL_ENABLE_RENEGOTIATION, + mctx->enablerenegotiation ? + SSL_RENEGOTIATE_REQUIRES_XTN : SSL_RENEGOTIATE_NEVER + ) != SECSuccess) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "Unable to set SSL renegotiation"); + nss_log_nss_error(APLOG_MARK, APLOG_ERR, s); + nss_die(); + } + if (SSL_OptionSet(mctx->model, SSL_REQUIRE_SAFE_NEGOTIATION, + mctx->requiresafenegotiation) != SECSuccess) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "Unable to set SSL safe negotiation"); + nss_log_nss_error(APLOG_MARK, APLOG_ERR, s); + nss_die(); + } +#endif } static void nss_init_ctx_protocol(server_rec *s, Index: libapache2-mod-nss/nss.conf.in =================================================================== --- libapache2-mod-nss.orig/nss.conf.in 2011-10-06 16:40:25.606986828 +0300 +++ libapache2-mod-nss/nss.conf.in 2011-10-06 16:40:25.630986828 +0300 @@ -66,6 +66,17 @@ #NSSRandomSeed startup file:/dev/random 512 #NSSRandomSeed startup file:/dev/urandom 512 +# +# TLS Negotiation configuration under RFC 5746 +# +# Only renegotiate if the peer's hello bears the TLS renegotiation_info +# extension. Default off. +NSSRenegotiation off + +# Peer must send Signaling Cipher Suite Value (SCSV) or +# Renegotiation Info (RI) extension in ALL handshakes. Default: off +NSSRequireSafeNegotiation off + ## ## SSL Virtual Host Context ## Index: libapache2-mod-nss/nss_engine_log.c =================================================================== --- libapache2-mod-nss.orig/nss_engine_log.c 2011-10-06 16:40:25.594986827 +0300 +++ libapache2-mod-nss/nss_engine_log.c 2011-10-06 16:40:25.630986828 +0300 @@ -27,7 +27,7 @@ #define LIBSEC_ERROR_BASE (-8192) #define LIBSEC_MAX_ERROR (LIBSEC_ERROR_BASE + 155) #define LIBSSL_ERROR_BASE (-12288) -#define LIBSSL_MAX_ERROR (LIBSSL_ERROR_BASE + 102) +#define LIBSSL_MAX_ERROR (LIBSSL_ERROR_BASE + 114) typedef struct l_error_t { int errorNumber; @@ -296,7 +296,19 @@ { 99, "Server requires ciphers more secure than those supported by client" }, { 100, "Peer reports it experienced an internal error" }, { 101, "Peer user canceled handshake" }, - { 102, "Peer does not permit renegotiation of SSL security parameters" } + { 102, "Peer does not permit renegotiation of SSL security parameters" }, + { 103, "Server cache not configured" }, + { 104, "Unsupported extension" }, + { 105, "Certificate unobtainable" }, + { 106, "Unrecognized name" }, + { 107, "Bad certificate status" }, + { 108, "Bad certificate hash value" }, + { 109, "Unexpected new session ticket" }, + { 110, "Malformed new session ticket" }, + { 111, "Decompression failure" }, + { 112, "Renegotiation not allowed" }, + { 113, "Safe negotiation required but not provided by client" }, + { 114, "Unexpected uncompressed record" }, }; void nss_die(void) debian/patches/mod_nss-conf.patch0000664000000000000000000000430312302651036014223 0ustar --- mod_nss-1.0.6/nss.conf.in.orig 2006-10-20 11:08:42.000000000 -0400 +++ mod_nss-1.0.6/nss.conf.in 2006-10-23 15:27:22.000000000 -0400 @@ -8,14 +8,16 @@ # consult the online docs. You have been warned. # +LoadModule nss_module modules/libmodnss.so + # # When we also provide SSL we have to listen to the # standard HTTP port (see above) and to the HTTPS port # # Note: Configurations that use IPv6 but not IPv4-mapped addresses need two -# Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443" +# Listen directives: "Listen [::]:8443" and "Listen 0.0.0.0:443" # -Listen 443 +Listen 8443 ## ## SSL Global Context @@ -40,7 +42,7 @@ # Pass Phrase Helper: # This helper program stores the token password pins between # restarts of Apache. -NSSPassPhraseHelper @apache_bin@/nss_pcache +NSSPassPhraseHelper /usr/sbin/nss_pcache # Configure the SSL Session Cache. # NSSSessionCacheSize is the number of entries in the cache. @@ -68,17 +70,17 @@ ## SSL Virtual Host Context ## - + # General setup for the virtual host #DocumentRoot "@apache_prefix@/htdocs" -#ServerName www.example.com:443 +#ServerName www.example.com:8443 #ServerAdmin you@example.com # mod_nss can log to separate log files, you can choose to do that if you'd like # LogLevel is not inherited from httpd.conf. -#ErrorLog @apache_prefix@/logs/error_log -#TransferLog @apache_prefix@/logs/access_log +ErrorLog @apache_prefix@/logs/error_log +TransferLog @apache_prefix@/logs/access_log LogLevel warn # SSL Engine Switch: #@@ -113,7 +115,7 @@ # # The NSS security database directory that holds the certificates and # # keys. The database consists of 3 files: cert8.db, key3.db and secmod.db. # # Provide the directory that these files exist. #-NSSCertificateDatabase @apache_conf@ #+NSSCertificateDatabase /etc/httpd/alias # # # Database Prefix: # # In order to be able to store multiple NSS databases in one directory #@@ -189,7 +191,7 @@ # # NSSOptions +StdEnvVars # #- #+ # NSSOptions +StdEnvVars # debian/patches/mod_nss-pcachesignal.patch0000664000000000000000000000110512302651036015714 0ustar diff -u --recursive mod_nss-1.0.8.orig/nss_pcache.c mod_nss-1.0.8/nss_pcache.c --- mod_nss-1.0.8.orig/nss_pcache.c 2008-07-02 10:54:06.000000000 -0400 +++ mod_nss-1.0.8/nss_pcache.c 2010-05-14 13:32:57.000000000 -0400 @@ -20,6 +20,7 @@ #include #include #include +#include #include "nss_pcache.h" static char * getstr(const char * cmd, int el); @@ -309,6 +310,8 @@ exit(1); } + signal(SIGHUP, SIG_IGN); + if (!strcasecmp(argv[1], "on")) fipsmode = 1; Only in mod_nss-1.0.8: nss_pcache.c.rej debian/patches/mod_nss-wouldblock.patch0000664000000000000000000000075212302651036015447 0ustar --- mod_nss-1.0.3.orig/nss_engine_io.c 2006-04-07 16:17:12.000000000 -0400 +++ mod_nss-1.0.3/nss_engine_io.c 2009-02-17 22:51:44.000000000 -0500 @@ -259,7 +259,8 @@ */ if (APR_STATUS_IS_EAGAIN(inctx->rc) || APR_STATUS_IS_EINTR(inctx->rc) || (inctx->rc == APR_SUCCESS && APR_BRIGADE_EMPTY(inctx->bb))) { - return 0; + PR_SetError(PR_WOULD_BLOCK_ERROR, 0); + return -1; } if (inctx->rc != APR_SUCCESS) { debian/patches/mod_nss-reseterror.patch0000664000000000000000000000051012302651036015466 0ustar --- mod_nss-1.0.8.orig/nss_engine_io.c 2010-09-23 18:12:56.000000000 -0400 +++ mod_nss-1.0.8/nss_engine_io.c 2010-09-23 18:13:07.000000000 -0400 @@ -348,6 +348,7 @@ break; } + PR_SetError(0, 0); rc = PR_Read(inctx->filter_ctx->pssl, buf + bytes, wanted - bytes); if (rc > 0) { debian/patches/mod_nss-gencert.patch0000664000000000000000000000131112302651036014721 0ustar --- mod_nss-1.0/gencert.in 2006-06-20 22:43:33.000000000 -0400 +++ mod_nss-1.0/gencert.in.orig 2006-06-20 22:57:08.000000000 -0400 @@ -82,12 +82,11 @@ DEST=$1 -echo "httptest" > $DEST/pw.txt +echo -e "\n" > $DEST/pw.txt echo "" echo "#####################################################################" -echo "Generating new server certificate and key database. The password" -echo "is httptest" +echo "Generating new server certificate and key database." echo "#####################################################################" $CERTUTIL -N -d $DEST -f $DEST/pw.txt @@ -183,8 +182,4 @@ rm $DEST/pw.txt rm $DEST/noise -echo "" -echo "The database password is httptest" -echo "" - exit 0 debian/compat0000664000000000000000000000000212302651036010364 0ustar 5 debian/control0000664000000000000000000000221712304604773010603 0ustar Source: libapache2-mod-nss Section: web Priority: extra Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian 389ds Team Uploaders: Timo Aaltonen Build-Depends: debhelper (>= 5), dh-apache2, apache2-dev (>= 2.4), libnss3-dev, libapr1-dev, quilt, autoconf (>= 2.65), autotools-dev, automake, libtool, pkg-config, flex, Standards-Version: 3.9.5 Homepage: http://directory.fedoraproject.org Vcs-Git: git://git.debian.org/git/pkg-fedora-ds/libapache2-mod-nss.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-fedora-ds/libapache2-mod-nss.git Package: libapache2-mod-nss Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libnss3-tools, Description: NSS-based SSL module for Apache2 This Apache module provides strong cryptography for the Apache 2.0 webserver via the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols by the help of the SSL/TLS implementation library NSS . This module is based heavily on the mod_ssl package. In fact, it's more a conversion than anything else. debian/copyright0000664000000000000000000000126012302651036011120 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ UPstream-name: mod_nss Source: http://directory.fedoraproject.org/sources/ Files: * Copyright: 2001-2004 The Apache Software Foundation License: Apache-2.0 Files: nss_expr_parse.[ch] Copyright: 1984-2003 Free Software Foundation, Inc. License: GPL-2+ Files: debian/* Copyright: © 2008 Michele Baldessari License: GPL-2+ or Apache-2.0 License: GPL-2+ On Debian machines the full text of the GNU General Public License in the file /usr/share/common-licenses/GPL-2 License:Apache-2.0 On Debian machines the full text of the Apache 2.0 in the file /usr/share/common-licenses/Apache-2.0. debian/nss.conf0000664000000000000000000002037512302651036010647 0ustar # # This is the Apache server configuration file providing SSL support using. # the mod_nss plugin. It contains the configuration directives to instruct # the server how to serve pages over an https connection. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # # When we also provide SSL we have to listen to the # standard HTTP port (see above) and to the HTTPS port # # Note: Configurations that use IPv6 but not IPv4-mapped addresses need two # Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443" # #Listen 443 ## ## SSL Global Context ## ## All SSL configuration in this context applies both to ## the main server and all SSL-enabled virtual hosts. ## # # Some MIME-types for downloading Certificates and CRLs # AddType application/x-x509-ca-cert .crt AddType application/x-pkcs7-crl .crl # Pass Phrase Dialog: # Configure the pass phrase gathering process. # The filtering dialog program (`builtin' is a internal # terminal dialog) has to provide the pass phrase on stdout. NSSPassPhraseDialog builtin # Pass Phrase Helper: # This helper program stores the token password pins between # restarts of Apache. NSSPassPhraseHelper /usr/sbin/nss_pcache # Configure the SSL Session Cache. # NSSSessionCacheSize is the number of entries in the cache. # NSSSessionCacheTimeout is the SSL2 session timeout (in seconds). # NSSSession3CacheTimeout is the SSL3/TLS session timeout (in seconds). NSSSessionCacheSize 10000 NSSSessionCacheTimeout 100 NSSSession3CacheTimeout 86400 # # Pseudo Random Number Generator (PRNG): # Configure one or more sources to seed the PRNG of the SSL library. # The seed data should be of good random quality. # WARNING! On some platforms /dev/random blocks if not enough entropy # is available. Those platforms usually also provide a non-blocking # device, /dev/urandom, which may be used instead. # # This does not support seeding the RNG with each connection. NSSRandomSeed startup builtin #NSSRandomSeed startup file:/dev/random 512 #NSSRandomSeed startup file:/dev/urandom 512 ## ## SSL Virtual Host Context ## # # General setup for the virtual host #DocumentRoot "/htdocs" #ServerName www.example.com:443 #ServerAdmin you@example.com # mod_nss can log to separate log files, you can choose to do that if you'd like # LogLevel is not inherited from httpd.conf. #ErrorLog /logs/error_log #TransferLog /logs/access_log #LogLevel warn # SSL Engine Switch: # Enable/Disable SSL for this virtual host. #NSSEngine on # SSL Cipher Suite: # List the ciphers that the client is permitted to negotiate. # See the mod_nss documentation for a complete list. # SSL 3 ciphers. SSL 2 is disabled by default. #NSSCipherSuite +rsa_rc4_128_md5,+rsa_rc4_128_sha,+rsa_3des_sha,-rsa_des_sha,-rsa_rc4_40_md5,-rsa_rc2_40_md5,-rsa_null_md5,-rsa_null_sha,+fips_3des_sha,-fips_des_sha,-fortezza,-fortezza_rc4_128_sha,-fortezza_null,-rsa_des_56_sha,-rsa_rc4_56_sha,+rsa_aes_128_sha,+rsa_aes_256_sha # SSL 3 ciphers + ECC ciphers. SSL 2 is disabled by default. # # Comment out the NSSCipherSuite line above and use the one below if you have # ECC enabled NSS and mod_nss and want to use Elliptical Curve Cryptography #NSSCipherSuite +rsa_rc4_128_md5,+rsa_rc4_128_sha,+rsa_3des_sha,-rsa_des_sha,-rsa_rc4_40_md5,-rsa_rc2_40_md5,-rsa_null_md5,-rsa_null_sha,+fips_3des_sha,-fips_des_sha,-fortezza,-fortezza_rc4_128_sha,-fortezza_null,-rsa_des_56_sha,-rsa_rc4_56_sha,+rsa_aes_128_sha,+rsa_aes_256_sha,-ecdh_ecdsa_null_sha,+ecdh_ecdsa_rc4_128_sha,+ecdh_ecdsa_3des_sha,+ecdh_ecdsa_aes_128_sha,+ecdh_ecdsa_aes_256_sha,-ecdhe_ecdsa_null_sha,+ecdhe_ecdsa_rc4_128_sha,+ecdhe_ecdsa_3des_sha,+ecdhe_ecdsa_aes_128_sha,+ecdhe_ecdsa_aes_256_sha,-ecdh_rsa_null_sha,+ecdh_rsa_128_sha,+ecdh_rsa_3des_sha,+ecdh_rsa_aes_128_sha,+ecdh_rsa_aes_256_sha,-echde_rsa_null,+ecdhe_rsa_rc4_128_sha,+ecdhe_rsa_3des_sha,+ecdhe_rsa_aes_128_sha,+ecdhe_rsa_aes_256_sha #NSSProtocol SSLv3,TLSv1 # SSL Certificate Nickname: # The nickname of the RSA server certificate you are going to use. #NSSNickname Server-Cert # SSL Certificate Nickname: # The nickname of the ECC server certificate you are going to use, if you # have an ECC-enabled version of NSS and mod_nss #NSSECCNickname Server-Cert-ecc # Server Certificate Database: # The NSS security database directory that holds the certificates and # keys. The database consists of 3 files: cert8.db, key3.db and secmod.db. # Provide the directory that these files exist. #NSSCertificateDatabase /etc/libapache2-mod-nss # Database Prefix: # In order to be able to store multiple NSS databases in one directory # they need unique names. This option sets the database prefix used for # cert8.db and key3.db. #NSSDBPrefix my-prefix- # Client Authentication (Type): # Client certificate verification type. Types are none, optional and # require. #NSSVerifyClient none # # Online Certificate Status Protocol (OCSP). # Verify that certificates have not been revoked before accepting them. #NSSOCSP off # # Use a default OCSP responder. If enabled this will be used regardless # of whether one is included in a client certificate. Note that the # server certificate is verified during startup. # # NSSOCSPDefaultURL defines the service URL of the OCSP responder # NSSOCSPDefaultName is the nickname of the certificate to trust to # sign the OCSP responses. #NSSOCSPDefaultResponder on #NSSOCSPDefaultURL http://example.com/ocsp/status #NSSOCSPDefaultName ocsp-nickname # Access Control: # With SSLRequire you can do per-directory access control based # on arbitrary complex boolean expressions containing server # variable checks and other lookup directives. The syntax is a # mixture between C and Perl. See the mod_nss documentation # for more details. # #NSSRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \ # and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \ # and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \ # and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \ # and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \ # or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/ # # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o StrictRequire: # This denies access when "NSSRequireSSL" or "NSSRequire" applied even # under a "Satisfy any" situation, i.e. when it applies access is denied # and no other module can change it. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #NSSOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire # # NSSOptions +StdEnvVars # # # NSSOptions +StdEnvVars # # Per-Server Logging: # The home of a custom SSL log file. Use this when you want a # compact non-error SSL logfile on a virtual host basis. #CustomLog /home/rcrit/redhat/apache/logs/ssl_request_log \ # "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" # debian/libapache2-mod-nss.dirs0000664000000000000000000000002712302651036013420 0ustar etc/libapache2-mod-nss debian/docs0000664000000000000000000000003112302651036010033 0ustar README docs/mod_nss.html debian/libapache2-mod-nss.apache20000664000000000000000000000005112302651036013757 0ustar mod .libs/mod_nss.so mod debian/nss.load debian/libapache2-mod-nss.install0000664000000000000000000000014412302651036014125 0ustar debian/nss.conf etc/apache2/mods-available nss_pcache usr/sbin gencert usr/share/libapache2-mod-nss