Skip to content

Commit 7aed3f2

Browse files
committed
Do not use /tmp as default for s4u2proxy
The /tmp directory can lead to bugs and DoS of the apache process because any user on the system can block the creation of predictable file names. Simply error out if GssapiDelegCcacheDir is not explicitly set. Signed-off-by: Simo Sorce <simo@redhat.com>
1 parent 86661d0 commit 7aed3f2

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/mod_auth_gssapi.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,19 @@ struct mag_req_cfg *mag_init_cfg(request_rec *req)
658658
return req_cfg;
659659
}
660660

661+
static bool use_s4u2proxy(struct mag_req_cfg *req_cfg) {
662+
if (req_cfg->cfg->use_s4u2proxy) {
663+
if (req_cfg->cfg->deleg_ccache_dir != NULL) {
664+
return true;
665+
} else {
666+
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, req_cfg->req,
667+
"S4U2 Proxy requested but GssapiDelegCcacheDir "
668+
"is not set. Constrained delegation disabled!");
669+
}
670+
}
671+
return false;
672+
}
673+
661674
static int mag_auth(request_rec *req)
662675
{
663676
const char *type;
@@ -850,7 +863,7 @@ static int mag_auth(request_rec *req)
850863
req->ap_auth_type = apr_pstrdup(req->pool, auth_types[auth_type]);
851864

852865
#ifdef HAVE_CRED_STORE
853-
if (cfg->use_s4u2proxy) {
866+
if (use_s4u2proxy(req_cfg)) {
854867
cred_usage = GSS_C_BOTH;
855868
}
856869
#endif
@@ -1058,9 +1071,6 @@ static const char *mag_use_s4u2p(cmd_parms *parms, void *mconfig, int on)
10581071
struct mag_config *cfg = (struct mag_config *)mconfig;
10591072
cfg->use_s4u2proxy = on ? true : false;
10601073

1061-
if (cfg->deleg_ccache_dir == NULL) {
1062-
cfg->deleg_ccache_dir = apr_pstrdup(parms->pool, "/tmp");
1063-
}
10641074
return NULL;
10651075
}
10661076
#endif

0 commit comments

Comments
 (0)