Skip to content

Commit 2615a5d

Browse files
author
Felipe Zimmerle
committed
mlogc: Checks if curl supports CURL_SSLVERSION_TLSv1_2 before use it
Seems like curl versions older than 7.34.0 does not have support for `CURL_SSLVERSION_TLSv1_2'. In this cases, using CURL_SSLVERSION_TLSv1 which was added at version 7.9.2. ModSecurity demands a curl version newer than 7.15.1.
1 parent 54bf71f commit 2615a5d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

build/find_curl.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ if test -n "${curl_path}"; then
6666
curl_ver=`echo ${CURL_VERSION} | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'`
6767
if test "$curl_min_ver" -le "$curl_ver"; then
6868
AC_MSG_RESULT([yes, $CURL_VERSION])
69+
curl_tlsv2_ver=`echo 7.34.0 | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'`
70+
if test "$curl_tlsv2_ver" -le "$curl_ver"; then
71+
CURL_CFLAGS="${CURL_CFLAGS} -DWITH_CURL_SSLVERSION_TLSv1_2"
72+
fi
6973
else
7074
AC_MSG_RESULT([no, $CURL_VERSION])
7175
AC_MSG_NOTICE([NOTE: curl library may be too old])

mlogc/mlogc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,14 @@ static void logc_init(void)
12181218
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
12191219
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
12201220
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
1221+
/* Seems like CURL_SSLVERSION_TLSv1_2 is not supported on libcurl
1222+
* < v7.34.0
1223+
*/
1224+
#ifdef WITH_CURL_SSLVERSION_TLSv1_2
12211225
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
1222-
1226+
#else
1227+
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
1228+
#endif
12231229
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15);
12241230
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, TRUE);
12251231
curl_easy_setopt(curl, CURLOPT_HEADER, TRUE);

0 commit comments

Comments
 (0)