-
Notifications
You must be signed in to change notification settings - Fork 83
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
sip/transp: add client certificate to all TLS transports #1173
Conversation
src/sip/transp.c
Outdated
@@ -47,6 +47,12 @@ struct sip_ccert { | |||
}; | |||
|
|||
|
|||
struct ccert_data { |
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.
Perhaps add sip_
prefix to match the name of the module ?
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.
Done.
src/sip/transp.c
Outdated
static struct le *transp_apply_all(struct sip *sip, enum sip_transp tp, int af, | ||
list_apply_h ah, void *arg) | ||
{ | ||
struct le *le; |
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 can be moved to for-loop
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.
Done.
src/sip/transp.c
Outdated
@@ -1401,6 +1434,27 @@ int sip_transp_add_websock(struct sip *sip, enum sip_transp tp, | |||
} | |||
|
|||
|
|||
static bool add_ccert(struct le *le, void *arg) |
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.
add _handler
suffix
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.
Done.
(void)transp_apply_all(sip, SIP_TRANSP_TLS, AF_INET, add_ccert, | ||
&cc_data); | ||
(void)transp_apply_all(sip, SIP_TRANSP_TLS, AF_INET6, add_ccert, | ||
&cc_data); |
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.
what about WSS
transport ?
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.
I tried to change the behavior as little as possible. Before this change, the sip_transp_add_ccert
function did not consider WSS either and when adding the WSS transport with sip_transp_add_websock
, the hash table for the certs is not even allocated.
It would probably make sense, but maybe add that support in a different PR.
Currently, when a client certificate is added to a SIP transport, it is only added to the first matching transport in the transport list. Then, if multiple SIP transports exist (e.g if there are multiple network interfaces), the certificate might not be present in the transport when it is needed. Now, the certificate is added to all matching transports.
aa8fad4
to
353dd54
Compare
Please merge to main if you agree @sreimers |
Currently, when a client certificate is added to a SIP transport, it is only added to the first matching transport in the transport list. Then, if multiple SIP transports exist (e.g if there are multiple network interfaces), the certificate might not be present in the transport when it is needed.
Now, the certificate is added to all matching transports.
This BareSIP PR tests the fix: