Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable cipher tests, using new cipher test endpoint #83285

Draft
wants to merge 3 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/integration/targets/get_url/tasks/ciphers.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
- name: test good cipher
get_url:
url: https://{{ httpbin_host }}/get
ciphers: ECDHE-RSA-AES128-SHA256
url: https://{{ no_tls13_host }}:445/
ciphers: '{{ tls_strong_cipher }}'
dest: '{{ remote_tmp_dir }}/good_cipher_get.json'
register: good_ciphers

- name: test bad cipher
get_url:
url: https://{{ httpbin_host }}/get
ciphers: ECDHE-ECDSA-AES128-SHA
url: https://{{ no_tls13_host }}:445/
ciphers: '{{ tls_weak_cipher }}'
dest: '{{ remote_tmp_dir }}/bad_cipher_get.json'
ignore_errors: true
register: bad_ciphers
Expand Down
1 change: 0 additions & 1 deletion test/integration/targets/get_url/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@

- name: Test ciphers
import_tasks: ciphers.yml
when: false # skipped until we have a way to disable TLS 1.3 on the client or server, since cipher suite selection won't break TLS 1.3

- name: Test use_netrc=False
import_tasks: use_netrc.yml
35 changes: 15 additions & 20 deletions test/integration/targets/lookup_url/tasks/ciphers.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
- vars:
url: https://{{ httpbin_host }}/get
block:
- name: test good cipher
debug:
msg: '{{ lookup("url", url) }}'
vars:
ansible_lookup_url_ciphers: ECDHE-RSA-AES128-SHA256
register: good_ciphers
- name: test good cipher
debug:
msg: '{{ lookup("url", url, ciphers=[tls_strong_cipher]) }}'
vars:
url: https://{{ no_tls13_host }}:445/

- name: test bad cipher
debug:
msg: '{{ lookup("url", url) }}'
vars:
ansible_lookup_url_ciphers: ECDHE-ECDSA-AES128-SHA
ignore_errors: true
register: bad_ciphers
- name: test bad cipher
debug:
msg: '{{ lookup("url", url, ciphers=[tls_weak_cipher]) }}'
vars:
url: https://{{ no_tls13_host }}:445/
register: result
ignore_errors: true

- assert:
that:
- good_ciphers is successful
- bad_ciphers is failed
- assert:
that:
- result is failed
1 change: 0 additions & 1 deletion test/integration/targets/lookup_url/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

- name: Test ciphers
import_tasks: ciphers.yml
when: false # skipped until we have a way to disable TLS 1.3 on the client or server, since cipher suite selection won't break TLS 1.3

- name: Test use_netrc=False
import_tasks: use_netrc.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ httpbin_host: ansible.http.tests
sni_host: sni1.ansible.http.tests
badssl_host_substring: httpbin.org
self_signed_host: self-signed.ansible.http.tests
no_tls13_host: no-tls13.ansible.http.tests
no_tls13_weak_host: no-tls13-weak.ansible.http.tests
tls_strong_cipher: ECDHE-RSA-AES256-GCM-SHA384
tls_weak_cipher: AES128-CCM8
61 changes: 37 additions & 24 deletions test/integration/targets/uri/tasks/ciphers.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@
- name: test good cipher
- name: baseline test against strong ciphers
uri:
url: https://{{ httpbin_host }}/get
ciphers: ECDHE-RSA-AES128-SHA256
register: good_ciphers
url: https://{{ no_tls13_host }}:445/

- name: test good cipher redirect
- name: baseline test against weak ciphers
uri:
url: http://{{ httpbin_host }}/redirect-to?status_code=302&url=https://{{ httpbin_host }}/get
ciphers: ECDHE-RSA-AES128-SHA256
register: good_ciphers_redir
url: https://{{ no_tls13_weak_host }}:446/
register: result
failed_when: result is successful

- name: test bad cipher
- name: ensure lower cipher against higher cipher fails
uri:
url: https://{{ httpbin_host }}/get
ciphers: ECDHE-ECDSA-AES128-SHA
ignore_errors: true
register: bad_ciphers
url: https://{{ no_tls13_host }}:445/
ciphers: '{{ tls_weak_cipher }}'
register: result
failed_when: result is successful

- name: test bad cipher redirect
- name: ensure higher cipher against lower cipher fails
uri:
url: https://{{ no_tls13_weak_host }}:446/
ciphers: '{{ tls_strong_cipher }}'
register: result
failed_when: result is successful

- name: ensure high cipher match works
uri:
url: https://{{ no_tls13_host }}:445/
ciphers: '{{ tls_strong_cipher }}'

- name: ensure low cipher match works
uri:
url: http://{{ httpbin_host }}/redirect-to?status_code=302&url=https://{{ httpbin_host }}/get
ciphers: ECDHE-ECDSA-AES128-SHA
ignore_errors: true
register: bad_ciphers_redir
url: https://{{ no_tls13_weak_host }}:446/
ciphers: '{{ tls_weak_cipher }}'

- assert:
that:
- good_ciphers is successful
- good_ciphers_redir is successful
- bad_ciphers is failed
- bad_ciphers_redir is failed
- name: test good cipher redirect
uri:
url: http://{{ no_tls13_host }}/redir
ciphers: '{{ tls_strong_cipher }}'

- name: test bad cipher redirect
uri:
url: http://{{ no_tls13_weak_host }}/redir
ciphers: '{{ tls_strong_cipher }}'
register: result
failed_when: result is successful
1 change: 0 additions & 1 deletion test/integration/targets/uri/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@

- name: Test ciphers
import_tasks: ciphers.yml
when: false # skipped until we have a way to disable TLS 1.3 on the client or server, since cipher suite selection won't break TLS 1.3

- name: Test use_netrc.yml
import_tasks: use_netrc.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class HttptesterProvider(CloudProvider):
def __init__(self, args: IntegrationConfig) -> None:
super().__init__(args)

self.image = os.environ.get('ANSIBLE_HTTP_TEST_CONTAINER', 'quay.io/ansible/http-test-container:3.0.0')
self.image = os.environ.get('ANSIBLE_HTTP_TEST_CONTAINER', 'quay.io/ansible/http-test-container:3.0.1')

self.uses_docker = True

Expand All @@ -44,6 +44,8 @@ def setup(self) -> None:
88,
443,
444,
445,
446,
749,
]

Expand All @@ -52,6 +54,8 @@ def setup(self) -> None:
'sni1.ansible.http.tests',
'fail.ansible.http.tests',
'self-signed.ansible.http.tests',
'no-tls13.ansible.http.tests',
'no-tls13-weak.ansible.http.tests',
]

descriptor = run_support_container(
Expand Down
Loading