-
Notifications
You must be signed in to change notification settings - Fork 55
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
Use CA-signed TLS keys for testing #621
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
64169dd
Use CA-signed TLS keys for testing
richvdh 25eedec
Use a CA-signed cert for the test server too
richvdh 814cdc1
missing file
richvdh 2ec41b6
Merge remote-tracking branch 'origin/develop' into rav/enable_tls_ver…
richvdh 6497a8a
remove dead key/cert files
richvdh 238dbd4
Use the CA cert for the test_server too
richvdh 8403085
add some comments about the config
richvdh 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 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 |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
/results.tap | ||
/server-* | ||
/synapse | ||
/test-server | ||
/var | ||
\#* | ||
.vscode | ||
|
This file contains 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,21 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDZDCCAkygAwIBAgIJAKccGMVr5gLXMA0GCSqGSIb3DQEBCwUAMEcxCzAJBgNV | ||
BAYTAkdCMQ8wDQYDVQQIDAZMb25kb24xEzARBgNVBAoMCm1hdHJpeC5vcmcxEjAQ | ||
BgNVBAMMCXN5dGVzdCBDQTAeFw0xOTA2MDUxNTI2MDlaFw0yOTA2MDIxNTI2MDla | ||
MEcxCzAJBgNVBAYTAkdCMQ8wDQYDVQQIDAZMb25kb24xEzARBgNVBAoMCm1hdHJp | ||
eC5vcmcxEjAQBgNVBAMMCXN5dGVzdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP | ||
ADCCAQoCggEBALbZ+4WFsg4j/O+sFvL2vznFf6WvJEOd905KN9vwsz3Jp0d5BF6z | ||
WqzakQ2o2KXbfvF7ElkEQPH0GOvjCmsoyDOeRHj8nE5rms5bZimi76kakr0RrY2P | ||
OCg0+Oayan7RHb6QcFllbL9aJckJ9qD9UqRiIvUbd6ZT0x3CYObWGsiUWNsBiK72 | ||
AkVtnlq6qseC90lFvx3YGOevetxJWyyCYPO5+hvYPNSa8TjjaQtVwAQumcTevS+K | ||
G6zvFdoxEhL1e+5RJyeNIN7hrG+Ht3G5qmn0cEId6E/CSEBe/m9o1hqd3jGY4Boh | ||
J8GPsEfdfK3r68u4cgna+0WjZQhlwxGwWYcCAwEAAaNTMFEwHQYDVR0OBBYEFEzx | ||
D0cBAWPq+0Lr0bbIDmThuR11MB8GA1UdIwQYMBaAFEzxD0cBAWPq+0Lr0bbIDmTh | ||
uR11MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHh1w9FRwLGE | ||
rqPd8IhEHaq5oZXXp08uhV6dhnsOcU3LoD8dZyllBIEFSSF5Lwi6tNcefS16QZzV | ||
phzJ595bnfNlIltss/LsWqVKoXPOmyD7u0fOYJGAAVII0U2nS/8nNlvyoPxCcorW | ||
xmUSQjB9RKdlm6TdcDj6FwRTRwmmGhBnTcC2PWrqslXFo9hslYKFDiL/4RL+NKIC | ||
V4mIhTALOnNxU0L3yxdUzUiQmepDjUffPPk7rYbMJe8q38jm1EWlERuMKz6bY4rf | ||
QK9vBctMWiEdwnG+RfO4VP73dSc7UFodKSzBBt7TwLgtqntOUzfbIPlKjlVmnK0X | ||
Kz5XuJVplBQ= | ||
-----END CERTIFICATE----- |
This file contains 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,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEpQIBAAKCAQEAttn7hYWyDiP876wW8va/OcV/pa8kQ533Tko32/CzPcmnR3kE | ||
XrNarNqRDajYpdt+8XsSWQRA8fQY6+MKayjIM55EePycTmuazltmKaLvqRqSvRGt | ||
jY84KDT45rJqftEdvpBwWWVsv1olyQn2oP1SpGIi9Rt3plPTHcJg5tYayJRY2wGI | ||
rvYCRW2eWrqqx4L3SUW/HdgY56963ElbLIJg87n6G9g81JrxOONpC1XABC6ZxN69 | ||
L4obrO8V2jESEvV77lEnJ40g3uGsb4e3cbmqafRwQh3oT8JIQF7+b2jWGp3eMZjg | ||
GiEnwY+wR918revry7hyCdr7RaNlCGXDEbBZhwIDAQABAoIBAGwdS0jRmkweH0of | ||
OJqEJuEj06vFeO26EyXpYEndcj3QY+YwudK8vZqCyU2ITkETHWXu3RRhHX1yVOH0 | ||
po5h2K4coGPhCRKdMTVeeXOY8ZfNLII6V6Hh0tSDLcBKMgm1355zjNpuy/QAe2L5 | ||
Tyg1YI3tsLm4efCQk71+1wjmA4QgotU/V7Cc8VrfqICiw3oXJcdmxw94NYxQJQVr | ||
oWpuLhqU1Mf3blryMg1X8J5TuFRnZCEf1nhRvryLa9XYPIGBtB/WUVVJroYNTIdx | ||
uBhA05ANkNDg4aByNg2xaQAt2Llri/rFaZXlDtifjtMIoNgmKfWCzAH+bHymo7D0 | ||
hD0Rq6ECgYEA3WmiFWAJ68kDTdA2Y7YzNA7O7jIx+UB1E6lpyCyt8I+rrRHBEF2Q | ||
W5DIuwUtYro+A8X4wmJo0mPm5bso4ct1wnT2sxtkjjJEUlfSo6cJQq80cYwvCnYZ | ||
IDtidLp4JJv4IOA62Pxc3WwpQ0J82HSy2F0wQDHIscvb1Se9RB7QXikCgYEA02pG | ||
v9MS0KgyN3zLGRgjdeqCWRCLTtVDkGZBBu3PY18AmnY11rX1IipsUpNmwFu9Sjde | ||
2qB4D8fjVa1ZAnVpkaPh+8lIAffjxdolkzQ25oqHVRE5F+Yig3d0EgpNnRyvZvFn | ||
72P2cRAOXZI7DTVHYn/7M/dRLWDClBhcxy+4kC8CgYEAj/VlmEZITRD2X/qX0n8d | ||
jaRvMPpb+bbKKI2HJMrAEWAofC/F+pELEi3yBX9ZQg7b0XI/yotXoiuobgghjaXP | ||
HC8WU9/konvWZj+JyjQJ1ly6WXWPBFtC/Oz/l+vBv/PVAfMo7/otmx3/OicZq1c9 | ||
DWaRv7texRNKDK545bivO/kCgYEApnS237HAzqifYTDQeCGZSe4qUxXDmX4whDD+ | ||
YgY7k3Hpd7Q7D6KULyJXx2xnKm0QzK5r8JcH8OThCURDILxxMkpmU2hXWbVjkRQB | ||
IbWqxDmt9DxrR3XbFsemi82w7lL3h4Xq34FFOB/8L5BDDlM0sUky7+d58tCMYy4L | ||
XokkN+ECgYEA1n/bRkP5IDFKeK/bc6j4juCdgQR1+yXJb/C8t+KmPJ1H87w4aYOQ | ||
3RPkfBwWOHgJPlgoXOyS1ld2hyGqIurfSUrUpTU4aZnn1Uh22nGq7P7O8UKVNYGs | ||
OCOLYzSR5S2LimawXM8rYnihf9C4K9ev1vCQ418zR3iTk0M7X6tPLNY= | ||
-----END RSA PRIVATE KEY----- |
This file contains 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 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,58 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 The Matrix.org Foundation C.I.C. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
package SyTest::SSL; | ||
|
||
use Exporter 'import'; | ||
our @EXPORT_OK = qw( | ||
ensure_ssl_cert | ||
); | ||
|
||
=head2 ensure_ssl_cert | ||
ensure_ssl_cert( $cert_file, $key_file, $server_name ); | ||
Ensure that an SSL certificate file and key file exist. If they do not, | ||
generate a key and/or certificate. The certificate will be signed by the test CA. | ||
=cut | ||
|
||
sub ensure_ssl_cert | ||
{ | ||
my ( $cert_file, $key_file, $server_name ) = @_; | ||
|
||
if ( ! -e $key_file ) { | ||
# todo: we can do this in pure perl | ||
system("openssl", "genrsa", "-out", $key_file, "2048") == 0 | ||
or die "openssl genrsa failed $?"; | ||
} | ||
|
||
if ( ! -e $cert_file ) { | ||
# generate a CSR | ||
my $csr_file = "$cert_file.csr"; | ||
system( | ||
"openssl", "req", "-new", "-key", $key_file, "-out", $csr_file, | ||
"-subj", "/CN=$server_name", | ||
) == 0 or die "openssl req failed $?"; | ||
|
||
# sign it with the CA | ||
system( | ||
"openssl", "x509", "-req", "-in", $csr_file, | ||
"-CA", "keys/ca.crt", "-CAkey", "keys/ca.key", "-set_serial", 1, | ||
"-out", $cert_file, | ||
) == 0 or die "openssl x509 failed $?"; | ||
} | ||
} | ||
|
This file contains 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 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 was deleted.
Oops, something went wrong.
This file was deleted.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not turn this off then? Or what? I'm a bit confused about what has real certs and what doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this setting controls synapse's 'simple http client', which is used for non-federation requests, including (it turns out) some to IS servers. There's no way to set a custom CA for that, hence the setting.
This should probably be in a comment in the sytest code...