Compiling E2guardian for openwrt with MITM v5.3.4

233 views
Skip to first unread message

Dustin Wilt

unread,
Feb 18, 2021, 7:56:38 PM2/18/21
to e2guardian
Guys, 

I need some help.  I'm trying to compile e2guardian with MITM support for https as a package to put on openwrt, of course I'm not very good at this and hit a roadblock....

To replicate:
(I use ubuntu)

Install prereq's for other distros here:
https://openwrt.org/docs/guide-developer/build-system/install-buildsystem

for ubuntu it's:
sudo apt update 
sudo apt install build-essential ccache ecj fastjar file g++ gawk gettext git java-propose-classpath libelf-dev libncurses5-dev libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget python3-distutils python3-setuptools rsync subversion swig time xsltproc zlib1g-dev 


untar

cd to openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64

run all commans from that directory!

./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
(under "global build settings" DESELECT everything:
  • Select all target specific packages by default
  • Select all kernel module packages by default
  • Select all userspace packages by default
    • Cryptographically sign packages
)

under libraries->SSL I selected libopenssl as a module
under network->web servers/proxies  select e2guardian as a module

I then edited feeds/packages/net/e2guardian/Makefile just a little to begin with to test, I still need to edit it to so it copies all the correct config files, storyboards and stuff to the correct location on the router in the end (theirs was for an older version of e2guardian), but i didn't get past the basic compile test, so later....

anyway, this is the basic alteration of their makefile:

#######################
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=e2guardian
PKG_VERSION:=5.3.4
PKG_RELEASE:=2

PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Luka P

#PKG_SOURCE_PROTO:=git
PKG_SOURCE:=v5.3.4.zip
PKG_CAT:=unzip
#PKG_SOURCE_VERSION:=35be4a5b40aedc6a800c06389c220a8dbf35f1cc
#PKG_MIRROR_HASH:=b6eb92b83531fc7da4eb15e45fa6f221

PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_BUILD_DEPENDS:=openssl
include $(INCLUDE_DIR)/uclibc++.mk
include $(INCLUDE_DIR)/package.mk

define Package/e2guardian
  SECTION:=net
  DEPENDS:=+libpthread $(CXX_DEPENDS) +zlib +libpcre +openssl
  CATEGORY:=Network
  SUBMENU:=Web Servers/Proxies
  TITLE:=E2Guardian
endef

define Package/e2guardian/conffiles
/etc/e2guardian/e2guardianf1.conf
/etc/config/e2guardian
endef

CONFIGURE_VARS += \
INCLUDES="" \
CXXFLAGS="$$$$CXXFLAGS -fno-rtti" \
LIBS="-lpthread"

CONFIGURE_ARGS += \
--with-sysconfsubdir=e2guardian \
--with-proxyuser=nobody \
--with-proxygroup=nogroup \
--with-piddir=/tmp/e2guardian/ \
--enable-sslmitm=yes \
--enable-icap=yes \
--enable-orig-ip \
--enable-pcre=yes

define Build/Configure
( cd $(PKG_BUILD_DIR); ./autogen.sh )
$(call Build/Configure/Default,$CONFIGURE_ARGS)
endef

define Package/e2guardian/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/e2guardian $(1)/usr/sbin/

$(INSTALL_DIR) $(1)/etc
$(CP) $(PKG_INSTALL_DIR)/etc/e2guardian $(1)/etc/
$(INSTALL_CONF) ./files/e2guardianf1.conf $(1)/etc/e2guardian/e2guardianf1.conf

$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/e2guardian.config $(1)/etc/config/e2guardian

$(INSTALL_DIR) $(1)/usr/share/e2guardian
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/e2guardian/transparent1x1.gif $(1)/usr/share/e2guardian/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/e2guardian/blockedflash.swf $(1)/usr/share/e2guardian/

$(INSTALL_DIR) $(1)/usr/share/e2guardian/languages/ukenglish
$(CP) $(PKG_INSTALL_DIR)/usr/share/e2guardian/languages/ukenglish/* $(1)/usr/share/e2guardian/languages/ukenglish/

$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) ./files/e2guardian.init $(1)/etc/init.d/e2guardian
endef

$(eval $(call BuildPackage,e2guardian))

#######################

then you do
make package/e2guardian/download PKG_HASH=skip

you can ignore most any warnings and wait for the e2guardian one to complete downloading

make package/e2guardian/prepare
make package/e2guardian/compile -j1 V=s

that should give verbose output when it fails....

I'm seeing:

make[5]: Entering directory '/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/e2guardian-5.3.4/src'
g++-uc -DHAVE_CONFIG_H -I. -I..  -D__CONFFILE='"/etc/e2guardian/e2guardian.conf"' -D__LOGLOCATION='"/var/log/e2guardian/"' -D__PIDDIR='"/tmp/e2guardian/"' -D__PROXYUSER='"nobody"' -D__PROXYGROUP='"nogroup"' -D__CONFDIR='"/etc/e2guardian"'  -I/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/staging_dir/target-mips_24kc_musl/usr/include -I/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/staging_dir/target-mips_24kc_musl/include -I/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/usr/include -I/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/include/fortify -I/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/include  -I/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/staging_dir/target-mips_24kc_musl/usr/include  -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/e2guardian-5.3.4:e2guardian-5.3.4 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -fno-rtti --std=c++11  -DFD_SETSIZE=65535 -MT e2guardian-String.o -MD -MP -MF .deps/e2guardian-String.Tpo -c -o e2guardian-String.o `test -f 'String.cpp' || echo './'`String.cpp
/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/bin/g++-uc: 22: [: Illegal number: sc
String.cpp: In member function 'String String::sort_search()':
String.cpp:574:10: error: 'unique_ptr' is not a member of 'std'
     std::unique_ptr<char[ ]> temp(new char[ln + 1]);
          ^~~~~~~~~~
String.cpp:574:10: note: suggested alternative: 'unique_copy'
     std::unique_ptr<char[ ]> temp(new char[ln + 1]);
          ^~~~~~~~~~
          unique_copy
String.cpp:574:21: error: expected primary-expression before 'char'
     std::unique_ptr<char[ ]> temp(new char[ln + 1]);
                     ^~~~
String.cpp:575:17: error: 'temp' was not declared in this scope
     std::strcpy(temp.get(), (this)->c_str());
                 ^~~~
String.cpp:575:17: note: suggested alternative: 'tee'
     std::strcpy(temp.get(), (this)->c_str());
                 ^~~~
                 tee
Makefile:692: recipe for target 'e2guardian-String.o' failed
make[5]: *** [e2guardian-String.o] Error 1
make[5]: Leaving directory '/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/e2guardian-5.3.4/src'
Makefile:400: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/e2guardian-5.3.4'
Makefile:341: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/e2guardian-5.3.4'
Makefile:87: recipe for target '/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/e2guardian-5.3.4/.built' failed
make[2]: *** [/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/e2guardian-5.3.4/.built] Error 2
make[2]: Leaving directory '/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/feeds/packages/net/e2guardian'
time: package/feeds/packages/e2guardian/compile#0.49#0.05#0.77
package/Makefile:111: recipe for target 'package/feeds/packages/e2guardian/compile' failed
make[1]: *** [package/feeds/packages/e2guardian/compile] Error 2
make[1]: Leaving directory '/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64'
/home/wiltd/Downloads/openwrt-sdk-19.07.4-ar71xx-nand_gcc-7.5.0_musl.Linux-x86_64/include/toplevel.mk:218: recipe for target 'package/e2guardian/compile' failed
make: *** [package/e2guardian/compile] Error 2



Thanks,
Dustin

Klaus Gundermann

unread,
Feb 19, 2021, 10:07:26 AM2/19/21
to e2guardian
Hi Dustin,


Best regards
Klaus

Dustin Wilt

unread,
Mar 3, 2021, 1:02:41 PM3/3/21
to e2guardian
Klaus,

I tried specifying other locations of memory.h, unfortunately, it did not help.  I also made sure e2guardian would compile on the linux test box outside of the SDK to ensure all required libraries and dependencies exist on the system, that was successful.  So it's just using the SDK that I can't compile it...
Message has been deleted

Douglas Orend

unread,
Jul 18, 2024, 6:58:41 PM7/18/24
to e2guardian
Using the modifications you posted earlier (plus further modifications), I've gotten e2guardian v5.5.6r to compile under OpenWrt 23.05.3 SDK.  Here is the link: https://github.com/xptsp/openwrt-e2guardian

I hope this helps.....
Reply all
Reply to author
Forward
0 new messages