Add Test SSL with self-signed certificates

This commit is contained in:
Fabrice Reix 2021-02-06 12:15:32 +01:00
parent e655d05c1f
commit 95b9887e55
11 changed files with 133 additions and 5 deletions

View File

@ -61,7 +61,10 @@ jobs:
cargo build --verbose
- name: Test Prequisites
run: |
pip3 install Flask && cd integration && python3 server.py >server.log 2>&1 &
pip3 install Flask
cd integration
python3 server.py >server.log 2>&1 &
python3 ssl/server.py >server-ssl.log 2>&1 &
wget https://snapshots.mitmproxy.org/5.2/mitmproxy-5.2-linux.tar.gz -O - | tar -xz && ./mitmdump -p 8888 --modify-header "/From-Proxy/Hello" &
- name: Run Tests
run: |
@ -76,7 +79,9 @@ jobs:
if: ${{ always() }}
with:
name: tests-ubuntu-${{ matrix.rust }}-artifacts
path: integration/server.log
path: |
integration/server.log
integration/server-ssl.log
test-osx:
runs-on: macos-latest
@ -101,7 +106,10 @@ jobs:
cargo build --verbose
- name: Test Prequisites
run: |
pip3 install Flask && cd integration && python3 server.py >server.log 2>&1 &
pip3 install Flask
cd integration
python3 server.py >server.log 2>&1 &
python3 ssl/server.py >server-ssl.log 2>&1 &
wget https://snapshots.mitmproxy.org/5.2/mitmproxy-5.2-osx.tar.gz -O - | tar -xz && ./mitmdump -p 8888 --modify-header "/From-Proxy/Hello" &
- name: Run Tests
run: |
@ -116,4 +124,6 @@ jobs:
if: ${{ always() }}
with:
name: tests-osx-${{ matrix.rust }}-artifacts
path: integration/server.log
path: |
integration/server.log
integration/server-ssl.log

View File

@ -15,7 +15,7 @@ def main():
[test_hurl.test(f) for f in sorted(glob.glob('tests_error_parser/*.hurl'))]
# Dynamic run (with server)
[test_hurl.test(f) for f in sorted(glob.glob('tests/*.hurl'))]
[test_hurl.test(f) for f in sorted(glob.glob('tests/*.hurl')) + sorted(glob.glob('ssl/*.hurl'))]
print('test integration ok!')

32
integration/ssl/cert.pem Normal file
View File

@ -0,0 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFlzCCA3+gAwIBAgIUMzQ1cLyRXQ4Y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zBRMB0GA1UdDgQWBBR57wK6If8NG47sJ4d6OPcawKBX4zAfBgNVHSMEGDAW
gBR57wK6If8NG47sJ4d6OPcawKBX4zAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3
DQEBCwUAA4ICAQCH4iJiL3RENaX5rREOJ3cbXkxbOljo77dcjBPu0/VLty/KJMOW
EFNVQlLYPqGV856a8dLmxtpj6nukCj3reY8CdXo/pDzWSOjZq8LbFRcFfK+NORTG
ammhtIbBExL9LbtE7RNxOHjz9vM2Z+87ZokNcg0pQgrTk58Yk2sXogmzhd44cpr9
M67SqrC+y3IoqLgFmYvPLZZbcrzUPMQjBYaJtIU33xboN0d8mB7T/xLvs1DI9P09
i0AbuV5U92WQTcb5Ds7XVlcQGbxONqwQd63fSipla09sOisuXzrrf00ZxnMuoIYB
qOSqMIcmvXeNiccFzCP5N+G8YUb3dPuPf+BHpsLzzRfzsMYdJKyePuMFia1pwNvF
Uqfe27C951/92tBUNLRIuLh4paShJPkH1uNQx+JIrvOg/RDdx6iYUrJ/9+MvTAp0
GJg2WYjy8eXa76LImq3rzmgFoa9Gkha9K4BaOy2Z+eDrSlUrJkLLDNYdhIO/q+BO
Dlp3Yv1ZHsvAiSK6iRHFnvG9AxzxoDiVyn6tS6KIDgv9ZjiNCzAsv62hrobid/iD
Bwii2vE0MAPHMJ7180/likbT1xg/C4OVn/J5tijrTPjv8vYK3RLrwjjP+1mZq0VF
Qf/IiADrKPlYfOyioWJnB3QjQowjeEIFw5cLl7O1GwCKBsFPapkW0KO/WA==
-----END CERTIFICATE-----

View File

@ -0,0 +1,7 @@
error: Http Connection
--> ssl/error_self_signed_certificate.hurl:1:5
|
1 | GET https://localhost:8001/hello
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SSL certificate problem
|

View File

@ -0,0 +1,2 @@
3

View File

@ -0,0 +1,4 @@
GET https://localhost:8001/hello
HTTP/1.0 200
```Hello World!```

View File

@ -0,0 +1,2 @@
0

View File

@ -0,0 +1,4 @@
GET https://localhost:8001/hello
HTTP/1.0 200
```Hello World!```

View File

@ -0,0 +1 @@
--insecure

52
integration/ssl/key.pem Normal file
View File

@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQC9URoA9dVk5oNU
ivNyulXsFqV2siqFTJ7j5frxof4MV7luYBb/Hb16/1G0A5DRPMgTT1BEoTftKvzC
jYpW0bq3G/GDMm0mFW9qxPKe1i4lDLKRMHJwd7GmX26jp3FgD4XVWPfs8rnWhQhI
pwD49TZWAvav8IfX/mgYoO0q/lXxz/speNCA8W/AKi5CjkOrmNaplnmyKOu39EkB
t3zMJOz91NIGzhZWPUvu1v/y2J5P0DyQWNpneFJBUEwhSdkvNZipWnD8gpVfRsnJ
iF4kiusSRK8VyefK/gFKW8+Df+ZEzj777wG2s3svYZPXs98EoAF5duc9gz1RD1cz
bW3S4Qe5Wkcsa2U3fjGBjFCLwXPnAKXF8rBGGlAEFdhTpmN7yuZvD4F6HDgiEnlf
JkVMwS1Aytz14c6blFdIYPD8EwcA7uqfgNnvgETQAvS+5VzR0JluYZDoKvqCfJtO
3gDeEinmJt21fvwiOV1sAqrxqyijZVxdkGQTD6LiQAcp7vwUB8mLJkfA56GEbYV4
BZEsZfj7ARB9Fzqd1pQaKDgTP+ZMOcsy+2tzzVEJRSTfnS2osBIHVGxtO9WTlwZ2
+QHACykRgOhKjL2CR9g9jypzPUPYNFcZAomDVEDeET+cA7uH3HUvq2E8Xc4RaWwC
zhT1niWXjV6YKGaG7n6djVg6nUowVQIDAQABAoICAE9g7Q1QBmyrNo/BPzhwpsw5
5qDxLWD88nZOHL0qFhJoyehcw+euOZ+T5FcdU6BX4vAtxlMwYfnAl4CfxkyG3cof
HlHLV/aq8C+NaslstqZ0P38fGCzOEx/WTdayw5fqikwdZL7mO0OWPhXwaDj64BCK
Z5L3wI2xL0Z8W1U2lSSx9va5oHsgQKILTaA8dGVDzWYIIPixrb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Ue3AVwSZ3nuxG4DB
G92VjIYbwX7IuvU7qDVZRlH3f7wciQf08KDdrLyzjHfRWZ3sBXrnMmC5Fz/a1MDn
d7k8yuCVBMAC0K15osckSqHwcxyAKUQ=
-----END PRIVATE KEY-----

14
integration/ssl/server.py Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/python
from flask import Flask
import os
app = Flask(__name__)
@app.route("/hello")
def hello():
return "Hello World!"
if __name__ == "__main__":
ssl_dir = os.path.dirname(os.path.realpath(__file__))
app.run(port=8001, ssl_context=(ssl_dir + '/cert.pem', ssl_dir + '/key.pem'))