FileNotFoundError: [Errno 2] No such file or directory: 'iptables'

mr.ken84

Verified User
Joined
Apr 21, 2022
Messages
19
Today, when I reset CSF, I got an error as shown in the attached image. Could anyone provide me with a solution for this issue?
Running /usr/local/csf/bin/csfpost.sh
Checking ipsets consistent
rules checker failed with unhandled error: FileNotFoundError(2, 'No such file or directory')
Traceback (most recent call last):
File "/opt/imunify360/venv/share/imunify360/scripts/rules_checker.py", line 322, in
main(action)
File "/opt/imunify360/venv/share/imunify360/scripts/rules_checker.py", line 298, in main
loop.run_until_complete(action(rc, rp))
File "/opt/alt/python-internal/lib64/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/opt/imunify360/venv/share/imunify360/scripts/rules_checker.py", line 164, in check_ipsets_consistent
await rc.recreate_rules_if_needed()
File "/opt/imunify360/venv/lib64/python3.11/site-packages/im360/utils/lazy_init.py", line 107, in recreate_rules_if_needed
await self._ensure_rules_exist_for_all_versions(
File "/opt/imunify360/venv/lib64/python3.11/site-packages/im360/utils/lazy_init.py", line 217, in _ensure_rules_exist_for_all_versions
if await self._ensure_rules(interface_conf, recreate_any_way):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/imunify360/venv/lib64/python3.11/site-packages/im360/utils/lazy_init.py", line 164, in _ensure_rules
r = await self._ensure_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/imunify360/venv/lib64/python3.11/site-packages/im360/utils/lazy_init.py", line 296, in _ensure_for
rules_ok = await self._rules_ok(interface_conf, ip_version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/imunify360/venv/lib64/python3.11/site-packages/im360/utils/lazy_init.py", line 368, in _rules_ok
async with await get_firewall(ip_version) as firewall:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/imunify360/venv/lib64/python3.11/site-packages/im360/internals/core/firewall/__init__.py", line 39, in get_firewall
return Iptables(version=iptables_version(), ip_version=ip_version)
^^^^^^^^^^^^^^^^^^
File "/opt/imunify360/venv/lib64/python3.11/site-packages/im360/internals/core/firewall/__init__.py", line 19, in iptables_version
out = subprocess.check_output(cmd, stderr=subprocess.PIPE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/imunify360/venv/lib64/python3.11/site-packages/defence360agent/utils/subprocess.py", line 43, in check_output
return subprocess.check_output(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/alt/python-internal/lib64/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/alt/python-internal/lib64/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/imunify360/venv/lib64/python3.11/site-packages/sentry_sdk/integrations/stdlib.py", line 190, in sentry_patched_popen_init
rv = old_popen_init(self, *a, **kw) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/alt/python-internal/lib64/python3.11/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/opt/alt/python-internal/lib64/python3.11/subprocess.py", line 1955, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'iptables'
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
 

Attachments

  • screenshot_1755921063.png
    screenshot_1755921063.png
    89.4 KB · Views: 7
  • screenshot_1755921122.png
    screenshot_1755921122.png
    74.2 KB · Views: 6
Hello,

The script /usr/local/csf/bin/csfpost.sh is not the default one and was not installed by DirectAdmin either. It seems it was installed by imunify360. So you will need to check the installation of imunify360 and remove the script if you no longer use imunify360.
 
Back
Top