Skip to main content

Linux iptables Policy Enforcer & Auditor

Project description

AuditAgent - Linux iptables Policy Enforcer & Auditor PyPI version License Build Status

  • A Python framework for declaratively defining and enforcing iptables firewall policies across Linux servers without requiring agents on the servers themselves.

Table of Contents

Features

  • Declarative Policy Definition: Define iptables policies using Python DSL
  • Linux iptables Support: Complete support for iptables firewall rules
  • Policy Audit & Drift Detection: Compare live iptables rules against declared policies
  • Automated Remediation: Intelligent automated fixing of detected policy violations
  • Risk-Based Strategies: Conservative, balanced, and aggressive remediation approaches
  • Rollback Capabilities: Automatic rollback on validation failures
  • Idempotent Enforcement: Apply changes only when needed
  • Pre-flight Validation: Simulate changes before applying them
  • Secure Authentication: Dynamic credential prompting and SSH agent integration
  • SSH Authentication: Support for password and key-based authentication

Getting Started

Refer to the Getting Started guide for installation steps, example code, and CLI usage.

Automated Remediation

AuditAgent now supports intelligent automated remediation that can fix detected policy violations without manual intervention. This feature provides:

  • Smart Decision Making: Risk-based analysis of whether violations should be automatically fixed
  • Multiple Strategies: Choose from conservative, balanced, or aggressive remediation approaches
  • Safety First: Dry-run by default with explicit confirmation for risky changes
  • Rollback Protection: Automatic rollback if validation fails after remediation
  • Comprehensive Reporting: Detailed logs of all remediation actions taken

Quick Start

# Dry-run automated remediation (safe, shows what would be done)
audit-agent auto-remediate --devices devices.yaml --policy policy.yaml

# Execute remediation with conservative strategy
audit-agent auto-remediate --devices devices.yaml --policy policy.yaml --execute --strategy conservative

# View detailed help
audit-agent auto-remediate --help

For complete documentation, see Automated Remediation Guide.

Configuration Guide

For detailed YAML schema and reference, see the Configuration Guide.

Secure Authentication

AuditAgent supports secure authentication without hardcoded credentials. See the Secure Authentication Guide for:

  • SSH Agent Integration: Use SSH agent for key management
  • Dynamic Credential Prompting: Prompt for passwords at runtime
  • Migration from Hardcoded Credentials: Remove security risks from config files

Quick example:

devices:
  - type: "linux_iptables"
    name: "web-server-01"
    host: "192.168.0.111"
    username: "vagrant"
    private_key: "~/.ssh/id_rsa"
    # No hardcoded passwords - prompts when needed

Examples

The examples/ directory contains sample policy and device configurations:

  • simple-linux-policy.yaml: Minimal policy example
  • devices.yaml: Sample device inventory configuration
  • devices-secure.yaml: Secure device configuration without hardcoded credentials
  • web-server-policy.yaml: End-to-end web server policy
  • automated_remediation_demo.py: Demonstrates automated remediation features
  • See additional configurations in the examples/ folder.

Installation

pip install -e .

Project Structure

audit_agent/
├── core/           # Core policy and rule definitions
├── devices/        # Linux iptables implementation
├── audit/          # Audit and compliance checking
├── enforcement/    # Policy enforcement engine
├── validation/     # Pre-flight checks and validation
└── utils/          # Utilities and helpers

Supported Devices

  • Linux servers with iptables firewall

Contributing

Contributions, issues, and feature requests are welcome. Please open an issue or pull request on the GitHub repository.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

audit_agent-0.1.0.tar.gz (68.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

audit_agent-0.1.0-py3-none-any.whl (57.3 kB view details)

Uploaded Python 3

File details

Details for the file audit_agent-0.1.0.tar.gz.

File metadata

  • Download URL: audit_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 68.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for audit_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e0dcbe04f66ee955ef2633f39054cd798ebbdbea8905ce24bf9daabdf9b5c6e8
MD5 b080d12432734fc16fdfccb7f1f116ef
BLAKE2b-256 a93412a8541d9aaf40d57e8fba1a7c19527f27d4e59496e8f07467967028500f

See more details on using hashes here.

File details

Details for the file audit_agent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: audit_agent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 57.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for audit_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d6c5ca0ec2acf6fed57464e61d6cb905738b51651654dacf428ab2b8b739b6f
MD5 76f44d3e9a7105dcefb4f0a48a2f551d
BLAKE2b-256 c20c9796a1909d722fca66735460d0bb7dad8faf937f096a3331126871664c87

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page