cherokee / webserver

Cherokee Web Server
GNU General Public License v2.0
568 stars 104 forks source link

Unable con build from source on Fedora release 34 and Raspbian 10 (buster) // Autoconf version issue #1280

Open alsotoes opened 2 years ago

alsotoes commented 2 years ago

Why did you move to Autoconf version 2.71? Any particular reason?

$ ./autogen.sh
Checking for python2 binary ...
Generating a fresh po/admin/POTFILES.in file..
WARNING: I'm going to run ./configure with no arguments - if you wish 
to pass any to it, please specify them on the ./autogen.sh command line.

Running: aclocal -I m4...
m4/nls.m4:20: error: Autoconf version 2.71 or higher is required
m4/nls.m4:20: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
aclocal: error: echo failed with exit status: 63
$ uname -a
Linux lykan.headup.local 5.16.18-100.fc34.x86_64 #1 SMP PREEMPT Mon Mar 28 14:46:06 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release 
Fedora release 34 (Thirty Four)
$ sudo dnf install autoconf
Last metadata expiration check: 1:57:32 ago on Mon 04 Apr 2022 12:54:23 AM CDT.
Package autoconf-2.69-36.fc34.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
$ sudo dnf update autoconf --enablerepo=*
Dependencies resolved.
Nothing to do.
Complete!
skinkie commented 2 years ago

The reason was that there was another distribution (iirc archlinux or gentoo) not supporting the older version anymore. #1271

Please review the age of autoconf 2.69. Is there any reason that you (or your distribution) does not want to upgrade to a more recent version? https://ftp.gnu.org/gnu/autoconf/?C=M;O=D

alsotoes commented 2 years ago

Hi Stefan, the main reason is that version 2.71 will be available in fedora until the 36 release (it's beta now).

[1] - https://bugzilla.redhat.com/show_bug.cgi?id=1936597 [2] - https://fedoraproject.org/wiki/Changes/Autoconf_271

Personally, I need to build from the source a bare minimal version, to work only as a web directory listing to serve as a mirror. Cheers.

skinkie commented 2 years ago

@alsotoes have you tried marking the 2.71 to 2.69 and see if it 'just works'?

alsotoes commented 2 years ago

Hi Stefan, I manage to build the webserver by eliminating the 2.71 requirements from Cherokee's source code which I saw is not a hard requirement.

$ grep AC_PREREQ -R .
./configure.ac:dnl AC_PREREQ([2.71])
./m4/nls.m4:dnl AC_PREREQ([2.71])
./m4/po.m4:dnl AC_PREREQ([2.71])
./m4/progtest.m4:dnl AC_PREREQ([2.71])
$
$ cp /usr/share/libtool/build-aux/ltmain.sh .

Cheers.

skinkie commented 2 years ago

Hi Stefan, I manage to build the webserver by eliminating the 2.71 requirements from Cherokee's source code which I saw is not a hard requirement.

$ grep AC_PREREQ -R .
./configure.ac:dnl AC_PREREQ([2.71])
./m4/nls.m4:dnl AC_PREREQ([2.71])
./m4/po.m4:dnl AC_PREREQ([2.71])
./m4/progtest.m4:dnl AC_PREREQ([2.71])
$
$ cp /usr/share/libtool/build-aux/ltmain.sh .

Cheers.

So you just made 2.71 to 2.69 and that worked?

alsotoes commented 2 years ago

I just commented on the need for 2.71, and used 2.69, and worked... also copied ltmain.sh from libtool as the file is not present in the GitHub repo and the configure process was failing because of that.

It will be nice to have a --use-old-autoconf XD ... Either way, I'll continue testing

Cheers.

KenjiBrown commented 2 years ago

I have used this patch to compile Cherokee on Fedora 35 and 36

diff -uri webserver-1.2.104.orig.orig/admin/CTK/CTK-run.pre webserver-1.2.104/admin/CTK/CTK-run.pre
--- webserver-1.2.104.orig.orig/admin/CTK/CTK-run.pre   2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/admin/CTK/CTK-run.pre 2022-04-01 13:01:01.543214643 -0600
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # -*- Mode: python; coding: utf-8 -*-

 import os
diff -uri webserver-1.2.104.orig.orig/admin/CTK/setup.py webserver-1.2.104/admin/CTK/setup.py
--- webserver-1.2.104.orig.orig/admin/CTK/setup.py  2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/admin/CTK/setup.py    2022-04-01 13:01:01.558214554 -0600
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2

 from distutils.core import setup
 from distutils.extension import Extension
diff -uri webserver-1.2.104.orig.orig/admin/CTK/tests/run.py webserver-1.2.104/admin/CTK/tests/run.py
--- webserver-1.2.104.orig.orig/admin/CTK/tests/run.py  2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/admin/CTK/tests/run.py    2022-04-01 13:01:01.554214578 -0600
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2

 import os
 import sys
diff -uri webserver-1.2.104.orig.orig/admin/CTK/tests/test1_env.py webserver-1.2.104/admin/CTK/tests/test1_env.py
--- webserver-1.2.104.orig.orig/admin/CTK/tests/test1_env.py    2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/admin/CTK/tests/test1_env.py  2022-04-01 13:01:01.550214602 -0600
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2

 from pyscgi import ServerFactory, SCGIHandler

diff -uri webserver-1.2.104.orig.orig/admin/CTK/tests/test2_post.py webserver-1.2.104/admin/CTK/tests/test2_post.py
--- webserver-1.2.104.orig.orig/admin/CTK/tests/test2_post.py   2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/admin/CTK/tests/test2_post.py 2022-04-01 13:01:01.546214625 -0600
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2

 from pyscgi import SCGIHandler, ServerFactory

diff -uri webserver-1.2.104.orig.orig/cherokee/errors.py webserver-1.2.104/cherokee/errors.py
--- webserver-1.2.104.orig.orig/cherokee/errors.py  2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/cherokee/errors.py    2022-04-01 12:31:41.076769182 -0600
@@ -12,7 +12,7 @@
 SOURCE_DIRS = ['.', '../cget']

 #
-# Error reading
+# Error reading 
 #
 class CherokeeError:
     def __init__ (self, **kwargs):
@@ -33,7 +33,7 @@
     # Check dup. errors
     for err in _errors:
         if error_id == err.id:
-            raise ValueError, "ERROR: Duplicated error %s" %(error_id)
+            raise ValueError("ERROR: Duplicated error %s" %(error_id))

     # New error
     kwargs['id']    = error_id
@@ -80,13 +80,13 @@
                 found = True
                 break
         if not found:
-            print >> sys.stderr, "Undefined Error: CHEROKEE_ERROR_%s, used in %s" % (s, errors_seen[s])
+            print ("Undefined Error: CHEROKEE_ERROR_%s, used in %s" % (s, errors_seen[s]), file=sys.stderr)
             error_found = True

     # Unused errors in the definition file
     for def_e in _errors:
         if not def_e.__seen_in_grep:
-            print >> sys.stderr, "Unused Error: CHEROKEE_ERROR_%s" % (def_e.id)
+            print ("Unused Error: CHEROKEE_ERROR_%s" % (def_e.id), file=sys.stderr)
             error_found = True

     return error_found
@@ -134,8 +134,11 @@
                         break
                     for param in internal_params:
                         tmp = tmp.replace(param, '')
-
-                params_num = len (filter (lambda x: len(x), tmp.split(',')))
+                
+                params_filter = filter (lambda x: len(x), tmp.split(','))
+                params_num = 0
+                for item in params_filter :
+                    params_num += 1
                 source_errors_params[error] = params_num

     # Compare both
@@ -145,7 +148,7 @@
         source_num = source_errors_params[error.id]
         known_num  = known_errors_params[error.id]
         if source_num != known_num:
-            print >> sys.stderr, "ERROR: Parameter number mismatch: %s (source %d, definition %d)" % (error.id, source_num, known_num)
+            print ("ERROR: Parameter number mismatch: %s (source %d, definition %d)" % (error.id, source_num, known_num), file=sys.stderr)  
             error_found = True

     return error_found
@@ -243,14 +246,14 @@
         error = True

     if error:
-        print "USAGE:"
-        print
-        print " * Create the definitions file:"
-        print "    %s [--skip-tests] --defines output_file" %(sys.argv[0])
-        print
-        print " * Create the error list file:"
-        print "    %s [--skip-tests] --errors output_file" %(sys.argv[0])
-        print
+        print("USAGE:")
+        print("")
+        print(" * Create the definitions file:")
+        print("    %s [--skip-tests] --defines output_file" %(sys.argv[0]))
+        print("")
+        print(" * Create the error list file:")
+        print("    %s [--skip-tests] --errors output_file" %(sys.argv[0]))
+        print("")
         sys.exit(1)

     # Perform
Sólo en webserver-1.2.104.orig.orig/doc/build: asciidoc.py
diff -uri webserver-1.2.104.orig.orig/doc/build/build_web.sh webserver-1.2.104/doc/build/build_web.sh
--- webserver-1.2.104.orig.orig/doc/build/build_web.sh  2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/doc/build/build_web.sh    2022-04-01 12:31:41.079769164 -0600
@@ -1,7 +1,7 @@
 #!/bin/sh

 # Layout for cherokee-project.com
-ASCIIDOC_HTML="python2 asciidoc.py --conf-file=web.conf"
+ASCIIDOC_HTML="asciidoc.py --conf-file=web.conf"

 for i in ../*.txt
  do
diff -uri webserver-1.2.104.orig.orig/doc/Makefile.am webserver-1.2.104/doc/Makefile.am
--- webserver-1.2.104.orig.orig/doc/Makefile.am 2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/doc/Makefile.am   2022-04-01 12:31:41.079769164 -0600
@@ -1,4 +1,4 @@
-ASCIIDOC=$(PYTHON) $(top_srcdir)/doc/build/asciidoc.py --conf-file=$(top_srcdir)/doc/build/doc.conf
+ASCIIDOC=asciidoc.py --conf-file=$(top_srcdir)/doc/build/doc.conf

 SUFFIXES = .txt .html
KenjiBrown commented 2 years ago

This patch too, for OpenSSL

diff -puriN webserver-1.2.104.orig/cherokee/cryptor_libssl.c webserver-1.2.104/cherokee/cryptor_libssl.c
--- webserver-1.2.104.orig/cherokee/cryptor_libssl.c    2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/cherokee/cryptor_libssl.c 2022-03-18 05:44:45.000000000 -0600
@@ -238,13 +238,13 @@ cherokee_cryptor_libssl_find_vserver (SS
    /* SSL_set_SSL_CTX() only change certificates. We need to
     * changes more options by hand.
     */
-   SSL_set_options(ssl, SSL_CTX_get_options(ssl->ctx));
+   SSL_set_options(ssl, SSL_CTX_get_options(SSL_get_SSL_CTX(ssl)));

    if ((SSL_get_verify_mode(ssl) == SSL_VERIFY_NONE) ||
        (SSL_num_renegotiations(ssl) == 0)) {

-       SSL_set_verify(ssl, SSL_CTX_get_verify_mode(ssl->ctx),
-                      SSL_CTX_get_verify_callback(ssl->ctx));
+       SSL_set_verify(ssl, SSL_CTX_get_verify_mode(SSL_get_SSL_CTX(ssl)),
+                      SSL_CTX_get_verify_callback(SSL_get_SSL_CTX(ssl)));
    }

    return ret_ok;
@@ -792,9 +792,7 @@ _socket_init_tls (cherokee_cryptor_socke

    /* Disable Ciphers renegotiation (CVE-2009-3555)
     */
-   if (cryp->session->s3) {
-       cryp->session->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS;
-   }
+   SSL_set_options(cryp->session, SSL_OP_NO_RENEGOTIATION);

    return ret_ok;
 }
diff -puriN webserver-1.2.104.orig/cherokee/cryptor_libssl_dh_1024.c webserver-1.2.104/cherokee/cryptor_libssl_dh_1024.c
--- webserver-1.2.104.orig/cherokee/cryptor_libssl_dh_1024.c    2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/cherokee/cryptor_libssl_dh_1024.c 2022-03-18 05:08:11.000000000 -0600
@@ -23,9 +23,9 @@ static DH *get_dh1024()
    DH *dh;

    if ((dh=DH_new()) == NULL) return(NULL);
-   dh->p=BN_bin2bn(dh1024_p,sizeof(dh1024_p),NULL);
-   dh->g=BN_bin2bn(dh1024_g,sizeof(dh1024_g),NULL);
-   if ((dh->p == NULL) || (dh->g == NULL)) {
+   DH_set0_pqg(dh, BN_bin2bn(dh1024_p,sizeof(dh1024_p),NULL), 
+       NULL, BN_bin2bn(dh1024_g,sizeof(dh1024_g),NULL));
+   if ((DH_get0_p(dh) == NULL) || (DH_get0_g(dh) == NULL)) {
        DH_free(dh); return(NULL);
    }
    return(dh);
diff -puriN webserver-1.2.104.orig/cherokee/cryptor_libssl_dh_2048.c webserver-1.2.104/cherokee/cryptor_libssl_dh_2048.c
--- webserver-1.2.104.orig/cherokee/cryptor_libssl_dh_2048.c    2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/cherokee/cryptor_libssl_dh_2048.c 2022-03-18 05:09:20.000000000 -0600
@@ -34,9 +34,9 @@ static DH *get_dh2048()
    DH *dh;

    if ((dh=DH_new()) == NULL) return(NULL);
-   dh->p=BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL);
-   dh->g=BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL);
-   if ((dh->p == NULL) || (dh->g == NULL)) {
+   DH_set0_pqg(dh, BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL), 
+       NULL, BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL));
+   if ((DH_get0_p(dh) == NULL) || (DH_get0_g(dh) == NULL)) {
        DH_free(dh); return(NULL);
    }
    return(dh);
diff -puriN webserver-1.2.104.orig/cherokee/cryptor_libssl_dh_4096.c webserver-1.2.104/cherokee/cryptor_libssl_dh_4096.c
--- webserver-1.2.104.orig/cherokee/cryptor_libssl_dh_4096.c    2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/cherokee/cryptor_libssl_dh_4096.c 2022-03-18 05:10:34.000000000 -0600
@@ -55,9 +55,9 @@ static DH *get_dh4096()
    DH *dh;

    if ((dh=DH_new()) == NULL) return(NULL);
-   dh->p=BN_bin2bn(dh4096_p,sizeof(dh4096_p),NULL);
-   dh->g=BN_bin2bn(dh4096_g,sizeof(dh4096_g),NULL);
-   if ((dh->p == NULL) || (dh->g == NULL)) {
+   DH_set0_pqg(dh, BN_bin2bn(dh4096_p,sizeof(dh4096_p),NULL), 
+       NULL, BN_bin2bn(dh4096_g,sizeof(dh4096_g),NULL));
+   if ((DH_get0_p(dh) == NULL) || (DH_get0_g(dh) == NULL)) {
        DH_free(dh); return(NULL);
    }
    return(dh);
diff -puriN webserver-1.2.104.orig/cherokee/cryptor_libssl_dh_512.c webserver-1.2.104/cherokee/cryptor_libssl_dh_512.c
--- webserver-1.2.104.orig/cherokee/cryptor_libssl_dh_512.c 2014-04-01 11:12:48.000000000 -0600
+++ webserver-1.2.104/cherokee/cryptor_libssl_dh_512.c  2022-03-18 05:05:46.000000000 -0600
@@ -18,9 +18,9 @@ static DH *get_dh512()
    DH *dh;

    if ((dh=DH_new()) == NULL) return(NULL);
-   dh->p=BN_bin2bn(dh512_p,sizeof(dh512_p),NULL);
-   dh->g=BN_bin2bn(dh512_g,sizeof(dh512_g),NULL);
-   if ((dh->p == NULL) || (dh->g == NULL)) {
+   DH_set0_pqg(dh, BN_bin2bn(dh512_p,sizeof(dh512_p),NULL), 
+       NULL, BN_bin2bn(dh512_g,sizeof(dh512_g),NULL));
+   if ((DH_get0_p(dh) == NULL) || (DH_get0_g(dh) == NULL)) {
        DH_free(dh); return(NULL);
    }
    return(dh);
skinkie commented 2 years ago

The changes that you describe are also related to python2 versus python3. If we go into that direction, this effectively means we should do the entire admin, and not just the built parts. I am happy to start a python3 branch and accept changes in it. But one-ofs where only small parts are being ported does not make sense.

KenjiBrown commented 2 years ago

Those patches are Work in progress. I am not experienced in python, but I would like to contribute to python3 branch.

alsotoes commented 2 years ago

Good point, I built the webserver without the admin as I don't need it.

$ sh -x autogen.sh --disable-dependency-tracking --without-php --disable-ipv6 --disable-admin --disable-pam --disable-nls --prefix=/usr --sysconfdir=/etc --localstatedir=/var

But I will be happy to contribute to the python3 branch too.

alsotoes commented 2 years ago

Same issue, and same fix

root@wrx:~/webserver# uname -a
Linux wrx.headup.local 5.10.103+ #1529 Tue Mar 8 12:19:18 GMT 2022 armv6l GNU/Linux
root@wrx:~/webserver# lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:    10
Codename:   buster