3

Installing from source went fine:

sudo apt-get remove fail2ban
wget https://github.com/fail2ban/fail2ban/archive/0.10.3.tar.gz
mv 0.10.3.tar.gz fail2ban-0.10.3.tar.gz
gzip -d fail2ban-0.10.3.tar.gz
tar -xvf fail2ban-0.10.3.tar
cd ~/programs/fail2ban-0.10.3
mkdir ~/programs/install/fail2ban
sudo python setup.py install --root=~/programs/install/fail2ban
sudo cp files/debian-initd /etc/init.d/fail2ban
sudo update-rc.d fail2ban defaults
sudo systemctl unmask fail2ban.service
sudo service fail2ban start

But then the client is missing:

stephane@thalasoft:~/programs/fail2ban-0.10.3$ sudo fail2ban-client version
sudo: fail2ban-client: command not found
stephane@thalasoft:~/programs/fail2ban-0.10.3$ fail2ban-client version

Command 'fail2ban-client' not found, but can be installed with:

sudo apt install fail2ban

stephane@thalasoft:~/programs/fail2ban-0.10.3$ find ../install/fail2ban/ -name fail2ban-client
../install/fail2ban/usr/local/bin/fail2ban-client
stephane@thalasoft:~/programs/fail2ban-0.10.3$ ll ../install/fail2ban/usr/local/bin/
total 24
drwxr-xr-x 2 root root 4096 Oct 19 13:18 ./
drwxr-xr-x 4 root root 4096 Oct 19 13:18 ../
-rwxr-xr-x 1 root root 1418 Oct 19 13:18 fail2ban-client*
lrwxrwxrwx 1 root root   15 Oct 19 13:18 fail2ban-python -> /usr/bin/python*
-rwxr-xr-x 1 root root 1279 Oct 19 13:18 fail2ban-regex*
-rwxr-xr-x 1 root root 1416 Oct 19 13:18 fail2ban-server*
-rwxr-xr-x 1 root root 2284 Oct 19 13:18 fail2ban-testcases*
stephane@thalasoft:~/programs/fail2ban-0.10.3$ ../install/fail2ban/usr/local/bin/fail2ban-client 
versionTraceback (most recent call last):
  File "../install/fail2ban/usr/local/bin/fail2ban-client", line 34, in <module>
    from fail2ban.client.fail2banclient import exec_command_line, sys
ImportError: No module named fail2ban.client.fail2banclient
stephane@thalasoft:~/programs/fail2ban-0.10.3$ ../install/fail2ban/usr/local/bin/fail2ban-client version
Traceback (most recent call last):
  File "../install/fail2ban/usr/local/bin/fail2ban-client", line 34, in <module>
    from fail2ban.client.fail2banclient import exec_command_line, sys
ImportError: No module named fail2ban.client.fail2banclient
Stephane
  • 227
  • 3
  • 12

1 Answers1

3

You could try the command which fail2ban-client and if it returns nothing then try find ~ -type f -name fail2ban-client.

If you haven't installed it in your home or if you changed user, this command (generating many warnings) will definitely find it if you have it on that box: sudo find / -type f -name fail2ban-client.

Once you've got it, either execute it with /full/path/to/fail2ban-client or follow this one to make all fail2ban binaries available without /full/path/to prefix.

Marco
  • 1,709
  • 3
  • 17
  • 31
  • I guess my question was not well stated. As seen in the question, I could locate the binary but it would fail when executed. – Stephane Oct 19 '19 at 12:26
  • I see. Sorry I'm outside right now, add it to paths, it should work. – Marco Oct 19 '19 at 12:28
  • No worries, I installed it without the `--root` option and it can be started now. Although I still have my other issue https://serverfault.com/questions/988064/fail2ban-not-banning-on-ubuntu-19-04 – Stephane Oct 19 '19 at 12:39