Skip to content
Snippets Groups Projects
Commit ef792a9b authored by Francesco Giacomini's avatar Francesco Giacomini
Browse files

Merge branch 'issue-19' into 'master'

[ngx-voms] configure openssl to accept proxy certs

Closes #19

See merge request storm2/ngx_http_voms_module!12
parents db3ecd66 17f8e6ed
No related branches found
No related tags found
1 merge request!12[ngx-voms] configure openssl to accept proxy certs
Pipeline #23525 passed with warnings
user build; user build;
worker_processes 1; worker_processes 1;
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=/vomsdir; env X509_VOMS_DIR=/vomsdir;
error_log logs/error.log warn; error_log logs/error.log warn;
......
...@@ -38,16 +38,18 @@ using MaybeVomsAc = boost::optional<VomsAc>; ...@@ -38,16 +38,18 @@ using MaybeVomsAc = boost::optional<VomsAc>;
enum class EeDn { SUBJECT, ISSUER }; enum class EeDn { SUBJECT, ISSUER };
static ngx_int_t add_variables(ngx_conf_t* cf); static ngx_int_t add_variables(ngx_conf_t* cf);
static ngx_int_t ngx_ssl_allow_proxy_certs(ngx_ssl_t* ssl);
static char* ngx_http_voms_merge_srv_conf(ngx_conf_t* cf, void*, void*);
static ngx_http_module_t ctx = { static ngx_http_module_t ctx = {
add_variables, // preconfiguration add_variables, // preconfiguration
NULL, // postconfiguration NULL, // postconfiguration
NULL, // create main configuration NULL, // create main configuration
NULL, // init main configuration NULL, // init main configuration
NULL, // create server configuration NULL, // create server configuration
NULL, // merge server configuration ngx_http_voms_merge_srv_conf, // merge server configuration
NULL, // create location configuration NULL, // create location configuration
NULL // merge location configuration NULL // merge location configuration
}; };
ngx_module_t ngx_http_voms_module = { ngx_module_t ngx_http_voms_module = {
...@@ -224,6 +226,36 @@ static ngx_int_t add_variables(ngx_conf_t* cf) ...@@ -224,6 +226,36 @@ static ngx_int_t add_variables(ngx_conf_t* cf)
return NGX_OK; return NGX_OK;
} }
static ngx_int_t ngx_ssl_allow_proxy_certs(ngx_ssl_t* ssl)
{
X509_STORE* store = SSL_CTX_get_cert_store(ssl->ctx);
if (store == NULL) {
ngx_ssl_error(NGX_LOG_EMERG,
ssl->log,
0,
const_cast<char*>("SSL_CTX_get_cert_store() failed"));
return NGX_ERROR;
}
X509_STORE_set_flags(store, X509_V_FLAG_ALLOW_PROXY_CERTS);
return NGX_OK;
}
static char* ngx_http_voms_merge_srv_conf(ngx_conf_t* cf, void*, void*)
{
auto conf = static_cast<ngx_http_ssl_srv_conf_t*>(
ngx_http_conf_get_module_srv_conf(cf, ngx_http_ssl_module));
if (conf->ssl.ctx != nullptr) {
if (ngx_ssl_allow_proxy_certs(&conf->ssl) != NGX_OK) {
return static_cast<char*>(NGX_CONF_ERROR);
}
}
return NGX_CONF_OK;
}
// return the first AC, if present // return the first AC, if present
static MaybeVomsAc retrieve_voms_ac_from_proxy(ngx_http_request_t* r) static MaybeVomsAc retrieve_voms_ac_from_proxy(ngx_http_request_t* r)
{ {
......
...@@ -6,7 +6,6 @@ __DATA__ ...@@ -6,7 +6,6 @@ __DATA__
=== TEST 1: rfc proxy certificate, no AC === TEST 1: rfc proxy certificate, no AC
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t/trust-anchors; env X509_CERT_DIR=t/trust-anchors;
--- http_config --- http_config
......
...@@ -6,7 +6,6 @@ __DATA__ ...@@ -6,7 +6,6 @@ __DATA__
=== TEST 1: rfc proxy certificate, no AC === TEST 1: rfc proxy certificate, no AC
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t/trust-anchors; env X509_CERT_DIR=t/trust-anchors;
--- http_config --- http_config
...@@ -40,7 +39,6 @@ CN=Test CA,O=IGI,C=IT ...@@ -40,7 +39,6 @@ CN=Test CA,O=IGI,C=IT
=== TEST 2: standard x.509 certificate === TEST 2: standard x.509 certificate
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t/trust-anchors; env X509_CERT_DIR=t/trust-anchors;
--- http_config --- http_config
...@@ -78,7 +76,6 @@ CN=Test CA,O=IGI,C=IT ...@@ -78,7 +76,6 @@ CN=Test CA,O=IGI,C=IT
=== TEST 3: three delegations proxy === TEST 3: three delegations proxy
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t/trust-anchors; env X509_CERT_DIR=t/trust-anchors;
--- http_config --- http_config
...@@ -113,7 +110,6 @@ CN=Test CA,O=IGI,C=IT ...@@ -113,7 +110,6 @@ CN=Test CA,O=IGI,C=IT
=== TEST 4: three delegations proxy + CA cert === TEST 4: three delegations proxy + CA cert
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t/trust-anchors; env X509_CERT_DIR=t/trust-anchors;
--- http_config --- http_config
......
...@@ -7,7 +7,6 @@ __DATA__ ...@@ -7,7 +7,6 @@ __DATA__
=== TEST 1: valid AC, verification of VOMS generic attributes encoding === TEST 1: valid AC, verification of VOMS generic attributes encoding
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t/trust-anchors; env X509_CERT_DIR=t/trust-anchors;
--- http_config --- http_config
......
...@@ -7,7 +7,6 @@ __DATA__ ...@@ -7,7 +7,6 @@ __DATA__
=== TEST 1: https with x509 client authentication, expired client certificate === TEST 1: https with x509 client authentication, expired client certificate
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
--- http_config --- http_config
server { server {
error_log logs/error.log debug; error_log logs/error.log debug;
......
...@@ -7,7 +7,6 @@ __DATA__ ...@@ -7,7 +7,6 @@ __DATA__
=== TEST 1: https with x509 client authentication, valid proxy certificate with expired VOMS attributes === TEST 1: https with x509 client authentication, valid proxy certificate with expired VOMS attributes
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t/trust-anchors; env X509_CERT_DIR=t/trust-anchors;
--- http_config --- http_config
......
...@@ -7,7 +7,6 @@ __DATA__ ...@@ -7,7 +7,6 @@ __DATA__
=== TEST 1: https with x509 client authentication, valid proxy certificate with no VOMS attributes === TEST 1: https with x509 client authentication, valid proxy certificate with no VOMS attributes
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
--- http_config --- http_config
server { server {
......
...@@ -7,7 +7,6 @@ __DATA__ ...@@ -7,7 +7,6 @@ __DATA__
=== TEST 1: HTTP connection, no SSL === TEST 1: HTTP connection, no SSL
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
--- http_config --- http_config
server { server {
......
...@@ -7,7 +7,6 @@ __DATA__ ...@@ -7,7 +7,6 @@ __DATA__
=== TEST 1: Valid proxy, wrong client trust-anchor === TEST 1: Valid proxy, wrong client trust-anchor
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t/trust-anchors; env X509_CERT_DIR=t/trust-anchors;
--- http_config --- http_config
......
...@@ -7,7 +7,6 @@ __DATA__ ...@@ -7,7 +7,6 @@ __DATA__
=== TEST 1: HTTPS with no X.509 client authentication === TEST 1: HTTPS with no X.509 client authentication
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
--- http_config --- http_config
server { server {
......
...@@ -7,7 +7,6 @@ __DATA__ ...@@ -7,7 +7,6 @@ __DATA__
=== TEST 1: https with x509 client authentication, untrusted AC signature LSC missing === TEST 1: https with x509 client authentication, untrusted AC signature LSC missing
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t/trust-anchors; env X509_CERT_DIR=t/trust-anchors;
--- http_config --- http_config
...@@ -41,7 +40,6 @@ Cannot verify AC signature ...@@ -41,7 +40,6 @@ Cannot verify AC signature
=== TEST 2: Valid proxy, VOMS trust-anchor missing === TEST 2: Valid proxy, VOMS trust-anchor missing
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t; env X509_CERT_DIR=t;
--- http_config --- http_config
......
...@@ -7,7 +7,6 @@ __DATA__ ...@@ -7,7 +7,6 @@ __DATA__
=== TEST 1: valid AC, verification of valid VOMS attributes extracted by ngx_http_voms_module === TEST 1: valid AC, verification of valid VOMS attributes extracted by ngx_http_voms_module
--- main_config --- main_config
env OPENSSL_ALLOW_PROXY_CERTS=1;
env X509_VOMS_DIR=t/vomsdir; env X509_VOMS_DIR=t/vomsdir;
env X509_CERT_DIR=t/trust-anchors; env X509_CERT_DIR=t/trust-anchors;
--- http_config --- http_config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment