psad icon indicating copy to clipboard operation
psad copied to clipboard

Iptables not found in Ubuntu 20.04

Open elliotjberg opened this issue 4 years ago • 2 comments

I was previously running a Ubuntu 18.04 server with PSAD configured and working as expected, which I recently upgraded to 20.04. Since doing so, PSAD won't start - it gives the error Could not find/execute iptables, specify path via _iptables at /usr/share/perl5/IPTables/ChainMgr.pm line 37. I have edited /etc/psad/psad.conf and changed

iptablesCmd      /sbin/iptables;
ip6tablesCmd     /sbin/ip6tables;

to

iptablesCmd      /usr/sbin/iptables;
ip6tablesCmd     /usr/sbin/ip6tables;

to match where iptables is on the filesystem;

which iptables
/usr/sbin/iptables

But this makes no difference. I have also tried setting

ENABLE_OVERRIDE_FW_CMD Y;
FW_CMD /usr/sbin/iptables;

Which also seems to make no difference. I'm running v2.4.3 from the Ubuntu repositories.

Any indication as to how I can address this?

elliotjberg avatar Dec 14 '20 18:12 elliotjberg

I had the same problem - quick and dirty solution: sudo ln -s /usr/sbin/iptables /sbin/iptables sudo ln -s /usr/sbin/ip6tables /sbin/ip6tables

It looks like IPTables::ChainMgr use the defaults defined in IPTables::Parse. While on the other side according to https://github.com/mrash/psad/blob/8720f6aacc6139f6d017ba8443b49eeab7ebf04c/psad#L3445-L3462 it doesn't look like psad was designed to pass the iptablesCmd config options down to IPTables:ChainMgr.

andweber avatar Feb 16 '21 22:02 andweber

@mrash this looks like an easy fix, is it possible to update lines 32-34 of Parse.pm of the IPTables::Parse module to obtain the binary locations from the environment?

Version 1.6.1 reads:

    ### default iptables/ip6tables/firewall-cmd paths
    my $ipt_bin    = '/sbin/iptables';
    my $ipt6_bin   = '/sbin/ip6tables';
    my $fwc_bin    = '/usr/bin/firewall-cmd';

daydr3am3r avatar Dec 29 '22 20:12 daydr3am3r