[Home]

Summary:ASTERISK-27878: [patch] tcptls.h: Repair ./configure --with-ssl=PATH.
Reporter:Alexander Traud (traud)Labels:patch
Date Opened:2018-05-28 08:55:39Date Closed:2018-06-05 14:21:42
Priority:MajorRegression?
Status:Closed/CompleteComponents:. I did not set the category correctly.
Versions:13.21.0 15.4.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) with-ssl_13.patch
( 1) with-ssl_15.patch
Description:With the upcoming [TLS 1.3|https://tools.ietf.org/html/draft-ietf-tls-tls13] and 3DES being [disabled|https://www.openssl.org/blog/blog/2016/08/24/sweet32/] in OpenSSL 1.1.x, using a custom build OpenSSL library for SIP-over-TLS might be interesting.

This is sequel 2 of a larger fix, which started in ASTERISK-27865. The underlying issue started with Commit [6a147ed|https://github.com/asterisk/asterisk/commit/6a147ed134fb434fb70b670d5e32c72216ba82e8] and got bigger over the years. When a source file includes a header from an optional package (for example OpenSSL), one has to specify either

A) {{xyz.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE)}} in its Makefile, or
B) {{<depend>openssl</depend>}} in its {{MODULEINFO}}, or
C) {{<use type="external">openssl</use>}} in its {{MODULEINFO}}.

The latter two alternatives work only for modules. Every source file which includes such a header explicitly, implicitly, or transitively needs one of those alternatives. Otherwise, the path of {{--with-ssl}} is not honored and those headers are searched within the system only.

*Steps to Reproduce* (Ubuntu 18.04 LTS)
{code}sudo apt install build-essential pkg-config libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxslt1-dev
sudo apt remove libssl-dev
cd ~/Downloads
wget www.openssl.org/source/openssl-1.1.1-pre6.tar.gz
tar -zxf ./openssl-*.tar.gz
cd ./openssl-*
./config shared enable-weak-ssl-ciphers
make
export SSL_HOME=$PWD
cd ~/Downloads
wget downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
tar -zxf ./asterisk-*.tar.gz
cd ./asterisk-*
LDFLAGS="-Wl,-rpath $SSL_HOME" ./configure --enable-dev-mode=noisy --with-crypto=$SSL_HOME --with-ssl=$SSL_HOME
make{code}*Expected Result*
Should build without any problem.

*Actual Result*
{{fatal error: 'openssl/ssl.h' file not found}}

*Workaround*
Install headers of OpenSSL in the system, for example in Ubuntu via
{{sudo apt install libssl-dev}}

*Notes*
Thanks to the 'noisy' developer mode (see the configure option), the cause was found quite fast.

Although one could go for one of the alternatives above, for each source file, those files do not use/need OpenSSL actually. They access OpenSSL only via pointers and do not need the definition of the underlying structs. Consequently, the solution is to remove the inclusion of any headers from external/optional packages. In this case here, remove any {{#include <openssl/....h}} from the header file {{asterisk/tcptls.h}}. The attached patch does this.

That is not the complete solution because similar happened for {{asterisk/crypto.h}}. As this is a sequel of fixes, this one here concentrates on {{asterisk/tcptls.h}}. However, on a first glance, I found no other headers affected than those two (even for other optional packages), except {{asterisk/xmpp.h}}. With that, nothing must be changed because all its source files went for alternative C.

The attached patch was tested with and without OpenSSL.
Comments:By: Asterisk Team (asteriskteam) 2018-05-28 08:55:41.120-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].

By: Friendly Automation (friendly-automation) 2018-06-05 14:21:43.810-0500

Change 9059 merged by George Joseph:
tcptls.h: Repair ./configure --with-ssl=PATH.

[https://gerrit.asterisk.org/9059|https://gerrit.asterisk.org/9059]

By: Friendly Automation (friendly-automation) 2018-06-05 14:22:20.084-0500

Change 9057 merged by George Joseph:
tcptls.h: Repair ./configure --with-ssl=PATH.

[https://gerrit.asterisk.org/9057|https://gerrit.asterisk.org/9057]

By: Friendly Automation (friendly-automation) 2018-06-05 14:22:53.190-0500

Change 9058 merged by George Joseph:
tcptls.h: Repair ./configure --with-ssl=PATH.

[https://gerrit.asterisk.org/9058|https://gerrit.asterisk.org/9058]