2021-01-20 23:14:11 -05:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#
|
2021-10-29 00:39:53 -04:00
|
|
|
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
2021-10-08 04:49:57 -04:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2021-01-20 23:14:11 -05:00
|
|
|
|
|
|
|
import http.client
|
2022-05-10 02:46:56 -04:00
|
|
|
import logging
|
2021-01-20 23:14:11 -05:00
|
|
|
import os
|
|
|
|
import ssl
|
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
import pytest
|
2022-07-06 12:34:06 -04:00
|
|
|
from common_test_methods import get_env_config_variable
|
2022-05-10 02:46:56 -04:00
|
|
|
from pytest_embedded import Dut
|
2021-01-20 23:14:11 -05:00
|
|
|
|
|
|
|
server_cert_pem = '-----BEGIN CERTIFICATE-----\n'\
|
|
|
|
'MIIDKzCCAhOgAwIBAgIUBxM3WJf2bP12kAfqhmhhjZWv0ukwDQYJKoZIhvcNAQEL\n'\
|
|
|
|
'BQAwJTEjMCEGA1UEAwwaRVNQMzIgSFRUUFMgc2VydmVyIGV4YW1wbGUwHhcNMTgx\n'\
|
|
|
|
'MDE3MTEzMjU3WhcNMjgxMDE0MTEzMjU3WjAlMSMwIQYDVQQDDBpFU1AzMiBIVFRQ\n'\
|
|
|
|
'UyBzZXJ2ZXIgZXhhbXBsZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\n'\
|
|
|
|
'ALBint6nP77RCQcmKgwPtTsGK0uClxg+LwKJ3WXuye3oqnnjqJCwMEneXzGdG09T\n'\
|
|
|
|
'sA0SyNPwrEgebLCH80an3gWU4pHDdqGHfJQa2jBL290e/5L5MB+6PTs2NKcojK/k\n'\
|
|
|
|
'qcZkn58MWXhDW1NpAnJtjVniK2Ksvr/YIYSbyD+JiEs0MGxEx+kOl9d7hRHJaIzd\n'\
|
|
|
|
'GF/vO2pl295v1qXekAlkgNMtYIVAjUy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BPzXu8+X+5odUdtCwpYdNJPAC3W6BUfw2uaGmKAJc\n' \
|
|
|
|
'dqu1S0nc+OBK0Tiyv/2TKD8T+3WAxINZBv4je2bEOwKBgEavm5zTN9NILJsJCf9k\n' \
|
|
|
|
'te7+uDFuyoNWkL1vmMPuJYVC1QMVq1yr3DSaxA19BG9P4ZyOMOwVlPVWA+LofD4D\n' \
|
|
|
|
'S+w4Jjl2KDI4tSLUr6bsAJWdDfmrmGmRN3Kpds4RXaymV3rjj7qRk1J+ivtwo89s\n' \
|
|
|
|
'Vj+VslYzxw7FKKmnBgh/qGbJ\n' \
|
|
|
|
'-----END PRIVATE KEY-----\n'
|
|
|
|
|
2021-01-20 23:14:11 -05:00
|
|
|
success_response = '<h1>Hello Secure World!</h1>'
|
|
|
|
|
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
@pytest.mark.esp32
|
|
|
|
@pytest.mark.esp32c3
|
|
|
|
@pytest.mark.esp32s2
|
|
|
|
@pytest.mark.esp32s3
|
2022-07-03 04:22:20 -04:00
|
|
|
@pytest.mark.wifi_router
|
2022-05-10 02:46:56 -04:00
|
|
|
def test_examples_protocol_https_server_simple(dut: Dut) -> None:
|
2021-01-20 23:14:11 -05:00
|
|
|
"""
|
|
|
|
steps: |
|
|
|
|
1. join AP
|
|
|
|
2. connect to www.howsmyssl.com:443
|
|
|
|
3. send http request
|
|
|
|
"""
|
|
|
|
# check and log bin size
|
2022-05-10 02:46:56 -04:00
|
|
|
binary_file = os.path.join(dut.app.binary_path, 'https_server.bin')
|
2021-01-20 23:14:11 -05:00
|
|
|
bin_size = os.path.getsize(binary_file)
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('https_server_simple_bin_size : {}KB'.format(bin_size // 1024))
|
2021-01-20 23:14:11 -05:00
|
|
|
# start test
|
2022-07-04 04:54:33 -04:00
|
|
|
logging.info('Waiting to connect with AP')
|
|
|
|
if dut.app.sdkconfig.get('EXAMPLE_WIFI_SSID_PWD_FROM_STDIN') is True:
|
|
|
|
dut.expect('Please input ssid password:')
|
2022-07-06 12:34:06 -04:00
|
|
|
env_name = 'wifi_router'
|
|
|
|
ap_ssid = get_env_config_variable(env_name, 'ap_ssid')
|
|
|
|
ap_password = get_env_config_variable(env_name, 'ap_password')
|
|
|
|
dut.write(f'{ap_ssid} {ap_password}')
|
2021-01-20 23:14:11 -05:00
|
|
|
# Parse IP address and port of the server
|
2022-05-10 02:46:56 -04:00
|
|
|
dut.expect(r'Starting server')
|
|
|
|
got_port = int(dut.expect(r'Server listening on port (\d+)', timeout=30)[1].decode())
|
2022-07-14 10:55:50 -04:00
|
|
|
got_ip = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()
|
2021-01-20 23:14:11 -05:00
|
|
|
|
|
|
|
# Expected logs
|
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Got IP : {}'.format(got_ip))
|
|
|
|
logging.info('Got Port : {}'.format(got_port))
|
2021-01-20 23:14:11 -05:00
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Performing GET request over an SSL connection with the server')
|
2021-01-20 23:14:11 -05:00
|
|
|
|
2021-10-08 04:49:57 -04:00
|
|
|
CLIENT_CERT_FILE = 'client_cert.pem'
|
|
|
|
CLIENT_KEY_FILE = 'client_key.pem'
|
|
|
|
|
2021-08-09 05:58:36 -04:00
|
|
|
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
|
2021-01-20 23:14:11 -05:00
|
|
|
ssl_context.verify_mode = ssl.CERT_REQUIRED
|
|
|
|
ssl_context.check_hostname = False
|
|
|
|
ssl_context.load_verify_locations(cadata=server_cert_pem)
|
2021-10-08 04:49:57 -04:00
|
|
|
|
|
|
|
with open(CLIENT_CERT_FILE, 'w') as cert, open(CLIENT_KEY_FILE, 'w') as key:
|
|
|
|
cert.write(client_cert_pem)
|
|
|
|
key.write(client_key_pem)
|
|
|
|
|
|
|
|
ssl_context.load_cert_chain(certfile=CLIENT_CERT_FILE, keyfile=CLIENT_KEY_FILE)
|
|
|
|
|
2022-05-11 05:18:12 -04:00
|
|
|
conn = http.client.HTTPSConnection(got_ip, got_port, context=ssl_context)
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Performing SSL handshake with the server')
|
2022-05-11 05:18:12 -04:00
|
|
|
conn.request('GET','/')
|
|
|
|
resp = conn.getresponse()
|
2022-05-10 02:46:56 -04:00
|
|
|
dut.expect('performing session handshake')
|
2022-05-11 05:18:12 -04:00
|
|
|
got_resp = resp.read().decode('utf-8')
|
|
|
|
if got_resp != success_response:
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Response obtained does not match with correct response')
|
2022-05-11 05:18:12 -04:00
|
|
|
raise RuntimeError('Failed to test SSL connection')
|
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
current_cipher = dut.expect(r'Current Ciphersuite(.*)', timeout=5)[0]
|
|
|
|
logging.info('Current Ciphersuite {}'.format(current_cipher))
|
2022-05-11 05:18:12 -04:00
|
|
|
|
|
|
|
# Close the connection
|
|
|
|
conn.close()
|
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Checking user callback: Obtaining client certificate...')
|
|
|
|
|
2022-07-14 10:55:50 -04:00
|
|
|
serial_number = dut.expect(r'serial number\s*:([^\n]*)', timeout=5)[0]
|
|
|
|
issuer_name = dut.expect(r'issuer name\s*:([^\n]*)', timeout=5)[0]
|
2022-05-10 02:46:56 -04:00
|
|
|
expiry = dut.expect(r'expires on ((.*)\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])*)', timeout=5)[1].decode()
|
2022-05-11 05:18:12 -04:00
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Serial No. {}'.format(serial_number))
|
|
|
|
logging.info('Issuer Name {}'.format(issuer_name))
|
|
|
|
logging.info('Expires on {}'.format(expiry))
|
2022-05-11 05:18:12 -04:00
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Correct response obtained')
|
|
|
|
logging.info('SSL connection test successful\nClosing the connection')
|
2022-05-11 05:18:12 -04:00
|
|
|
|
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
@pytest.mark.esp32
|
|
|
|
@pytest.mark.esp32c3
|
|
|
|
@pytest.mark.esp32s2
|
|
|
|
@pytest.mark.esp32s3
|
2022-07-03 04:22:20 -04:00
|
|
|
@pytest.mark.wifi_router
|
2022-05-10 02:46:56 -04:00
|
|
|
@pytest.mark.parametrize('config', ['dynamic_buffer',], indirect=True)
|
|
|
|
def test_examples_protocol_https_server_simple_dynamic_buffers(dut: Dut) -> None:
|
2022-05-11 05:18:12 -04:00
|
|
|
# Test with mbedTLS dynamic buffer feature
|
|
|
|
|
|
|
|
# start test
|
2022-07-04 04:54:33 -04:00
|
|
|
logging.info('Waiting to connect with AP')
|
|
|
|
if dut.app.sdkconfig.get('EXAMPLE_WIFI_SSID_PWD_FROM_STDIN') is True:
|
|
|
|
dut.expect('Please input ssid password:')
|
2022-07-06 12:34:06 -04:00
|
|
|
env_name = 'wifi_router'
|
|
|
|
ap_ssid = get_env_config_variable(env_name, 'ap_ssid')
|
|
|
|
ap_password = get_env_config_variable(env_name, 'ap_password')
|
|
|
|
dut.write(f'{ap_ssid} {ap_password}')
|
2022-05-11 05:18:12 -04:00
|
|
|
# Parse IP address and port of the server
|
2022-05-10 02:46:56 -04:00
|
|
|
dut.expect(r'Starting server')
|
|
|
|
got_port = int(dut.expect(r'Server listening on port (\d+)', timeout=30)[1].decode())
|
2022-07-14 10:55:50 -04:00
|
|
|
got_ip = dut.expect(r'IPv4 address: (\d+\.\d+\.\d+\.\d+)[^\d]', timeout=30)[1].decode()
|
2022-05-11 05:18:12 -04:00
|
|
|
|
|
|
|
# Expected logs
|
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Got IP : {}'.format(got_ip))
|
|
|
|
logging.info('Got Port : {}'.format(got_port))
|
|
|
|
|
|
|
|
logging.info('Performing GET request over an SSL connection with the server')
|
2022-05-11 05:18:12 -04:00
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
CLIENT_CERT_FILE = 'client_cert.pem'
|
|
|
|
CLIENT_KEY_FILE = 'client_key.pem'
|
2022-05-11 05:18:12 -04:00
|
|
|
|
|
|
|
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
|
|
|
|
ssl_context.verify_mode = ssl.CERT_REQUIRED
|
|
|
|
ssl_context.check_hostname = False
|
|
|
|
ssl_context.load_verify_locations(cadata=server_cert_pem)
|
|
|
|
|
|
|
|
ssl_context.load_cert_chain(certfile=CLIENT_CERT_FILE, keyfile=CLIENT_KEY_FILE)
|
|
|
|
|
2021-10-08 04:49:57 -04:00
|
|
|
os.remove(CLIENT_CERT_FILE)
|
|
|
|
os.remove(CLIENT_KEY_FILE)
|
|
|
|
|
2021-01-20 23:14:11 -05:00
|
|
|
conn = http.client.HTTPSConnection(got_ip, got_port, context=ssl_context)
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Performing SSL handshake with the server')
|
2021-01-20 23:14:11 -05:00
|
|
|
conn.request('GET','/')
|
|
|
|
resp = conn.getresponse()
|
2022-05-10 02:46:56 -04:00
|
|
|
dut.expect('performing session handshake')
|
2021-01-20 23:14:11 -05:00
|
|
|
got_resp = resp.read().decode('utf-8')
|
|
|
|
if got_resp != success_response:
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Response obtained does not match with correct response')
|
2021-01-20 23:14:11 -05:00
|
|
|
raise RuntimeError('Failed to test SSL connection')
|
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
current_cipher = dut.expect(r'Current Ciphersuite(.*)', timeout=5)[0]
|
|
|
|
logging.info('Current Ciphersuite {}'.format(current_cipher))
|
2022-05-11 05:18:12 -04:00
|
|
|
|
2022-03-30 09:16:07 -04:00
|
|
|
# Close the connection
|
|
|
|
conn.close()
|
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Checking user callback: Obtaining client certificate...')
|
2021-10-08 04:49:57 -04:00
|
|
|
|
2022-07-06 12:34:06 -04:00
|
|
|
serial_number = dut.expect(r'serial number\s*:([^\n]*)', timeout=5)[0]
|
|
|
|
issuer_name = dut.expect(r'issuer name\s*:([^\n]*)', timeout=5)[0]
|
|
|
|
expiry = dut.expect(r'expires on\s*:((.*)\d{4}\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01])*)', timeout=5)[1].decode()
|
2021-01-20 23:14:11 -05:00
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Serial No. : {}'.format(serial_number))
|
|
|
|
logging.info('Issuer Name : {}'.format(issuer_name))
|
|
|
|
logging.info('Expires on : {}'.format(expiry))
|
2021-01-20 23:14:11 -05:00
|
|
|
|
2022-05-10 02:46:56 -04:00
|
|
|
logging.info('Correct response obtained')
|
|
|
|
logging.info('SSL connection test successful\nClosing the connection')
|