coova / coova-chilli

CoovaChilli is an open-source software access controller for captive portal hotspots.
Other
516 stars 258 forks source link

Compile on Ubuntu 18.04 Server #447

Closed heruan closed 4 years ago

heruan commented 6 years ago

I'm on the Ubuntu 18.04.1 Server image for Rasberry Pi 2 provided by Ubuntu here and I'm trying to compile CoovaChilli as described in http://coova.github.io/CoovaChilli/DistroBuilding/

This is the output of debuild -b (only the error part):

libtool: compile:  arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I. -I.. -I../json -D_GNU_SOURCE -Wall -Werror -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -funroll-loops -pipe -I../bstring -DDEFCHILLICONF=\"/etc/chilli.conf\" -DDEFPIDFILE=\"/var/run/chilli.pid\" -DDEFSTATEDIR=\"/var/run\" -DSBINDIR=\"/usr/sbin\" -I../json -DDEFLIBDIR=\"/usr/lib/coova-chilli\" -MT ms_chap.lo -MD -MP -MF .deps/ms_chap.Tpo -c ms_chap.c  -fPIC -DPIC -o .libs/ms_chap.o
ms_chap.c: In function ‘MakeKey’:
ms_chap.c:99:3: error: implicit declaration of function ‘des_set_odd_parity’; did you mean ‘DES_set_odd_parity’? [-Werror=implicit-function-declaration]
   des_set_odd_parity((des_cblock *)des_key);
   ^~~~~~~~~~~~~~~~~~
   DES_set_odd_parity
ms_chap.c:99:23: error: ‘des_cblock’ undeclared (first use in this function); did you mean ‘DES_cblock’?
   des_set_odd_parity((des_cblock *)des_key);
                       ^~~~~~~~~~
                       DES_cblock
ms_chap.c:99:23: note: each undeclared identifier is reported only once for each function it appears in
ms_chap.c:99:35: error: expected expression before ‘)’ token
   des_set_odd_parity((des_cblock *)des_key);
                                   ^
ms_chap.c: In function ‘DesEncrypt’:
ms_chap.c:105:3: error: unknown type name ‘des_cblock’; did you mean ‘DES_cblock’?
   des_cblock  des_key;
   ^~~~~~~~~~
   DES_cblock
ms_chap.c:106:3: error: unknown type name ‘des_key_schedule’; did you mean ‘DES_key_schedule’?
   des_key_schedule key_schedule;
   ^~~~~~~~~~~~~~~~
   DES_key_schedule
ms_chap.c:108:16: error: passing argument 2 of ‘MakeKey’ makes pointer from integer without a cast [-Werror=int-conversion]
   MakeKey(key, des_key);
                ^~~~~~~
ms_chap.c:88:1: note: expected ‘u_char * {aka unsigned char *}’ but argument is of type ‘int’
 MakeKey(u_char *key, u_char *des_key)
 ^~~~~~~
ms_chap.c:109:3: error: implicit declaration of function ‘des_set_key’; did you mean ‘DES_set_key’? [-Werror=implicit-function-declaration]
   des_set_key(&des_key, key_schedule);
   ^~~~~~~~~~~
   DES_set_key
ms_chap.c:110:3: error: implicit declaration of function ‘des_ecb_encrypt’; did you mean ‘DES_ecb_encrypt’? [-Werror=implicit-function-declaration]
   des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
   ^~~~~~~~~~~~~~~
   DES_ecb_encrypt
ms_chap.c:110:20: error: ‘des_cblock’ undeclared (first use in this function); did you mean ‘DES_cblock’?
   des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
                    ^~~~~~~~~~
                    DES_cblock
ms_chap.c:110:32: error: expected expression before ‘)’ token
   des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
                                ^
cc1: all warnings being treated as errors
Makefile:938: recipe for target 'ms_chap.lo' failed
make[4]: *** [ms_chap.lo] Error 1
make[4]: Leaving directory '/home/ubuntu/src/coova-chilli/src'
Makefile:981: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/ubuntu/src/coova-chilli/src'
Makefile:417: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/ubuntu/src/coova-chilli'
Makefile:345: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/ubuntu/src/coova-chilli'
debian/rules:34: recipe for target 'build' failed
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
debuild: fatal error at line 1152:
dpkg-buildpackage -rfakeroot -us -uc -ui -b failed

Am I missing some dependency? Or maybe a library version mismatch?

yoanbosch commented 6 years ago

Hi, did you manage to find a solution to your issue? I am getting he same errors except I'm using a PC with Ubuntu 18.04

heruan commented 6 years ago

Not yet, unfortunately; I was hoping for a feedback from the maintainers.

yoanbosch commented 6 years ago

Hi, the problem is OpenSSL 1.1 - CoovaChilli needs OpenSSL 1.0

apt install openssl1.0 mv /usr/bin/openssl /root/ ln -s /usr/lib/ssl1.0/openssl /usr/bin/openssl apt remove libssl-dev apt install libssl1.0-dev

heruan commented 6 years ago

Thank you @yoanbosch for the workaround. I'll leave this open to keep track on updating CoovaChilli to OpenSSL 1.1.

heruan commented 6 years ago

I'll just add that this command is sufficient for a successful build:

$ sudo apt install libssl1.0-dev

No need to install openssl1.0, nor to move or link binaries.

norterj commented 5 years ago

I'll just add that this command is sufficient for a successful build:

$ sudo apt install libssl1.0-dev

No need to install openssl1.0, nor to move or link binaries.

Hello does anyone have successfully compile and create deb package in Ubuntu 18.04?

I've compiled before in 16.04 and need for compilation the following packages: build-essential libtool openssl libcurl3 libssl-dev libcurl4-openssl-dev libc-ares-dev libc-ares2 gengetopt debhelper libjson0-dev haserl m4 automake subversion devscripts

When I try to install them on 18.04 I have the following problems:

Anyone has suggestions?

Philippe2705 commented 5 years ago

HI ! If anyone has this issue and 'sudo apt install libssl1.0-dev' didn't helped, the following solved my issue: go to the build_dir/target-xxxx/coova-chilli-xxxx/src And open ms_chap.c as root.

norterj commented 5 years ago

Thanks Philippe2705!! That almost work!!!

The final "catch" for the ones compiling this is:

In the end it works like charm! Once again thanks for your help Philippe2705!!

HI ! If anyone has this issue and 'sudo apt install libssl1.0-dev' didn't helped, the following solved my issue: go to the build_dir/target-xxxx/coova-chilli-xxxx/src And open ms_chap.c as root.

* Replace des_set_odd_parity by DES_set_odd_parity

* Replace des_cblock by DES_cblock

* Replace des_key_schedule by DES_key_schedule

* Replace des_set_key(&des_key, key_schedule) by DES_set_key(&des_key, &key_schedule)

* Replace des_ecb_encrypt by DES_ecb_encrypt
  And I think it is all.
heruan commented 5 years ago

@sevan Any chance for an upcoming 1.5 (or 2.0?) release with up-to-date libraries?

timwhite commented 5 years ago

Thanks @Philippe2705 and @norterj The patch for others trying at home is as follows:

diff --git a/src/ms_chap.c b/src/ms_chap.c
index 2c236d2..8ad8327 100644
--- a/src/ms_chap.c
+++ b/src/ms_chap.c
@@ -96,18 +96,18 @@ MakeKey(u_char *key, u_char *des_key)
   des_key[6] = Get7Bits(key, 42);
   des_key[7] = Get7Bits(key, 49);

-  des_set_odd_parity((des_cblock *)des_key);
+  DES_set_odd_parity((DES_cblock *)des_key);
 }

 static void /* IN 8 octets IN 7 octest OUT 8 octets */
 DesEncrypt(u_char *clear, u_char *key, u_char *cipher)
 {
-  des_cblock           des_key;
-  des_key_schedule     key_schedule;
+  DES_cblock           des_key;
+  DES_key_schedule     key_schedule;

   MakeKey(key, des_key);
-  des_set_key(&des_key, key_schedule);
-  des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
+  DES_set_key(&des_key, &key_schedule);
+  DES_ecb_encrypt((DES_cblock *)clear, (DES_cblock *)cipher, &key_schedule, 1);
 }

 #define LENGTH 20
timwhite commented 5 years ago

It also seems this is fixed in #329 (db570308776ecf48e69f239bb66b1ee2b4b59a65) so you should be able to just cherry-pick that commit if you need

sevan commented 4 years ago

Try v1.5