Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Aurel
slapos
Commits
0a53288f
Commit
0a53288f
authored
5 years ago
by
Łukasz Nowak
Committed by
Łukasz Nowak
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
caddy-frontend: Protect against malformed ssl_proxy_ca_crt
parent
b5c1da06
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
software/caddy-frontend/buildout.hash.cfg
software/caddy-frontend/buildout.hash.cfg
+1
-1
software/caddy-frontend/instance-apache-replicate.cfg.in
software/caddy-frontend/instance-apache-replicate.cfg.in
+8
-0
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+18
-3
No files found.
software/caddy-frontend/buildout.hash.cfg
View file @
0a53288f
...
...
@@ -26,7 +26,7 @@ md5sum = a0edf88cdb73807b0a4793b9fd356199
[template-apache-replicate]
filename = instance-apache-replicate.cfg.in
md5sum =
d62aefe002ec13875924e4c219914795
md5sum =
ef06c04a5aa33b103dc1d25d0dfe8217
[template-slave-list]
filename = templates/apache-custom-slave-list.cfg.in
...
...
This diff is collapsed.
Click to expand it.
software/caddy-frontend/instance-apache-replicate.cfg.in
View file @
0a53288f
...
...
@@ -133,6 +133,14 @@ context =
{% do slave_error_list.append('slave https-url %r invalid' % (slave['https-url'],)) %}
{% endif %}
{% endif %}
{% set ssl_proxy_ca_crt = slave.get('ssl_proxy_ca_crt') %}
{% if ssl_proxy_ca_crt %}
{% set check_popen = popen([parameter_dict['openssl'], 'x509', '-noout']) %}
{% do check_popen.communicate(ssl_proxy_ca_crt) %}
{% if check_popen.returncode != 0 %}
{% do slave_error_list.append('ssl_proxy_ca_crt is invalid') %}
{% endif %}
{% endif %}
{# BBB: SlapOS Master non-zero knowledge BEGIN #}
{% for key in ['ssl_key', 'ssl_crt', 'ssl_ca_crt'] %}
{% if key in slave %}
...
...
This diff is collapsed.
Click to expand it.
software/caddy-frontend/test/test.py
View file @
0a53288f
...
...
@@ -1012,6 +1012,11 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
'ssl-proxy-verify'
:
True
,
'ssl_proxy_ca_crt'
:
cls
.
test_server_ca
.
certificate_pem
,
},
'ssl-proxy-verify_ssl_proxy_ca_crt_damaged'
:
{
'url'
:
cls
.
backend_https_url
,
'ssl-proxy-verify'
:
True
,
'ssl_proxy_ca_crt'
:
'damaged'
,
},
'ssl-proxy-verify_ssl_proxy_ca_crt-unverified'
:
{
'url'
:
cls
.
backend_https_url
,
'ssl-proxy-verify'
:
True
,
...
...
@@ -1238,13 +1243,15 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
'monitor-base-url'
:
None
,
'domain'
:
'example.com'
,
'accepted-slave-amount'
:
'48'
,
'rejected-slave-amount'
:
'
4
'
,
'slave-amount'
:
'5
2
'
,
'rejected-slave-amount'
:
'
5
'
,
'slave-amount'
:
'5
3
'
,
'rejected-slave-dict'
:
{
"_apache_custom_http_s-rejected"
:
[
"slave not authorized"
],
"_caddy_custom_http_s"
:
[
"slave not authorized"
],
"_caddy_custom_http_s-rejected"
:
[
"slave not authorized"
],
"_type-eventsource"
:
[
"type:eventsource is not implemented"
]
"_type-eventsource"
:
[
"type:eventsource is not implemented"
],
"_ssl-proxy-verify_ssl_proxy_ca_crt_damaged"
:
[
"ssl_proxy_ca_crt is invalid"
]
}
}
...
...
@@ -2436,6 +2443,14 @@ http://apachecustomhttpsaccepted.example.com:%%(http_port)s {
result_http
.
headers
[
'Set-Cookie'
]
)
def
test_ssl_proxy_verify_ssl_proxy_ca_crt_damaged
(
self
):
parameter_dict
=
self
.
slave_connection_parameter_dict_dict
[
'ssl-proxy-verify_ssl_proxy_ca_crt_damaged'
]
self
.
assertEqual
(
{
'request-error-list'
:
'["ssl_proxy_ca_crt is invalid"]'
},
parameter_dict
)
def
test_ssl_proxy_verify_unverified
(
self
):
parameter_dict
=
self
.
assertSlaveBase
(
'ssl-proxy-verify-unverified'
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment