Commit 4e832db6 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

component/apache: support ca-cert-dir and crl-dir in apache-backend.conf.in.

parent ae7e7bfd
...@@ -32,6 +32,15 @@ ...@@ -32,6 +32,15 @@
# # empty) # # empty)
# "crl": "<file_path>", # "crl": "<file_path>",
# #
# # The path given to "SSLCACertificatePath" (can be empty)
# # If this value is not empty, it enables client certificate check.
# # (Enabling "SSLVerifyClient require")
# "ca-cert-dir": "<directory_path>",
#
# # The path given to "SSLCARevocationPath" (used if ca-cert-dir is not
# # empty)
# "crl-dir": "<directory_path>",
#
# # The path given to "ErrorLog" # # The path given to "ErrorLog"
# "error-log": "<file_path>", # "error-log": "<file_path>",
# #
...@@ -133,16 +142,24 @@ SSLProxyEngine On ...@@ -133,16 +142,24 @@ SSLProxyEngine On
# As backend is trusting Remote-User header unset it always # As backend is trusting Remote-User header unset it always
RequestHeader unset Remote-User RequestHeader unset Remote-User
{% if parameter_dict['ca-cert'] -%} {% if parameter_dict.get('ca-cert') or parameter_dict.get('ca-cert-dir') -%}
SSLVerifyClient optional SSLVerifyClient optional
RequestHeader set Remote-User %{SSL_CLIENT_S_DN_CN}s RequestHeader set Remote-User %{SSL_CLIENT_S_DN_CN}s
RequestHeader unset X-Forwarded-For "expr=%{SSL_CLIENT_VERIFY} != 'SUCCESS'" RequestHeader unset X-Forwarded-For "expr=%{SSL_CLIENT_VERIFY} != 'SUCCESS'"
{% if parameter_dict.get('ca-cert') -%}
SSLCACertificateFile {{ parameter_dict['ca-cert'] }} SSLCACertificateFile {{ parameter_dict['ca-cert'] }}
{% if parameter_dict['crl'] -%} {% elif parameter_dict.get('ca-cert-dir') -%}
SSLCACertificatePath {{ parameter_dict['ca-cert-dir'] }}
{% endif -%}
{% if parameter_dict.get('crl') or parameter_dict.get('crl-dir') -%}
SSLCARevocationCheck chain SSLCARevocationCheck chain
{% if parameter_dict.get('crl') -%}
SSLCARevocationFile {{ parameter_dict['crl'] }} SSLCARevocationFile {{ parameter_dict['crl'] }}
{%- endif %} {% elif parameter_dict.get('crl-dir') -%}
{%- endif %} SSLCARevocationPath {{ parameter_dict['crl-dir'] }}
{% endif -%}
{% endif -%}
{% endif -%}
ErrorLog "{{ parameter_dict['error-log'] }}" ErrorLog "{{ parameter_dict['error-log'] }}"
# Default apache log format with request time in microsecond at the end # Default apache log format with request time in microsecond at the end
...@@ -162,11 +179,19 @@ Listen {{ ip }}:{{ port }} ...@@ -162,11 +179,19 @@ Listen {{ ip }}:{{ port }}
{% endfor -%} {% endfor -%}
<VirtualHost *:{{ port }}> <VirtualHost *:{{ port }}>
SSLEngine on SSLEngine on
{% if enable_authentication and parameter_dict['ca-cert'] and parameter_dict['crl'] -%} {% if enable_authentication and (parameter_dict.get('ca-cert') or parameter_dict.get('ca-cert-dir')) and (parameter_dict.get('crl') or parameter_dict.get('crl-dir')) -%}
SSLVerifyClient require SSLVerifyClient require
{% if parameter_dict.get('ca-cert') -%}
SSLCACertificateFile {{ parameter_dict['ca-cert'] }} SSLCACertificateFile {{ parameter_dict['ca-cert'] }}
{% elif parameter_dict.get('ca-cert-dir') -%}
SSLCACertificatePath {{ parameter_dict['ca-cert-dir'] }}
{% endif -%}
SSLCARevocationCheck chain SSLCARevocationCheck chain
{% if parameter_dict.get('crl') -%}
SSLCARevocationFile {{ parameter_dict['crl'] }} SSLCARevocationFile {{ parameter_dict['crl'] }}
{% elif parameter_dict.get('crl-dir') -%}
SSLCARevocationPath {{ parameter_dict['crl-dir'] }}
{% endif -%}
LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
...@@ -184,11 +209,19 @@ Listen {{ ip }}:{{ port }} ...@@ -184,11 +209,19 @@ Listen {{ ip }}:{{ port }}
<VirtualHost {{ ip }}:{{ port }}> <VirtualHost {{ ip }}:{{ port }}>
SSLEngine on SSLEngine on
Timeout 3600 Timeout 3600
{% if enable_authentication and parameter_dict['ca-cert'] and parameter_dict['crl'] -%} {% if enable_authentication and (parameter_dict.get('ca-cert') or parameter_dict.get('ca-cert-dir')) and (parameter_dict.get('crl') or parameter_dict.get('crl-dir')) -%}
SSLVerifyClient require SSLVerifyClient require
{% if parameter_dict.get('ca-cert') -%}
SSLCACertificateFile {{ parameter_dict['ca-cert'] }} SSLCACertificateFile {{ parameter_dict['ca-cert'] }}
{% elif parameter_dict.get('ca-cert-dir') -%}
SSLCACertificatePath {{ parameter_dict['ca-cert-dir'] }}
{% endif -%}
SSLCARevocationCheck chain SSLCARevocationCheck chain
{% if parameter_dict.get('crl') -%}
SSLCARevocationFile {{ parameter_dict['crl'] }} SSLCARevocationFile {{ parameter_dict['crl'] }}
{% elif parameter_dict.get('crl-dir') -%}
SSLCARevocationPath {{ parameter_dict['crl-dir'] }}
{% endif -%}
LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined LogFormat "%h %l %{REMOTE_USER}i %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
......
...@@ -14,5 +14,5 @@ ...@@ -14,5 +14,5 @@
# not need these here). # not need these here).
[template-apache-backend-conf] [template-apache-backend-conf]
filename = apache-backend.conf.in filename = apache-backend.conf.in
md5sum = bb8c175a93336f0e1838fd47225426f9 md5sum = 5afb0b919bdeb5e40d1b6d01c54ac436
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment