Summary: | ASTERISK-28798: [patch] chan_sip: TCP/TLS client without server. | ||
Reporter: | Alexander Traud (traud) | Labels: | patch |
Date Opened: | 2020-04-01 11:47:34 | Date Closed: | 2020-11-19 15:38:33.000-0600 |
Priority: | Minor | Regression? | |
Status: | Closed/Complete | Components: | Channels/chan_sip/TCP-TLS |
Versions: | 13.32.0 16.9.0 17.3.0 | Frequency of Occurrence | |
Related Issues: | |||
Environment: | Attachments: | ( 0) client_without_server.patch | |
Description: | The channel driver {{chan_sip}} can be configured for various SIP transports like UDP, TCP, and TLS. Because it is a back-to-back user agent (B2BUA), it can be configured as client and/or server. For example, when you add just
{code}register => tcp://user:secret@host{code} to the {{\[general\]}} context in the configuration file {{sip.conf}} (just that, nothing else; the file is empty), a client connection to a remote VoIP/SIP server like a PSTN service is established. However in the SIP-REGISTER message, the headers Via and Contact do not contain the local IP address but the value {{(null)}}. Such a value is rejected by a remote party normally. Currently, the source code expects that the local server also has TCP enabled. Consequently, for a client connect you have to write at least: {code}tcpenable=yes register => tcp://user:secret@host{code} In case of TLS, something like {code} tlscapath=/etc/ssl/certs/ register => tls://user:secret@host {code}should be sufficient. However, that gives the same, the value {{(null)}} in the SIP-REGISTER for the Via and Contact headers. Again, the TLS server must be enabled locally which requires a public certificate with private key: {code} tlsenable=yes tlscertfile=asterisk.pem tlscapath=/etc/ssl/certs/ register => tls://user:secret@host {code}Consequently, I have to create a (server) certificate locally, do create a remote TLS client connection successfully. This is counter-intuitive. The situation is even worse because there is no log message and the SIP-REGISTER is sent with wrong information. Only at debug level 3, one can see that the local bind address is null. The cause for this is the function {{ast_sip_ouraddrfor(.)}} which does not check whether the {{local_address}} is null. See the attached patch. However, there are two more places in code which do not check for null: 1. function {{get_address_family_filter(.)}} 2. {{p->socket.port}} in function {{transmit_register(.)}} I have no idea what to do with those. | ||
Comments: | By: Asterisk Team (asteriskteam) 2020-04-01 11:47:35.815-0500 Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report. Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process]. Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur. By: Friendly Automation (friendly-automation) 2020-04-13 16:33:50.085-0500 Change 14107 merged by Friendly Automation: chan_sip: TCP/TLS client without server. [https://gerrit.asterisk.org/c/asterisk/+/14107|https://gerrit.asterisk.org/c/asterisk/+/14107] By: Friendly Automation (friendly-automation) 2020-04-13 16:40:08.306-0500 Change 14040 merged by Friendly Automation: chan_sip: TCP/TLS client without server. [https://gerrit.asterisk.org/c/asterisk/+/14040|https://gerrit.asterisk.org/c/asterisk/+/14040] By: Friendly Automation (friendly-automation) 2020-04-13 16:40:50.813-0500 Change 14105 merged by Friendly Automation: chan_sip: TCP/TLS client without server. [https://gerrit.asterisk.org/c/asterisk/+/14105|https://gerrit.asterisk.org/c/asterisk/+/14105] By: Friendly Automation (friendly-automation) 2020-04-13 16:49:25.215-0500 Change 14106 merged by Kevin Harwell: chan_sip: TCP/TLS client without server. [https://gerrit.asterisk.org/c/asterisk/+/14106|https://gerrit.asterisk.org/c/asterisk/+/14106] By: David A. (davea) 2020-06-25 02:10:24.090-0500 As of version 13.33.0 and 13.34.0 I've begun receiving these errors on the console every few minutes: [Jun 25 14:07:03] ERROR[1713]: chan_sip.c:16202 transmit_register: TCP/TLS clients without server were not tested. [Jun 25 14:07:03] ERROR[1713]: chan_sip.c:16204 transmit_register: Please, follow-up and report at issue 28798. So I'm reporting at issue 28798 as requested. I have asterisk running at my location and also remotely on a server. Both are configured for TLS and SRTP. The server has a valid certificate from letsencrypt. The client has none. I've run sip debug on both client and server and found no problems with null values in Via and Contact headers, and the actual functioning of TLS and SRTP is working fine, both in prior versions and in the current version, despite the error messages. At very least, I'd like to request this ERROR be made a NOTICE so the console might become usable again. Thanks. By: Alexander Traud (traud) 2020-06-25 04:33:40.597-0500 You should report as soon as possible, do not wait for anyone else. Your case is not that easy because there is (at least) one severe bug: Asterisk as TCP client is using the wrong port in the header Contact. This is ignored (normally) because SIP registrars are re-using the current TCP connection. Therefore, they do not look into the Contact and use the correct port. I fixed just those null issues. First question: 1) With Asterisk 13.32 and earlier, did you see {{(null)}} in the Contact header from your client (in the SIP message or when going for debug level 3)? Second question: 2) Does the port in Contact match the port of your TCP/TLS client? This wrong Contact is still an issue which cannot be fixed that easily because the header Contact is created before the TCP clients gets its port assigned. In other words, in Digium Asterisk chan_sip, a TCP client is always sending the wrong port. To catch those who do not come via the network port but via the Contact port, you need a TCP/TLS server locally. Third question: 3. Do you get that error message A) on both server and client or B) just at the client? Question 1: Yes; Question 2: No, Question 3: B In that case, go for {{tlscertfile}} in {{sip.conf}} on your client. You can even use the dummy certificate which is created by the script which came with your Digium Asterisk. In all other cases, please, post the TLS relevant options from your {{sip.conf}}. Fourth Question: You mention that the console is not usable right now. Please, elaborate more on that because a level of NOTICE would be written all the time as well, even at debug level 0 and verbose level 0 like the level of ERROR. By: Asterisk Team (asteriskteam) 2020-06-25 04:33:43.999-0500 This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable. By: David A. (davea) 2020-06-25 06:19:16.653-0500 {quote}1) With Asterisk 13.32 and earlier, did you see (null) in the Contact header from your client (in the SIP message or when going for debug level 3)?{quote} No {quote}2) Does the port in Contact match the port of your TCP/TLS client?{quote} Yes {quote}Third question: 3. Do you get that error message A) on both server and client or B) just at the client?{quote} B) The error message is only on the client {quote}Fourth Question: You mention that the console is not usable right now. Please, elaborate more on that because a level of NOTICE would be written all the time as well, even at debug level 0 and verbose level 0 like the level of ERROR.{quote} I'm hoping I could find a way to supress the notices, perhaps by changing the console setting in logger.conf, but I haven't tried it. I usually keep the console running so I can check for connectivity or other issues, but it's not very useful with the errors being repeated constantly. My current solution is to continue running 13.32.0. Here are the TLS relevant options in sip.conf. I do specify the TLS port in tlsbindaddr. If I remove that port setting, I see the null port in the headers you've mentioned in 13.32.0 (though everything still works, even then). {code}tlsenable=yes tlsbindaddr=[::]:5778 tlscapath=/etc/ssl/certs tlsdisablev1=yes tlsdisablev11=yes tlscipher={cipher list} tlsservercipherorder=yes{code} Even with a self-signed certificate on the client and "tlscertfile" set to point to it, it doesn't help. The error messages are still repeated. By: Kevin Harwell (kharwell) 2020-06-25 12:02:14.157-0500 [~davea] Please create/open a new issue for your problem here on the issue tracker, so it can be separately tracked. Thanks! By: Alexander Traud (traud) 2020-06-26 02:57:41.512-0500 Digium has a hard to understand (or at least an unexplained) policy when it comes to issue tracking. The core developers match a change to an issue and that is a 1:1 relationship because they have some scripts which create the change logs automatically. Consequently, they get horrified when an already fixed issue report gets reopened. Semantically, in the world of Jira, this is exactly the correct report to raise your issue. To say it short, thanks for reporting. I see the issue in your case. You are using not the default but a custom port for TLS. Therefore, you did not face this issue (although there is still an issue, I come back later to that). Please, do me a favor and test with {{tcpenable=yes}}. With that as well, the error message vanishes, does it? By: Asterisk Team (asteriskteam) 2020-06-26 02:57:42.615-0500 This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable. By: David A. (davea) 2020-06-26 03:47:06.165-0500 I tested 13.34.0 with tcpenable=yes in sip.conf. Yes, that did it. The error message has stopped now. Thank you. By: Kevin Harwell (kharwell) 2020-06-26 09:39:21.657-0500 [~traud] {quote} Digium has a hard to understand (or at least an unexplained) policy when it comes to issue tracking. {quote} From a software perspective while an issue may be related, or even caused by another they are separate issues. The original issue here has been fixed, and marked as such. Any additional work, or related problems should get a new issue in JIRA, but linked back to this one. From a business/planning perspective it makes things easier to track and helps to break things into smaller "parts" in order to better evaluate a particular issue's business impact, and engineering effort. Having a separate issue for each problem, and potentially subsequent patch also helps to track each individual issue from initial report, to review and commit, and into a release. A side effect of that also, yes, helps to script reporting. It also allows us to easier keep up with any associated attachments, and other related documents. Overall you can think of it similar to the idea of "separation of concerns", and breaking up software into smaller easier to maintain pieces. Sure I can have one file, and one main function for my program but that's going to make things much harder in the long run. I hope that helps some. By: Friendly Automation (friendly-automation) 2020-11-19 15:38:34.814-0600 Change 15137 merged by Kevin Harwell: chan_sip: Remove unused sip_socket->port. [https://gerrit.asterisk.org/c/asterisk/+/15137|https://gerrit.asterisk.org/c/asterisk/+/15137] By: Friendly Automation (friendly-automation) 2020-11-19 15:38:47.311-0600 Change 15143 merged by Kevin Harwell: chan_sip: Remove unused sip_socket->port. [https://gerrit.asterisk.org/c/asterisk/+/15143|https://gerrit.asterisk.org/c/asterisk/+/15143] By: Friendly Automation (friendly-automation) 2020-11-19 15:39:01.545-0600 Change 15144 merged by Kevin Harwell: chan_sip: Remove unused sip_socket->port. [https://gerrit.asterisk.org/c/asterisk/+/15144|https://gerrit.asterisk.org/c/asterisk/+/15144] |