|
|
8335b1 |
diff --git a/modules/proxy/ajp.h b/modules/proxy/ajp.h
|
|
|
8335b1 |
index c65ebe5..330573b 100644
|
|
|
8335b1 |
--- a/modules/proxy/ajp.h
|
|
|
8335b1 |
+++ b/modules/proxy/ajp.h
|
|
|
8335b1 |
@@ -413,11 +413,13 @@ apr_status_t ajp_ilink_receive(apr_socket_t *sock, ajp_msg_t *msg);
|
|
|
8335b1 |
* @param r current request
|
|
|
8335b1 |
* @param buffsize max size of the AJP packet.
|
|
|
8335b1 |
* @param uri requested uri
|
|
|
8335b1 |
+ * @param secret authentication secret
|
|
|
8335b1 |
* @return APR_SUCCESS or error
|
|
|
8335b1 |
*/
|
|
|
8335b1 |
apr_status_t ajp_send_header(apr_socket_t *sock, request_rec *r,
|
|
|
8335b1 |
apr_size_t buffsize,
|
|
|
8335b1 |
- apr_uri_t *uri);
|
|
|
8335b1 |
+ apr_uri_t *uri,
|
|
|
8335b1 |
+ const char *secret);
|
|
|
8335b1 |
|
|
|
8335b1 |
/**
|
|
|
8335b1 |
* Read the ajp message and return the type of the message.
|
|
|
8335b1 |
diff --git a/modules/proxy/ajp_header.c b/modules/proxy/ajp_header.c
|
|
|
8335b1 |
index 074f0a8..53571ee 100644
|
|
|
8335b1 |
--- a/modules/proxy/ajp_header.c
|
|
|
8335b1 |
+++ b/modules/proxy/ajp_header.c
|
|
|
8335b1 |
@@ -213,7 +213,8 @@ AJPV13_REQUEST/AJPV14_REQUEST=
|
|
|
8335b1 |
|
|
|
8335b1 |
static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
|
|
|
8335b1 |
request_rec *r,
|
|
|
8335b1 |
- apr_uri_t *uri)
|
|
|
8335b1 |
+ apr_uri_t *uri,
|
|
|
8335b1 |
+ const char *secret)
|
|
|
8335b1 |
{
|
|
|
8335b1 |
int method;
|
|
|
8335b1 |
apr_uint32_t i, num_headers = 0;
|
|
|
8335b1 |
@@ -293,17 +294,15 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
|
|
|
8335b1 |
i, elts[i].key, elts[i].val);
|
|
|
8335b1 |
}
|
|
|
8335b1 |
|
|
|
8335b1 |
-/* XXXX need to figure out how to do this
|
|
|
8335b1 |
- if (s->secret) {
|
|
|
8335b1 |
+ if (secret) {
|
|
|
8335b1 |
if (ajp_msg_append_uint8(msg, SC_A_SECRET) ||
|
|
|
8335b1 |
- ajp_msg_append_string(msg, s->secret)) {
|
|
|
8335b1 |
+ ajp_msg_append_string(msg, secret)) {
|
|
|
8335b1 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
|
|
8335b1 |
- "Error ajp_marshal_into_msgb - "
|
|
|
8335b1 |
+ "ajp_marshal_into_msgb: "
|
|
|
8335b1 |
"Error appending secret");
|
|
|
8335b1 |
return APR_EGENERAL;
|
|
|
8335b1 |
}
|
|
|
8335b1 |
}
|
|
|
8335b1 |
- */
|
|
|
8335b1 |
|
|
|
8335b1 |
if (r->user) {
|
|
|
8335b1 |
if (ajp_msg_append_uint8(msg, SC_A_REMOTE_USER) ||
|
|
|
8335b1 |
@@ -628,7 +627,8 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg,
|
|
|
8335b1 |
apr_status_t ajp_send_header(apr_socket_t *sock,
|
|
|
8335b1 |
request_rec *r,
|
|
|
8335b1 |
apr_size_t buffsize,
|
|
|
8335b1 |
- apr_uri_t *uri)
|
|
|
8335b1 |
+ apr_uri_t *uri,
|
|
|
8335b1 |
+ const char *secret)
|
|
|
8335b1 |
{
|
|
|
8335b1 |
ajp_msg_t *msg;
|
|
|
8335b1 |
apr_status_t rc;
|
|
|
8335b1 |
@@ -640,7 +640,7 @@ apr_status_t ajp_send_header(apr_socket_t *sock,
|
|
|
8335b1 |
return rc;
|
|
|
8335b1 |
}
|
|
|
8335b1 |
|
|
|
8335b1 |
- rc = ajp_marshal_into_msgb(msg, r, uri);
|
|
|
8335b1 |
+ rc = ajp_marshal_into_msgb(msg, r, uri, secret);
|
|
|
8335b1 |
if (rc != APR_SUCCESS) {
|
|
|
8335b1 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00988)
|
|
|
8335b1 |
"ajp_send_header: ajp_marshal_into_msgb failed");
|
|
|
8335b1 |
diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c
|
|
|
8335b1 |
index 5517e08..e998f58 100644
|
|
|
8335b1 |
--- a/modules/proxy/mod_proxy.c
|
|
|
8335b1 |
+++ b/modules/proxy/mod_proxy.c
|
|
|
8335b1 |
@@ -260,6 +260,12 @@ static const char *set_worker_param(apr_pool_t *p,
|
|
|
8335b1 |
return "flusher name length must be < 16 characters";
|
|
|
8335b1 |
PROXY_STRNCPY(worker->s->flusher, val);
|
|
|
8335b1 |
}
|
|
|
8335b1 |
+ else if (!strcasecmp(key, "secret")) {
|
|
|
8335b1 |
+ if (PROXY_STRNCPY(worker->s->secret, val) != APR_SUCCESS) {
|
|
|
8335b1 |
+ return apr_psprintf(p, "Secret length must be < %d characters",
|
|
|
8335b1 |
+ (int)sizeof(worker->s->secret));
|
|
|
8335b1 |
+ }
|
|
|
8335b1 |
+ }
|
|
|
8335b1 |
else {
|
|
|
8335b1 |
return "unknown Worker parameter";
|
|
|
8335b1 |
}
|
|
|
8335b1 |
diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h
|
|
|
8335b1 |
index b702028..06f2b17 100644
|
|
|
8335b1 |
--- a/modules/proxy/mod_proxy.h
|
|
|
8335b1 |
+++ b/modules/proxy/mod_proxy.h
|
|
|
8335b1 |
@@ -317,6 +317,7 @@ PROXY_WORKER_DISABLED | PROXY_WORKER_STOPPED | PROXY_WORKER_IN_ERROR )
|
|
|
8335b1 |
#define PROXY_WORKER_MAX_HOSTNAME_SIZE 64
|
|
|
8335b1 |
#define PROXY_BALANCER_MAX_HOSTNAME_SIZE PROXY_WORKER_MAX_HOSTNAME_SIZE
|
|
|
8335b1 |
#define PROXY_BALANCER_MAX_STICKY_SIZE 64
|
|
|
8335b1 |
+#define PROXY_WORKER_MAX_SECRET_SIZE 64
|
|
|
8335b1 |
|
|
|
8335b1 |
#define PROXY_MAX_PROVIDER_NAME_SIZE 16
|
|
|
8335b1 |
|
|
|
8335b1 |
@@ -394,6 +395,7 @@ typedef struct {
|
|
|
8335b1 |
unsigned int disablereuse_set:1;
|
|
|
8335b1 |
unsigned int was_malloced:1;
|
|
|
8335b1 |
unsigned int is_name_matchable:1;
|
|
|
8335b1 |
+ char secret[PROXY_WORKER_MAX_SECRET_SIZE]; /* authentication secret (e.g. AJP13) */
|
|
|
8335b1 |
} proxy_worker_shared;
|
|
|
8335b1 |
|
|
|
8335b1 |
#define ALIGNED_PROXY_WORKER_SHARED_SIZE (APR_ALIGN_DEFAULT(sizeof(proxy_worker_shared)))
|
|
|
8335b1 |
diff --git a/modules/proxy/mod_proxy_ajp.c b/modules/proxy/mod_proxy_ajp.c
|
|
|
8335b1 |
index 380b870..81039bf 100644
|
|
|
8335b1 |
--- a/modules/proxy/mod_proxy_ajp.c
|
|
|
8335b1 |
+++ b/modules/proxy/mod_proxy_ajp.c
|
|
|
8335b1 |
@@ -196,6 +196,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|
|
8335b1 |
apr_off_t content_length = 0;
|
|
|
8335b1 |
int original_status = r->status;
|
|
|
8335b1 |
const char *original_status_line = r->status_line;
|
|
|
8335b1 |
+ const char *secret = NULL;
|
|
|
8335b1 |
|
|
|
8335b1 |
if (psf->io_buffer_size_set)
|
|
|
8335b1 |
maxsize = psf->io_buffer_size;
|
|
|
8335b1 |
@@ -205,12 +206,15 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|
|
8335b1 |
maxsize = AJP_MSG_BUFFER_SZ;
|
|
|
8335b1 |
maxsize = APR_ALIGN(maxsize, 1024);
|
|
|
8335b1 |
|
|
|
8335b1 |
+ if (*conn->worker->s->secret)
|
|
|
8335b1 |
+ secret = conn->worker->s->secret;
|
|
|
8335b1 |
+
|
|
|
8335b1 |
/*
|
|
|
8335b1 |
* Send the AJP request to the remote server
|
|
|
8335b1 |
*/
|
|
|
8335b1 |
|
|
|
8335b1 |
/* send request headers */
|
|
|
8335b1 |
- status = ajp_send_header(conn->sock, r, maxsize, uri);
|
|
|
8335b1 |
+ status = ajp_send_header(conn->sock, r, maxsize, uri, secret);
|
|
|
8335b1 |
if (status != APR_SUCCESS) {
|
|
|
8335b1 |
conn->close = 1;
|
|
|
8335b1 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00868)
|