How Do I Upgrade Fail2ban 0.8.14 to 0.10.3 ?

sharingsunshine
sharingsunshine used Ask the Experts™
on
I need to upgrade fail2ban 0.8.14 to 0.10.3.  I am on a Linux 2 server which prevents me from loading any repositories or using Yum to install it.

So, I need to know the steps to get my fail2ban upgraded.  

Thanks,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
nociSoftware Engineer
Distinguished Expert 2018

Commented:
Download fail2ban from:  http://www.fail2ban.org/
Then this should... be done (according to the README.md...)
    tar xvfj fail2ban-0.10.3.tar.bz2
    cd fail2ban-0.10.3
    python setup.py install

After which the setup should be in /etc/fail2ban....

Author

Commented:
Do I need to remove what is there already?  If so, what commands will remove the files.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Yes. Remove installed Fail2Ban first, via your package manager.

Looks like Linux 2 uses yum, so you'll remove your Fail2Ban RPMs via a yum command... likely...

yum remove fail2ban

Open in new window


If this fails, then likely Fail2Ban has another package name, which you'll have to dig around to find... likely...

yum list installed | grep -v fail2ban

Open in new window

CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Author

Commented:
Yes, Linux 2 uses Yum but in my original question please note:

I am on a Linux 2 server which prevents me from loading any repositories or using Yum to install it.
nociSoftware Engineer
Distinguished Expert 2018

Commented:
You can make a backup of the current /etc/fail2ban before removing it. You jails would be handy to keep near by at hand to either use again or use as template for a new jails.

Author

Commented:
I made a backup of the jails and filters but I am having trouble getting the archive to explode.  I used wget from the git archives.

https://gyazo.com/33c28abe472d6a6d9d18bb3e1ca35409

Open in new window


Here is the listing of the directory showing the archive and what it is named.

https://gyazo.com/391841820343d6e228b729f0bdaa5aaf

Open in new window

Prabhin MPDevOps Engineer
Distinguished Expert 2018

Commented:
before removing the fail2ban  take backup of custom configuration if any,

download the latest fail2ban from following link,

https://github.com/fail2ban/fail2ban/archive/0.10.tar.gz
 extract and install
 make sure yiu have python version >=2.6

   tar xvfj fail2ban-0.10.3.tar.bz2
    cd fail2ban-0.10.3
    python setup.py install
nociSoftware Engineer
Distinguished Expert 2018

Commented:
try:   wget https://github.com/fail2ban/fail2ban/archive/0.10.tar.gz  or curl https://github.com/fail2ban/fail2ban/archive/0.10.tar.gz -o fail2ban-0.10.3.tar.bz2
I have no idea what gyazo  is...
fail2ban is maintained ongithub, so that is the original source.

Author

Commented:
gyazo is just a screenshot application

[root@ip-172-31-8-214 ~]# ls -la
total 84
dr-xr-x---  4 root root   244 Sep  2 10:46 .
dr-xr-xr-x 20 root root   283 Jul 25 16:52 ..
drwxr-xr-x  2 root root    25 Jul 22 17:49 .aws
-rw-------  1 root root 23742 Sep  2 05:21 .bash_history
-rw-r--r--  1 root root    18 Oct 18  2017 .bash_logout
-rw-r--r--  1 root root   176 Oct 18  2017 .bash_profile
-rw-r--r--  1 root root   176 Oct 18  2017 .bashrc
-rw-r--r--  1 root root   100 Oct 18  2017 .cshrc
-rw-r--r--  1 root root   123 Sep  2 10:46 fail2ban-0.10.3.tar.bz2
-rw-------  1 root root   866 Sep  2 04:38 .mysql_history
-rwxr-xr-x  1 root root 22322 Jul 26 12:09 ps_mem.py
-rw-------  1 root root  1024 Aug 21 07:34 .rnd
drwx------  2 root root    29 Jul 10 17:46 .ssh
-rw-r--r--  1 root root   129 Oct 18  2017 .tcshrc
-rw-r--r--  1 root root  1974 Jul 17 13:17 tortix-install.log
[root@ip-172-31-8-214 ~]# tar xvfj fail2ban-0.10.3.tar.bz2
bzip2: (stdin) is not a bzip2 file.
tar: Child returned status 2
tar: Error is not recoverable: exiting now

Open in new window

nociSoftware Engineer
Distinguished Expert 2018

Commented:
File file fail2ban-0.10.3.tar.bz2 probably tells you it is html...
Try to add -L to the curl command lineto pickup redirects.   (curl is more a basic API which needs to be told more)
curl -L https://github.com/fail2ban/fail2ban/archive/0.10.tar.gz -o fail2ban-0.10.3.tar.bz2

That should yield the bz2 file...  file fail2ban-0.10.3.tar.bz2  will tell you..
Prabhin MPDevOps Engineer
Distinguished Expert 2018

Commented:
tar jxf filename.tar.bz2 should work

Author

Commented:
I got the file but I am still getting an error:

[root@ip-172-31-8-214 etc]# tar xvfj fail2ban-0.10.3.tar.bz2
bzip2: (stdin) is not a bzip2 file.
tar: Child returned status 2
tar: Error is not recoverable: exiting now
[root@ip-172-31-8-214 etc]# tar jxf fail2ban-0.10.3.tar.bz2
bzip2: (stdin) is not a bzip2 file.
tar: Child returned status 2
tar: Error is not recoverable: exiting now

Open in new window

Software Engineer
Distinguished Expert 2018
Commented:
Order of command character IS mandatory....
jxf != xfj != xjf


The first SHOULD be the command...,  x,t, c... (eXtract,Test, Create)
f next argument is a filename
so xjf or xfj is meaningfull for eXtract, BZ2 format File ...
jxf is unkown action on ??? file... (but it seems acceptable to some versions of tar... i am sure not all of them).
The Downloaded archive isn;t a bzip2 but a gzip file... well this is surpising as the instructions mention it is a bz2...
anyway for gzip use z in stead of j...
tar xzvf fail2ban-0.10.3.tar.bz2  or tar xvfz ail2ban-0.10.3.tar.bz2
(The error message mentions bzip2 not recognizing it's input)...
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Expanding on noci's update... the f option must directly before file, so just swap your f + j.

 Likely tar jxf fail2ban-0.10.3.tar.bz2 fails because you may have a corrupt file.

Try file fail2ban-0.10.3.tar.bz2 + see if you have some other magic number (file type) come up.

Author

Commented:
Noci, your responses were correct and also your extract command.  I have it installed now but there is some problem with not all of the jails working.  However, I will create another question about that.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial