-
Notifications
You must be signed in to change notification settings - Fork 729
test: add sslv2 client hello test w/ jvm #5019
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c632724
test: java cli sslv2 client hello test
jmayclin 9020fc7
address pr feedback
jmayclin 668ee8b
Merge branch 'main' into integv2-sslv2
jmayclin 0adf476
add to buildspec
jmayclin 184aaa0
various bug fixes
jmayclin 08c0328
remove unused imports
jmayclin 6cfd550
Merge branch 'main' into integv2-sslv2
jmayclin f170e18
fix bugs
jmayclin 065d813
manual autopep8
jmayclin 6d1dc73
address pr feedback
jmayclin ff2bf19
Update tests/integrationv2/bin/SSLSocketClient.java
jmayclin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import copy | ||
|
||
from configuration import available_ports | ||
from common import Certificates, Ciphers, Protocols, ProviderOptions, data_bytes | ||
from fixtures import managed_process # lgtm [py/unused-import] | ||
from providers import Provider, S2N, JavaSSL | ||
from utils import ( | ||
to_bytes, | ||
) | ||
|
||
SSLV2_CLIENT_HELLO_MARKER = "Warning: deprecated SSLv2-style ClientHello" | ||
|
||
|
||
def test_s2n_server_sslv2_client_hello(managed_process): | ||
# TLS 1.3: not supported by SSLv2 ClientHellos | ||
# TLS 1.2: supported | ||
# TLS 1.0 - TLS 1.1: not supported by Java | ||
TEST_PROTOCOL = Protocols.TLS12 | ||
|
||
port = next(available_ports) | ||
|
||
# s2nd can receive large amounts of data because all the data is | ||
# echo'd to stdout unmodified. This lets us compare received to | ||
# expected easily. | ||
# We purposefully send a non block aligned number to make sure | ||
# nothing blocks waiting for more data. | ||
random_bytes = data_bytes(65519) | ||
|
||
certificate = Certificates.RSA_2048_SHA256 | ||
|
||
client_options = ProviderOptions( | ||
mode=Provider.ClientMode, | ||
port=port, | ||
# The cipher must use RSA key exchange. ECDHE is not supported with | ||
# SSLv2 formatted client hellos. | ||
cipher=Ciphers.AES256_SHA256, | ||
cert=certificate.cert, | ||
data_to_send=random_bytes, | ||
insecure=True, | ||
protocol=TEST_PROTOCOL, | ||
extra_flags="SSLv2Hello", | ||
) | ||
|
||
server_options = copy.copy(client_options) | ||
server_options.mode = Provider.ServerMode | ||
server_options.data_to_send = None | ||
server_options.key = certificate.key | ||
server_options.cert = certificate.cert | ||
server_options.extra_flags = None | ||
|
||
# Passing the type of client and server as a parameter will | ||
# allow us to use a fixture to enumerate all possibilities. | ||
server = managed_process(S2N, server_options, timeout=5) | ||
client = managed_process(JavaSSL, client_options, timeout=5) | ||
|
||
# The client will be one of all supported providers. We | ||
# just want to make sure there was no exception and that | ||
# the client exited cleanly. | ||
for client_results in client.get_results(): | ||
client_results.assert_success() | ||
|
||
# The server is always S2N in this test, so we can examine | ||
# the stdout reliably. | ||
for server_results in server.get_results(): | ||
server_results.assert_success() | ||
assert SSLV2_CLIENT_HELLO_MARKER in server_results.stdout | ||
assert ( | ||
to_bytes("Actual protocol version: {}".format(TEST_PROTOCOL.value)) | ||
in server_results.stdout | ||
) | ||
assert random_bytes in server_results.stdout |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.