Lochnair / xt_tls

Filter TLS traffic with IPtables
GNU General Public License v3.0
228 stars 45 forks source link

Unable to build in Debian 9 or Ubuntu 16.04 #25

Closed kasmtech closed 5 years ago

kasmtech commented 5 years ago

I have been able to this to build successfully in Ubuntu 16.04 or Debian 9. Likely due to not knowing what I am doing, however, the instructions seem pretty straight forward. The following are the output of 'make dkms-install' and a tail of the dkms log. This is a fresh VM, I ran the following prior to building...

sudo apt install build-essential sudo apt install dkms

user@instance-1:~/xt_tls$ sudo make dkms-install . ./dkms.conf; \ mkdir /usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION}; \ cp -r * /usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION}; \ dkms add -m ${PACKAGE_NAME} -v ${PACKAGE_VERSION}; \ dkms build -m ${PACKAGE_NAME} -v ${PACKAGE_VERSION}; \ dkms install -m ${PACKAGE_NAME} -v ${PACKAGE_VERSION}

Creating symlink /var/lib/dkms/xt_tls/0.2/source -> /usr/src/xt_tls-0.2

DKMS: add completed.

Kernel preparation unnecessary for this kernel. Skipping...

Building module: cleaning build area... make -j1 KERNELRELEASE=4.9.0-8-amd64 KERNELDIR=/lib/modules/4.9.0-8-amd64/build...(bad exit status: 2) Error! Bad return status for module build on kernel: 4.9.0-8-amd64 (x86_64) Consult /var/lib/dkms/xt_tls/0.2/build/make.log for more information.

Kernel preparation unnecessary for this kernel. Skipping...

Building module: cleaning build area... make -j1 KERNELRELEASE=4.9.0-8-amd64 KERNELDIR=/lib/modules/4.9.0-8-amd64/build...(bad exit status: 2) Error! Bad return status for module build on kernel: 4.9.0-8-amd64 (x86_64) Consult /var/lib/dkms/xt_tls/0.2/build/make.log for more information. Makefile:18: recipe for target 'dkms-install' failed make: *** [dkms-install] Error 10

user@instance-1:~/xt_tls$ tail -n 60 /var/lib/dkms/xt_tls/0.2/build/make.log DKMS make.log for xt_tls-0.2 for kernel 4.9.0-8-amd64 (x86_64) Mon Nov 12 23:13:15 UTC 2018 make[1]: Entering directory '/var/lib/dkms/xt_tls/0.2/build' make -C ipt make[2]: Entering directory '/var/lib/dkms/xt_tls/0.2/build/ipt' cc -I../src -fPIC -c -o libxt_tls.o libxt_tls.c libxt_tls.c:2:21: fatal error: xtables.h: No such file or directory

include

                 ^

compilation terminated.

: recipe for target 'libxt_tls.o' failed make[2]: *** [libxt_tls.o] Error 1 make[2]: Leaving directory '/var/lib/dkms/xt_tls/0.2/build/ipt' Makefile:6: recipe for target 'all' failed make[1]: *** [all] Error 2 make[1]: Leaving directory '/var/lib/dkms/xt_tls/0.2/build' I took a wild stab in the dark and install the following are reran the build. It looks successful, however, trying to add an iptables rule with -m tls results in 'Couldn't load match 'xls': No such file or directory' sudo apt install xtables-addons-dkms sudo apt install xtables-addons-source instance-1:~/xt_tls$ sudo make dkms-install . ./dkms.conf; \ mkdir /usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION}; \ cp -r * /usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION}; \ dkms add -m ${PACKAGE_NAME} -v ${PACKAGE_VERSION}; \ dkms build -m ${PACKAGE_NAME} -v ${PACKAGE_VERSION}; \ dkms install -m ${PACKAGE_NAME} -v ${PACKAGE_VERSION} mkdir: cannot create directory \u2018/usr/src/xt_tls-0.2\u2019: File exists Error! DKMS tree already contains: xt_tls-0.2 You cannot add the same module/version combo more than once. Kernel preparation unnecessary for this kernel. Skipping... Building module: cleaning build area... make -j1 KERNELRELEASE=4.9.0-8-amd64 KERNELDIR=/lib/modules/4.9.0-8-amd64/build... cleaning build area... DKMS: build completed. xt_tls: Running module version sanity check. - Original module - No original module exists within this kernel - Installation - Installing to /lib/modules/4.9.0-8-amd64/updates/dkms/ Running the post_install script: make[1]: Entering directory '/usr/src/xt_tls-0.2/ipt' cc -I../src -fPIC -c -o libxt_tls.o libxt_tls.c cc -shared -o libxt_tls.so libxt_tls.o; rm libxt_tls.o make[1]: Leaving directory '/usr/src/xt_tls-0.2/ipt' make[1]: Entering directory '/usr/src/xt_tls-0.2/ipt' Makefile:23: *** pkg-config binary not found. Stop. make[1]: Leaving directory '/usr/src/xt_tls-0.2/ipt' depmod... Backing up initrd.img-4.9.0-8-amd64 to /boot/initrd.img-4.9.0-8-amd64.old-dkms Making new initrd.img-4.9.0-8-amd64 (If next boot fails, revert to initrd.img-4.9.0-8-amd64.old-dkms image) update-initramfs..... DKMS: install completed. Thank you Matt
kasmtech commented 5 years ago

The following were the steps taken in Ubuntu 16.04, still have the same issue.

cd ~ sudo apt install build-essential sudo apt install iptables-dev dkms git clone https://github.com/Lochnair/xt_tls.git cd xt_tls/ sudo make dkms-install

sudo iptables -A OUTPUT -p tcp --dport 443 -m tls --tls-host "www.facebook.comhttp://www.facebook.com" -j DROP iptables v1.6.0: Couldn't load match `tls':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.

————— output from make ———————

matt@instance-1:~/xt_tls$ sudo make dkms-install . ./dkms.conf; \ mkdir /usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION}; \ cp -r * /usr/src/${PACKAGE_NAME}-${PACKAGE_VERSION}; \ dkms add -m ${PACKAGE_NAME} -v ${PACKAGE_VERSION}; \ dkms build -m ${PACKAGE_NAME} -v ${PACKAGE_VERSION}; \ dkms install -m ${PACKAGE_NAME} -v ${PACKAGE_VERSION}

Creating symlink /var/lib/dkms/xt_tls/0.2/source -> /usr/src/xt_tls-0.2

DKMS: add completed.

Kernel preparation unnecessary for this kernel. Skipping...

Building module: cleaning build area.... make KERNELRELEASE=4.15.0-1023-gcp KERNELDIR=/lib/modules/4.15.0-1023-gcp/build....... cleaning build area....

DKMS: build completed.

xt_tls: Running module version sanity check.

Running the post_install script: make[1]: Entering directory '/usr/src/xt_tls-0.2/ipt' cc -I../src -fPIC -c -o libxt_tls.o libxt_tls.c cc -shared -o libxt_tls.so libxt_tls.o; rm libxt_tls.o make[1]: Leaving directory '/usr/src/xt_tls-0.2/ipt' make[1]: Entering directory '/usr/src/xt_tls-0.2/ipt' Makefile:23: *** pkg-config binary not found. Stop. make[1]: Leaving directory '/usr/src/xt_tls-0.2/ipt'

depmod.....

Backing up initrd.img-4.15.0-1023-gcp to /boot/initrd.img-4.15.0-1023-gcp.old-dkms Making new initrd.img-4.15.0-1023-gcp (If next boot fails, revert to initrd.img-4.15.0-1023-gcp.old-dkms image) update-initramfs......

DKMS: install completed.

On Nov 12, 2018, at 10:09 PM, maleimachao notifications@github.com<mailto:notifications@github.com> wrote:

dkms method need install the iptables-dev.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Lochnair/xt_tls/issues/25#issuecomment-438115157, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AqIpX5Fti2PFlQ_MVKs7_sIFSl39OaUxks5uujfcgaJpZM4YanuF.

Lochnair commented 5 years ago

In an attempt to make sure the pkg-config utility is installed on the system, I broke the install step in the Makefile. I removed the check for now, until I figure out how to do it properly.

If you pull the latest change you should be able to install.

kasmtech commented 5 years ago

Excellent, confirmed, thank you much!