airshipctl/roles/apache-file-exchanger/templates/ssl.conf.j2
Ruslan Aliev d21c02c87b Fix airshipctl-roles-test gate job
Due to incorrect processing IP:port pairs using 'regex_replace' filter,
roles-test gate job fails. This patches fixes all the related errors and
CI gate check itself.

Change-Id: Ifd7f890166195df0af9b34e1ccff59b7abd2d9ab
Relates-To: #305
Closes: #305
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-07-21 20:51:53 -05:00

54 lines
2.0 KiB
Django/Jinja

{% from 'macroses.j2' import render_rbac as render_rbac %}
<IfModule mod_ssl.c>
{% if file_exchanger_https_port != 443 %}
Listen {{ file_exchanger_https_port }}
{% endif %}
<VirtualHost {{ file_exchanger_ip | default(['*']) | ipwrap | map('regex_replace', '^(.*)$', '\\1:{}'.format(file_exchanger_https_port)) | list | join(' ') }}>
# Add machine's IP address (use ifconfig command)
{% if file_exchanger_user is defined and file_exchanger_user != None %}
<Directory /var/www/file_exchanger_cgi-bin/>
AuthType Basic
AuthName "Authorised cgi-bin"
AuthUserFile /etc/apache2/sites-available/{{ file_exchanger_name }}.htpasswd
{% if file_exchanger_group is defined and file_exchanger_group != None %}
AuthGroupFile /etc/apache2/sites-available/{{ file_exchanger_name }}.htaccess
{% endif %}
{% if file_exchanger_rbac is defined and file_exchanger_rbac != None %}
{{ render_rbac(file_exchanger_rbac) }}
{% else %}
Require valid-user
{% endif %}
</Directory>
ScriptAlias /cgi-bin /var/www/file_exchanger_cgi-bin/
{% endif %}
# Give an alias to to start your website url with
DocumentRoot "{{ file_exchanger_path }}"
<Location />
Options Indexes FollowSymLinks
AllowOverride None
{% if file_exchanger_user is defined and file_exchanger_user != None %}
AuthType Basic
AuthName "Authentication Required"
AuthUserFile /etc/apache2/sites-available/{{ file_exchanger_name }}.htpasswd
{% if file_exchanger_group is defined and file_exchanger_group != None %}
AuthGroupFile /etc/apache2/sites-available/{{ file_exchanger_name }}.htaccess
{% endif %}
{% if file_exchanger_rbac is defined and file_exchanger_rbac != None %}
{{ render_rbac(file_exchanger_rbac) }}
{% else %}
Require valid-user
{% endif %}
Script PUT /cgi-bin/put
{% else %}
Require all granted
{% endif %}
</Location>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
</IfModule>