Snap! Websites
An Open Source CMS System in C++
In the last few days, I worked with, let's call him John, who read my post on my DNS issues in Aug 15, 2020 (I was spammed pretty bad by an amplification DNS attack). John wanted to run iplock on his system because it's much more flexible than directly using iptables with fail2ban. So I made sure that it would compile on Ubuntu 20.04 and he made it work on his system by also copying the dependencies (i.e. the shared libraries).
Here we present John's log on how to install iplock on a computer from a compiled version, opposed to directly from a package. The problem is that I don't currently have the packages ready for Ubuntu 20.04... (I'm currently looking into having the packages for 16.04, 18.04 and 20.04, but right now the script fails signing the source file).
For how to compile, you should find all the necessary instructions in the snapcpp main README.md file.
john@ubuntu2004:~/snapcpp/contrib/iplock/iplock$ cd john@ubuntu2004:~$ cd snapcpp/dist/ john@ubuntu2004:~/snapcpp/dist$ ls bin include lib sbin share john@ubuntu2004:~/snapcpp/dist$ tar zcf iplock-libs.tgz lib/ <copied from ubuntu2004 vm to remote dns machine> scp -3r 172.16.190.6:/home/john/snapcpp/contrib/iplock/iplock 10.10.10.206: scp -3r 172.16.190.6:/home/john/snapcpp/dist/iplock-libs.tgz 10.10.10.206: (10.10.10.206) john@server:~$ ldd iplock linux-vdso.so.1 (0x00007fffb95f3000) libadvgetopt.so.2 => not found libboost_filesystem.so.1.71.0 => not found libaddr.so.1 => not found libexcept.so.1 => not found libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f18d7321000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f18d7306000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f18d7112000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f18d6fc3000) /lib64/ld-linux-x86-64.so.2 (0x00007f18d7532000) (10.10.10.206) john@server:~$ sudo apt install libboost-filesystem1.71.0 Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: libboost-filesystem1.71.0 0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded. Need to get 242 kB of archives. After this operation, 2,124 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libboost-filesystem1.71.0 amd64 1.71.0-6ubuntu6 [242 kB] Fetched 242 kB in 1s (370 kB/s) Selecting previously unselected package libboost-filesystem1.71.0:amd64. (Reading database ... 149927 files and directories currently installed.) Preparing to unpack .../libboost-filesystem1.71.0_1.71.0-6ubuntu6_amd64.deb ... Unpacking libboost-filesystem1.71.0:amd64 (1.71.0-6ubuntu6) ... Setting up libboost-filesystem1.71.0:amd64 (1.71.0-6ubuntu6) ... Processing triggers for libc-bin (2.31-0ubuntu9.1) ... (10.10.10.206) john@server:~$ ldd iplock linux-vdso.so.1 (0x00007ffeda5e6000) libadvgetopt.so.2 => not found libboost_filesystem.so.1.71.0 => /lib/x86_64-linux-gnu/libboost_filesystem.so.1.71.0 (0x00007f3b1debc000) libaddr.so.1 => not found libexcept.so.1 => not found libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f3b1dcdb000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3b1dcc0000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3b1dacc000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3b1daa9000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3b1d95a000) /lib64/ld-linux-x86-64.so.2 (0x00007f3b1df0a000) (10.10.10.206) john@server:~$ tar zxf iplock-libs.tgz (10.10.10.206) john@server:~$ cd lib/ (10.10.10.206) john@server:~/lib$ ls -la total 10336 drwxr-xr-x 2 john john 4096 Jan 5 11:34 . drwxr-xr-x 10 john john 4096 Jan 5 12:52 .. lrwxrwxrwx 1 john john 12 Jan 5 11:34 libaddr.so -> libaddr.so.1 lrwxrwxrwx 1 john john 14 Jan 5 11:34 libaddr.so.1 -> libaddr.so.1.0 -rw-r--r-- 1 john john 167560 Jan 5 11:34 libaddr.so.1.0 lrwxrwxrwx 1 john john 17 Jan 5 11:33 libadvgetopt.so -> libadvgetopt.so.2 lrwxrwxrwx 1 john john 19 Jan 5 11:33 libadvgetopt.so.2 -> libadvgetopt.so.2.0 -rw-r--r-- 1 john john 602624 Jan 5 11:32 libadvgetopt.so.2.0 -rw-r--r-- 1 john john 8243298 Jan 5 11:30 libCatch2WithMain.a lrwxrwxrwx 1 john john 17 Jan 5 11:31 libcppthread.so -> libcppthread.so.1 lrwxrwxrwx 1 john john 19 Jan 5 11:31 libcppthread.so.1 -> libcppthread.so.1.0 -rw-r--r-- 1 john john 109248 Jan 5 11:31 libcppthread.so.1.0 lrwxrwxrwx 1 john john 14 Jan 5 11:30 libexcept.so -> libexcept.so.1 lrwxrwxrwx 1 john john 16 Jan 5 11:30 libexcept.so.1 -> libexcept.so.1.1 -rw-r--r-- 1 john john 63384 Jan 5 11:30 libexcept.so.1.1 lrwxrwxrwx 1 john john 15 Jan 5 11:34 libmurmur3.so -> libmurmur3.so.1 lrwxrwxrwx 1 john john 17 Jan 5 11:34 libmurmur3.so.1 -> libmurmur3.so.1.0 -rw-r--r-- 1 john john 16048 Jan 5 11:34 libmurmur3.so.1.0 lrwxrwxrwx 1 john john 18 Jan 5 11:34 libsnaplogger.so -> libsnaplogger.so.1 lrwxrwxrwx 1 john john 20 Jan 5 11:34 libsnaplogger.so.1 -> libsnaplogger.so.1.0 -rw-r--r-- 1 john john 1016208 Jan 5 11:33 libsnaplogger.so.1.0 lrwxrwxrwx 1 john john 12 Jan 5 11:31 libutf8.so -> libutf8.so.1 lrwxrwxrwx 1 john john 14 Jan 5 11:31 libutf8.so.1 -> libutf8.so.1.0 -rw-r--r-- 1 john john 55688 Jan 5 11:31 libutf8.so.1.0 lrwxrwxrwx 1 john john 14 Jan 5 11:34 libzipios.so -> libzipios.so.2 lrwxrwxrwx 1 john john 16 Jan 5 11:34 libzipios.so.2 -> libzipios.so.2.2 -rw-r--r-- 1 john john 286448 Jan 5 11:34 libzipios.so.2.2 (10.10.10.206) john@server:~/lib$ cd (10.10.10.206) john@server:~$ sudo mv lib /usr/local/lib/iplock (10.10.10.206) john@server:~$ sudo chown root:staff /usr/local/lib/iplock (10.10.10.206) john@server:~$ sudo chmod 2775 /usr/local/lib/iplock (10.10.10.206) john@server:~$ sudo ls -l /usr/local/lib/ total 8 drwxrwsr-x 2 root staff 4096 Jan 5 11:34 iplock drwxrwsr-x 3 root staff 4096 Apr 23 2020 python3.8 (10.10.10.206) john@server:~$ cat /etc/ld.so.conf.d/libc.conf # libc default configuration /usr/local/lib (10.10.10.206) john@server:~$ cd /usr/local/lib/ (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libaddr.so.1 libaddr.so (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libaddr.so.1.0 libaddr.so.1 (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libadvgetopt.so.2 libadvgetopt.so (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libadvgetopt.so.2.0 libadvgetopt.so.2 (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libcppthread.so.1 libcppthread.so (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libcppthread.so.1.0 libcppthread.so.1 (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libexcept.so.1 libexcept.so (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libexcept.so.1.1 libexcept.so.1 (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libmurmur3.so.1 libmurmur3.so (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libmurmur3.so.1.0 libmurmur3.so.1 (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libsnaplogger.so.1 libsnaplogger.so (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libsnaplogger.so.1.0 libsnaplogger.so.1 (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libutf8.so.1 libutf8.so (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libutf8.so.1.0 libutf8.so.1 (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libzipios.so.2 libzipios.so (10.10.10.206) john@server:/usr/local/lib$ sudo ln -s iplock/libzipios.so.2.2 libzipios.so.2 (10.10.10.206) john@server:/usr/local/lib$ ls -la lib* total 16 drwxr-xr-x 4 root root 4096 Jan 5 13:12 . drwxr-xr-x 10 root root 4096 Apr 23 2020 .. drwxrwsr-x 2 root staff 4096 Jan 5 11:34 iplock lrwxrwxrwx 1 root root 19 Jan 5 13:12 libaddr.so -> iplock/libaddr.so.1 lrwxrwxrwx 1 root root 21 Jan 5 13:12 libaddr.so.1 -> iplock/libaddr.so.1.0 lrwxrwxrwx 1 root root 24 Jan 5 13:12 libadvgetopt.so -> iplock/libadvgetopt.so.2 lrwxrwxrwx 1 root root 26 Jan 5 13:12 libadvgetopt.so.2 -> iplock/libadvgetopt.so.2.0 lrwxrwxrwx 1 root root 24 Jan 5 13:12 libcppthread.so -> iplock/libcppthread.so.1 lrwxrwxrwx 1 root root 26 Jan 5 13:12 libcppthread.so.1 -> iplock/libcppthread.so.1.0 lrwxrwxrwx 1 root root 21 Jan 5 13:12 libexcept.so -> iplock/libexcept.so.1 lrwxrwxrwx 1 root root 23 Jan 5 13:12 libexcept.so.1 -> iplock/libexcept.so.1.1 lrwxrwxrwx 1 root root 22 Jan 5 13:12 libmurmur3.so -> iplock/libmurmur3.so.1 lrwxrwxrwx 1 root root 24 Jan 5 13:12 libmurmur3.so.1 -> iplock/libmurmur3.so.1.0 lrwxrwxrwx 1 root root 25 Jan 5 13:12 libsnaplogger.so -> iplock/libsnaplogger.so.1 lrwxrwxrwx 1 root root 27 Jan 5 13:12 libsnaplogger.so.1 -> iplock/libsnaplogger.so.1.0 lrwxrwxrwx 1 root root 19 Jan 5 13:12 libutf8.so -> iplock/libutf8.so.1 lrwxrwxrwx 1 root root 21 Jan 5 13:12 libutf8.so.1 -> iplock/libutf8.so.1.0 lrwxrwxrwx 1 root root 21 Jan 5 13:12 libzipios.so -> iplock/libzipios.so.2 lrwxrwxrwx 1 root root 23 Jan 5 13:12 libzipios.so.2 -> iplock/libzipios.so.2.2 (10.10.10.206) john@server:/usr/local/lib$ sudo ldconfig (10.10.10.206) john@server:/usr/local/lib$ cd - /home/john (10.10.10.206) john@server:~$ ldd ./iplock linux-vdso.so.1 (0x00007ffde8bb8000) libadvgetopt.so.2 => /usr/local/lib/libadvgetopt.so.2 (0x00007f189bfe4000) libboost_filesystem.so.1.71.0 => /lib/x86_64-linux-gnu/libboost_filesystem.so.1.71.0 (0x00007f189bfc6000) libaddr.so.1 => /usr/local/lib/libaddr.so.1 (0x00007f189bfa3000) libexcept.so.1 => /usr/local/lib/libexcept.so.1 (0x00007f189bf95000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f189bdb4000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f189bd99000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f189bba5000) libcppthread.so.1 => /usr/local/lib/libcppthread.so.1 (0x00007f189bb8f000) libutf8.so.1 => /usr/local/lib/libutf8.so.1 (0x00007f189bb83000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f189bb60000) /lib64/ld-linux-x86-64.so.2 (0x00007f189c092000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f189ba11000) (10.10.10.206) john@server:~$ ./iplock iplock:error: you must specify one of: --block, --unblock, --count, --flush or --batch. (10.10.10.206) john@server:~$ file ./iplock ./iplock: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=dafcd535e8a7ee3b525c372b6dbb4ac337348070, for GNU/Linux 3.2.0, not stripped (10.10.10.206) john@server:~$
We hope this was helpful to you.
Snap! Websites
An Open Source CMS System in C++