-
Notifications
You must be signed in to change notification settings - Fork 3
ssl: add ability to control kex groups and sig algs #17
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
Open
huwcbjones
wants to merge
3
commits into
master
Choose a base branch
from
huw/ssl-ctx-options
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,8 @@ GST_DEBUG_CATEGORY (pex_rtmp_server_debug); | |
| #define DEFAULT_CA_CERT_FILE "" | ||
| #define DEFAULT_CA_CERT_DIR "" | ||
| #define DEFAULT_CIPHERS "!eNULL:!aNULL:!EXP:!DES:!RC4:!RC2:!IDEA:!ADH:ALL@STRENGTH" | ||
| #define DEFAULT_KEX_GROUPS "" | ||
| #define DEFAULT_SIG_ALGS "" | ||
| #define DEFAULT_STREAM_ID 1337 | ||
| #define DEFAULT_CHUNK_SIZE 128 | ||
| #define DEFAULT_TCP_SYNCNT -1 | ||
|
|
@@ -65,6 +67,8 @@ enum | |
| PROP_CA_CERT_FILE, | ||
| PROP_CA_CERT_DIR, | ||
| PROP_CIPHERS, | ||
| PROP_KEX_GROUPS, | ||
| PROP_TLS_SIG_ALGS, | ||
| PROP_TLS1_ENABLED, | ||
| PROP_IGNORE_LOCALHOST, | ||
| PROP_STREAM_ID, | ||
|
|
@@ -103,6 +107,8 @@ struct _PexRtmpServer | |
| gchar *ca_cert_file; | ||
| gchar *ca_cert_dir; | ||
| gchar *ciphers; | ||
| gchar *kex_groups; | ||
| gchar *tls_sig_algs; | ||
| gboolean tls1_enabled; | ||
| gboolean ignore_localhost; | ||
| gint stream_id; | ||
|
|
@@ -271,24 +277,29 @@ rtmp_server_create_client (PexRtmpServer * srv, gint listen_fd) | |
| #ifdef HAVE_OPENSSL | ||
| /* ssl connection */ | ||
| if (use_ssl) { | ||
| gchar *cert_file, *key_file, *ca_file, *ca_dir, *ciphers; | ||
| gchar *cert_file, *key_file, *ca_file, *ca_dir, *ciphers, *kex_groups, | ||
| *sig_algs; | ||
| gboolean tls1_enabled; | ||
|
|
||
| g_object_get (srv, | ||
| "cert-file", &cert_file, | ||
| "key-file", &key_file, | ||
| "ca-cert-file", &ca_file, | ||
| "ca-cert-dir", &ca_dir, | ||
| "ciphers", &ciphers, "tls1-enabled", &tls1_enabled, NULL); | ||
| "ciphers", &ciphers, | ||
| "kex-groups", &kex_groups, | ||
| "tls-sig-algs", &sig_algs, "tls1-enabled", &tls1_enabled, NULL); | ||
|
|
||
| client_add_incoming_ssl (client, cert_file, key_file, ca_file, ca_dir, | ||
| ciphers, tls1_enabled); | ||
| ciphers, kex_groups, sig_algs, tls1_enabled); | ||
|
|
||
|
camilo-celis marked this conversation as resolved.
|
||
| g_free (cert_file); | ||
| g_free (key_file); | ||
| g_free (ca_file); | ||
| g_free (ca_dir); | ||
| g_free (ciphers); | ||
| g_free (kex_groups); | ||
| g_free (sig_algs); | ||
| } | ||
|
huwcbjones marked this conversation as resolved.
|
||
| #endif /* HAVE_OPENSSL */ | ||
|
|
||
|
|
@@ -523,7 +534,8 @@ _establish_client_tcp_connection (PexRtmpServer * srv, Client * client) | |
| #ifdef HAVE_OPENSSL | ||
| if (client->use_ssl) { | ||
| if (!client_add_outgoing_ssl (client, srv->ca_cert_file, srv->ca_cert_dir, | ||
| srv->ciphers, srv->tls1_enabled)) { | ||
| srv->ciphers, srv->kex_groups, srv->tls_sig_algs, | ||
| srv->tls1_enabled)) { | ||
| /* Client logs warnings for us, so no need to do that here */ | ||
| GST_WARNING_OBJECT (srv, "Outgoing SSL failed"); | ||
| return PEX_RTMP_SERVER_STATUS_SSL_CONNECT_FAILED; | ||
|
|
@@ -982,6 +994,8 @@ pex_rtmp_server_init (PexRtmpServer * srv) | |
| srv->ca_cert_file = NULL; | ||
| srv->ca_cert_dir = NULL; | ||
| srv->ciphers = NULL; | ||
| srv->kex_groups = NULL; | ||
| srv->tls_sig_algs = NULL; | ||
| srv->tls1_enabled = DEFAULT_TLS1_ENABLED; | ||
| srv->ignore_localhost = DEFAULT_IGNORE_LOCALHOST; | ||
| g_mutex_init (&srv->direct_lock); | ||
|
|
@@ -1043,6 +1057,8 @@ pex_rtmp_server_finalize (GObject * obj) | |
| g_free (srv->ca_cert_file); | ||
| g_free (srv->ca_cert_dir); | ||
| g_free (srv->ciphers); | ||
| g_free (srv->kex_groups); | ||
| g_free (srv->tls_sig_algs); | ||
| g_free (srv->opaque); | ||
| g_free (srv->salt); | ||
| g_free (srv->username); | ||
|
|
@@ -1097,6 +1113,14 @@ pex_rtmp_server_set_property (GObject * obj, guint prop_id, | |
| g_assert (!srv->running); | ||
| srv->ciphers = g_value_dup_string (value); | ||
| break; | ||
| case PROP_KEX_GROUPS: | ||
| g_assert (!srv->running); | ||
| srv->kex_groups = g_value_dup_string (value); | ||
| break; | ||
| case PROP_TLS_SIG_ALGS: | ||
| g_assert (!srv->running); | ||
| srv->tls_sig_algs = g_value_dup_string (value); | ||
| break; | ||
|
camilo-celis marked this conversation as resolved.
|
||
| case PROP_TLS1_ENABLED: | ||
| g_assert (!srv->running); | ||
| srv->tls1_enabled = g_value_get_boolean (value); | ||
|
|
@@ -1157,6 +1181,12 @@ pex_rtmp_server_get_property (GObject * obj, guint prop_id, | |
| case PROP_CIPHERS: | ||
| g_value_set_string (value, srv->ciphers); | ||
| break; | ||
| case PROP_KEX_GROUPS: | ||
| g_value_set_string (value, srv->kex_groups); | ||
| break; | ||
| case PROP_TLS_SIG_ALGS: | ||
| g_value_set_string (value, srv->tls_sig_algs); | ||
| break; | ||
| case PROP_TLS1_ENABLED: | ||
| g_value_set_boolean (value, srv->tls1_enabled); | ||
| break; | ||
|
|
@@ -1236,6 +1266,16 @@ pex_rtmp_server_class_init (PexRtmpServerClass * klass) | |
| "Specification of ciphers to use", DEFAULT_CIPHERS, | ||
| G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | ||
|
|
||
| g_object_class_install_property (gobject_class, PROP_KEX_GROUPS, | ||
| g_param_spec_string ("kex-groups", "KeX groups", | ||
| "Key exchange groups to use", DEFAULT_KEX_GROUPS, | ||
| G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | ||
|
|
||
| g_object_class_install_property (gobject_class, PROP_TLS_SIG_ALGS, | ||
| g_param_spec_string ("tls-sig-algs", "TLS Sig Algs", | ||
| "List of enabled TLS signature algorithms", DEFAULT_SIG_ALGS, | ||
| G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | ||
|
huwcbjones marked this conversation as resolved.
Comment on lines
+1274
to
+1277
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add some coverage for this properties? |
||
|
|
||
| g_object_class_install_property (gobject_class, PROP_TLS1_ENABLED, | ||
| g_param_spec_boolean ("tls1-enabled", "TLS1 enabled", | ||
| "Whether TLS1 is enabled", DEFAULT_TLS1_ENABLED, | ||
|
|
||
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
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.