Changeset 550 for trunk/configure.ac


Ignore:
Timestamp:
Oct 31, 2019, 9:13:12 PM (5 years ago)
Author:
katerina
Message:

Fix for ticket #442 (support for OpenBSD signify).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r548 r550  
    1212dnl start
    1313dnl
    14 AM_INIT_AUTOMAKE(samhain, 4.3.3)
     14AM_INIT_AUTOMAKE(samhain, 4.4.0)
    1515AC_DEFINE([SAMHAIN], 1, [Application is samhain])
    1616AC_CANONICAL_HOST
     
    22202220
    22212221dnl
    2222 dnl  GPG/PGP options
     2222dnl  Signify/GnuPG options
    22232223dnl
     2224
     2225AC_ARG_WITH(signify,
     2226        [  --with-signify=PATH          use OpenBSD signify to verify database/config [[no]]],
     2227        [
     2228        if test "x${withval}" != "xno"; then
     2229          if test "x${cross_compiling}" = xyes; then
     2230                mysignify="${withval}"
     2231          else
     2232                if test -f "${withval}"; then
     2233                  mysignify="${withval}"
     2234                  mychk0=`gpg --load-extension tiger --print-md TIGER192 ${withval} 2>/dev/null`
     2235                  if test "x$?" != "x0"; then
     2236                    mychktest=no
     2237                    for sam_pre in ./samhain ./yule /usr/local/sbin/samhain /usr/local/bin/samhain /usr/bin/samhain /usr/sbin/samhain /usr/local/sbin/yule /usr/local/bin/yule /usr/bin/yule /usr/sbin/yule; do
     2238                      if test x"${mychktest}" = xyes
     2239                      then
     2240                        :
     2241                      else
     2242                        if test -f ${sam_pre}
     2243                        then
     2244                          echo "use existing ${sam_pre} for signify checksum"
     2245                          mychk0=`${sam_pre} -H ${withval} 2>/dev/null`
     2246                          if test "x$?" != "x0"; then
     2247                            if test "x${nocl_code}" != "x"; then
     2248                               mychk0=`echo -H ${withval} | ${sam_pre} ${nocl_code} 2>/dev/null`
     2249                               if test "x$?" != "x0"; then
     2250                                  :
     2251                               else
     2252                                  mychk="${mychk0}"
     2253                                  mychktest=yes
     2254                               fi
     2255                            fi
     2256                          else
     2257                            mychk="${mychk0}"
     2258                            mychktest=yes
     2259                          fi
     2260                        fi
     2261                      fi
     2262                    done
     2263                    if test x${mychktest} = xno; then
     2264                      AC_MSG_WARN([--with-signify: cannot determine TIGER192 checksum of ${withval}])
     2265                      echo "-------------------------------------------------------------"
     2266                      echo " I cannot find an existing GnuPG or samhain binary to use."
     2267                      echo " You can:"
     2268                      echo "   (a) run make to compile a samhain binary, then repeat"
     2269                      echo "       ./configure and make"
     2270                      echo "   (b) ignore the failure. The checksum of the signify binary"
     2271                      echo "       will not get compiled in, thus allowing an attacker"
     2272                      echo "       to replace signify with a trojan and subverting the"
     2273                      echo "       signature verification of configure and database files."
     2274                      echo
     2275                      echo " PLEASE IGNORE THIS MESSAGE IF YOU ALSO USE --with-checksum"
     2276                      echo "-------------------------------------------------------------"
     2277                    fi
     2278                  else
     2279                    mychk="${mychk0}"
     2280                  fi
     2281                else
     2282                  AC_MSG_ERROR([--with-signify: cannot find signify PATH=${withval}])
     2283                fi
     2284          fi
     2285          AC_DEFINE([WITH_SIG], 1, [Define if signature checking is supported.])
     2286          AC_DEFINE([WITH_SIGNIFY], 1, [Define if using OpenBSD signify for signature checking.])
     2287          AC_DEFINE_UNQUOTED([DEFAULT_SIG_PATH], _("${mysignify}"), [Define as path to signing binary])
     2288          AC_SUBST(mysignify)
     2289        fi
     2290        ]
     2291)
     2292
     2293AC_ARG_WITH(pubkey-checksum,
     2294        [  --with-pubkey-checksum=CHKSUM        compile in TIGER192 checksum of signify public key [[no]]],
     2295        [
     2296        if test "x${withval}" != "xno"; then
     2297                if test "x${withval}" == "xyes"; then
     2298                        AC_MSG_ERROR([Option --with-pubkey-checksum=CHKSUM: checksum CHKSUM of signify public key not specified.])
     2299                else
     2300                        if test "x${withval}" = "x"; then
     2301                                AC_MSG_ERROR([Option --with-checksum=CHKSUM: checksum CHKSUM of the signify public key not specified.])
     2302                        fi
     2303                fi
     2304                AC_DEFINE([HAVE_SIG_KEY_HASH], 1, [Define if signing binary checksum available.])
     2305                AC_DEFINE_UNQUOTED([SIG_KEY_HASH], _("${withval}"), [Define as the signify public key checksum.] )
     2306        fi
     2307        ]
     2308)
     2309
    22242310
    22252311AC_ARG_WITH(gpg,
    22262312        [  --with-gpg=PATH              use GnuPG to verify database/config [[no]]],
    22272313        [
     2314        if test "x${mysignify}" != "x"; then
     2315           AC_MSG_ERROR([--with-gpg: already using --with-signify])
     2316        fi
    22282317        if test "x${withval}" != "xno"; then
    22292318          if test "x${cross_compiling}" = xyes; then
     
    22842373                fi
    22852374          fi
     2375          AC_DEFINE([WITH_SIG], 1, [Define if signature checking is supported.])
    22862376          AC_DEFINE(WITH_GPG)
    2287           AC_DEFINE_UNQUOTED(DEFAULT_GPG_PATH, _("${mygpg}") )
     2377          AC_DEFINE_UNQUOTED([DEFAULT_SIG_PATH], _("${mygpg}"), [Define as path to signing binary])
    22882378          AC_SUBST(mygpg)
    22892379        fi
     
    23122402)
    23132403
    2314 dnl AC_ARG_WITH(pgp,
    2315 dnl        [  --with-pgp=PATH           Use PGP to verify database/config (no).],
    2316 dnl         [myppg="$withval"
    2317 dnl     AC_DEFINE(WITH_PGP)
    2318 dnl     AC_DEFINE_UNQUOTED(DEFAULT_PGP_PATH, _("${myppg}") )
    2319 dnl     ])
    2320 
    23212404AC_ARG_WITH(checksum,
    2322         [  --with-checksum=CHKSUM       compile in gpg/pgp checksum [[yes]]],
     2405        [  --with-checksum=CHKSUM       compile in checksum of signing binary (e.g. gpg) [[yes]]],
    23232406        [
    23242407        if test "x${withval}" != "xno"; then
     
    23262409                        if test "x${mychk}" != "x"; then
    23272410                                if test "x${mychk}" != "x${withval}"; then
    2328                                         AC_MSG_WARN([--with-checksum: possible gpg CHKSUM problem])
     2411                                        AC_MSG_WARN([--with-checksum: possible signing binary CHKSUM problem])
    23292412                                        AC_MSG_WARN([--with-checksum: CHKSUM=${withval}])
    23302413                                        AC_MSG_WARN([--with-checksum: autodetected=${mychk}])
     
    23342417                else
    23352418                        if test "x${mychk}" = "x"; then
    2336                                 AC_MSG_ERROR([Option --with-checksum=CHKSUM: checksum CHKSUM of the gpg binary not specified.])
     2419                                AC_MSG_ERROR([Option --with-checksum=CHKSUM: checksum CHKSUM of the signing binary not specified.])
    23372420                        fi
    23382421                fi
    2339                 AC_DEFINE(HAVE_GPG_CHECKSUM)
    2340                 AC_DEFINE_UNQUOTED(GPG_HASH, _("${mychk}") )
    2341                 echo "${mychk}" | sed 's,.*:,,g' | sed 's, ,,g' | sed 's,\(.\),\1:,g' | awk '{ split($0, arr, ":"); m = length($1)/2; print "#ifndef CHKSUM_H"; print "#define CHKSUM_H"; print "char gpgchk[50];"; for (i=1; i <= m; i++) printf "gpgchk[%d] = %c%s%c;\n", i-1, 39, arr[i], 39; printf "gpgchk[48] = %c%c0%c;\n", 39, 92, 39; print "#endif"; }' > sh_gpg_chksum.h
     2422                AC_DEFINE([HAVE_SIG_CHECKSUM], 1, [Define if signing binary checksum available.])
     2423                AC_DEFINE_UNQUOTED([SIG_HASH], _("${mychk}"), [Define as the signing binary TIGER192 checksum.] )
     2424                echo "${mychk}" | sed 's,.*:,,g' | sed 's, ,,g' | sed 's,\(.\),\1:,g' | awk '{ split($0, arr, ":"); m = length($1)/2; print "#ifndef CHKSUM_H"; print "#define CHKSUM_H"; print "char sigchk[50];"; for (i=1; i <= m; i++) printf "sigchk[%d] = %c%s%c;\n", i-1, 39, arr[i], 39; printf "sigchk[48] = %c%c0%c;\n", 39, 92, 39; print "#endif"; }' > sh_sig_chksum.h
    23422425        fi
    23432426        ],
    23442427        [
    2345         if test "x${mygpg}" != "x"; then
     2428        if test "x${mygpg}" != "x" || test "x${mysignify}" != "x"
     2429        then
    23462430                if test "x${mychk}" != "x"; then
    2347                         AC_DEFINE(HAVE_GPG_CHECKSUM)
    2348                         AC_DEFINE_UNQUOTED(GPG_HASH, _("${mychk}") )
    2349                         echo "${mychk}" | sed 's,.*:,,g' | sed 's, ,,g' | sed 's,\(.\),\1:,g' | awk '{ split($0, arr, ":"); m = length($1)/2; print "#ifndef CHKSUM_H"; print "#define CHKSUM_H"; print "char gpgchk[50];"; for (i=1; i <= m; i++) printf "gpgchk[%d] = %c%s%c;\n", i-1, 39, arr[i], 39; printf "gpgchk[48] = %c%c0%c;\n", 39, 92, 39; print "#endif"; }' > sh_gpg_chksum.h
     2431                        AC_DEFINE([HAVE_SIG_CHECKSUM], 1, [Define if signing binary checksum available.])
     2432                        AC_DEFINE_UNQUOTED([SIG_HASH], _("${mychk}"), [Define as the signing binary TIGER192 checksum.] )
     2433                        echo "${mychk}" | sed 's,.*:,,g' | sed 's, ,,g' | sed 's,\(.\),\1:,g' | awk '{ split($0, arr, ":"); m = length($1)/2; print "#ifndef CHKSUM_H"; print "#define CHKSUM_H"; print "char sigchk[50];"; for (i=1; i <= m; i++) printf "sigchk[%d] = %c%s%c;\n", i-1, 39, arr[i], 39; printf "sigchk[48] = %c%c0%c;\n", 39, 92, 39; print "#endif"; }' > sh_sig_chksum.h
    23502434                fi
    23512435        fi
     
    27102794scripts/samhain.ebuild
    27112795scripts/samhain.ebuild-light
    2712 scripts/samhainadmin.pl
     2796scripts/samhainadmin-gpg.pl
     2797scripts/samhainadmin-sig.pl
    27132798scripts/yuleadmin.pl
    27142799scripts/check_samhain.pl
     
    27182803echo timestamp > stamp-h
    27192804chmod +x samhain-install.sh
    2720 chmod +x scripts/samhainadmin.pl
     2805chmod +x scripts/samhainadmin-gpg.pl
     2806chmod +x scripts/samhainadmin-sig.pl
    27212807chmod +x scripts/yuleadmin.pl
    27222808chmod +x scripts/check_samhain.pl
     
    27252811
    27262812chmod +x deploy.sh
     2813
     2814if test "x${mysignify}" != x
     2815then
     2816        cp -a scripts/samhainadmin-sig.pl scripts/samhainadmin.pl
     2817fi
     2818if test "x${mygpg}" != x
     2819then
     2820        cp -a scripts/samhainadmin-gpg.pl scripts/samhainadmin.pl
     2821fi
     2822
    27272823
    27282824if test "x${cross_compiling}" = xyes
Note: See TracChangeset for help on using the changeset viewer.