/usr/share/cagefs-skeleton/opt/imunify360/venv/lib/python3.11/site-packages/im360/simple_rpc
"""An RPC interface to SMTP blocking subsystem. It is needed only for manual testing purposes. """ import logging from defence360agent.rpc_tools import lookup, ValidationError from defence360agent.utils import Scope, check_disabled_firewall from im360.subsys.smtp_blocking import ( sync_rules_for_all_versions, reset_rules_for_all_versions, is_SMTP_blocking_supported, read_SMTP_settings, conflicts_exist, ) __all__ = ["SMTPEndpoints"] logger = logging.getLogger(__name__) class SMTPEndpoints(lookup.RootEndpoints): SCOPE = Scope.IM360 @lookup.bind("smtp-blocking", "sync") @check_disabled_firewall async def sync_rules(self): """Create SMTP blocking iptables rules according to settings.""" if await is_SMTP_blocking_supported(): if await conflicts_exist(): raise ValidationError( "SMTP blocking conflicts with third party features" ) smtp_settings = read_SMTP_settings() await sync_rules_for_all_versions(smtp_settings) else: raise ValidationError( "SMTP blocking is not supported by current kernel" ) @lookup.bind("smtp-blocking", "reset") @check_disabled_firewall async def reset_rules(self): """Remove all rules installed by this plugin.""" if await is_SMTP_blocking_supported(): if await conflicts_exist(): raise ValidationError( "SMTP blocking conflicts with third party features" ) await reset_rules_for_all_versions() else: raise ValidationError( "SMTP blocking is not supported by current kernel" )
.
Edit
..
Edit
__init__.py
Edit
__pycache__
Edit
configuration_management.py
Edit
conflicts.py
Edit
control_panel.py
Edit
countries.py
Edit
csf_imports.py
Edit
custom_lists.py
Edit
disabled_rules.py
Edit
feature.py
Edit
health.py
Edit
hosting_panel.py
Edit
incidents.py
Edit
kcarectl.py
Edit
lists.py
Edit
malware.py
Edit
middleware.py
Edit
proactive.py
Edit
remote_proxy.py
Edit
resident_socket.py
Edit
schema
Edit
schema.py
Edit
schema_responses
Edit
smart_advice.py
Edit
smtp_blocking.py
Edit
unavailable_on_freemium.py
Edit
uninstall_cleanup.py
Edit
validate.py
Edit
whitelist_rbl.py
Edit
whitelisted_crawlers.py
Edit
whitelisted_domains.py
Edit