add self-signed https endpoint for ansible-test (#73463)

* introduce self-signed.ansible.http.tests

* forwarding of port 444

* forward port 8444 to port 444 on http test container

* Fix port forwarding for Windows under docker

* add changelog fragment

Co-authored-by: Jordan Borean <jborean93@gmail.com>
This commit is contained in:
Florian Heiderich 2021-02-04 20:12:22 +01:00 committed by GitHub
parent bd18be6c0c
commit 8f887b7adb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 2 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - add https endpoint for ansible-test

View file

@ -1,4 +1,5 @@
badssl_host: wrong.host.badssl.com badssl_host: wrong.host.badssl.com
self_signed_host: self-signed.ansible.http.tests
httpbin_host: httpbin.org httpbin_host: httpbin.org
sni_host: ci-files.testing.ansible.com sni_host: ci-files.testing.ansible.com
badssl_host_substring: wrong.host.badssl.com badssl_host_substring: wrong.host.badssl.com

View file

@ -3,3 +3,4 @@ badssl_host: fail.ansible.http.tests
httpbin_host: ansible.http.tests httpbin_host: ansible.http.tests
sni_host: sni1.ansible.http.tests sni_host: sni1.ansible.http.tests
badssl_host_substring: HTTP Client Testing Service badssl_host_substring: HTTP Client Testing Service
self_signed_host: self-signed.ansible.http.tests

View file

@ -5,7 +5,7 @@ on the Ansible host. This will setup the Windows host file and forward the
local ports to use this connection. This will continue to run in the background local ports to use this connection. This will continue to run in the background
until the script is deleted. until the script is deleted.
Run this with SSH with the -R arguments to forward ports 8080 and 8443 to the Run this with SSH with the -R arguments to forward ports 8080, 8443 and 8444 to the
httptester container. httptester container.
.PARAMETER Hosts .PARAMETER Hosts
@ -85,6 +85,7 @@ if ($changed) {
$forwarded_ports = @{ $forwarded_ports = @{
80 = 8080 80 = 8080
443 = 8443 443 = 8443
444 = 8444
} }
if ($os_version -ge [Version]"6.2") { if ($os_version -ge [Version]"6.2") {
Write-Verbose -Message "Using netsh to configure forwarded ports" Write-Verbose -Message "Using netsh to configure forwarded ports"

View file

@ -150,6 +150,7 @@ HTTPTESTER_HOSTS = (
'ansible.http.tests', 'ansible.http.tests',
'sni1.ansible.http.tests', 'sni1.ansible.http.tests',
'fail.ansible.http.tests', 'fail.ansible.http.tests',
'self-signed.ansible.http.tests',
) )
@ -820,7 +821,11 @@ def command_windows_integration(args):
# we are running in a Docker container that is linked to the httptester container, we just need to # we are running in a Docker container that is linked to the httptester container, we just need to
# forward these requests to the linked hostname # forward these requests to the linked hostname
first_host = HTTPTESTER_HOSTS[0] first_host = HTTPTESTER_HOSTS[0]
ssh_options = ["-R", "8080:%s:80" % first_host, "-R", "8443:%s:443" % first_host] ssh_options = [
"-R", "8080:%s:80" % first_host,
"-R", "8443:%s:443" % first_host,
"-R", "8444:%s:444" % first_host
]
else: else:
# we are running directly and need to start the httptester container ourselves and forward the port # we are running directly and need to start the httptester container ourselves and forward the port
# from there manually set so HTTPTESTER env var is set during the run # from there manually set so HTTPTESTER env var is set during the run
@ -1310,6 +1315,10 @@ def start_httptester(args):
remote=8443, remote=8443,
container=443, container=443,
), ),
dict(
remote=8444,
container=444,
),
dict( dict(
remote=8749, remote=8749,
container=749, container=749,
@ -1402,6 +1411,7 @@ def inject_httptester(args):
rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080 rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
rdr pass inet proto tcp from any to any port 88 -> 127.0.0.1 port 8088 rdr pass inet proto tcp from any to any port 88 -> 127.0.0.1 port 8088
rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443 rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443
rdr pass inet proto tcp from any to any port 444 -> 127.0.0.1 port 8444
rdr pass inet proto tcp from any to any port 749 -> 127.0.0.1 port 8749 rdr pass inet proto tcp from any to any port 749 -> 127.0.0.1 port 8749
''' '''
cmd = ['pfctl', '-ef', '-'] cmd = ['pfctl', '-ef', '-']
@ -1416,6 +1426,7 @@ rdr pass inet proto tcp from any to any port 749 -> 127.0.0.1 port 8749
(80, 8080), (80, 8080),
(88, 8088), (88, 8088),
(443, 8443), (443, 8443),
(444, 8444),
(749, 8749), (749, 8749),
] ]