Skip to main content

Simple Python client library for Iptables

Project description

iptables

Introduction

Native iptables is not friendly enough for most users. This module is trying to make Linux/Iptables working like security groups in cloud environments.

Scenarios

  • Service must be public facing, but still wants to block random bad ipaddress easily.
  • Scripting interface talking to iptables, be convenient like same thing in cloud.

Examples

To protect your personal web server
from pyiptables import securitygroup as sg

# Create a security group based on tcp/port, naming associated to your to-be-protected service.
sg.create_security_group(security_group_name='httpd', dst_port='80')

# Create, append/insert, rules based on source address, with action accept/reject/drop.
sg.create_security_group_rule(security_group_name='httpd', 
                              src_addr='1.2.3.0/24',
                              rule_action='insert',
                              packet_action='DROP')
sg.create_security_group_rule(security_group_name='httpd',
                              src_addr='2.3.4.0/24',
                              rule_action='insert',
                              packet_action='DROP')

# List current rules for a given security group.
sg.list_security_group_rules(security_group_name='httpd')

# Delete a given rule for a security group.
sg.delete_security_group_rule(security_group_name='httpd', rule_id='HTTPD_kfnsznwvb0mzn3uh')

# Delete a given security group and its rules completely.
sg.delete_security_group(security_group_name='httpd')

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

pyiptables-2.0.7.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

pyiptables-2.0.7-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file pyiptables-2.0.7.tar.gz.

File metadata

  • Download URL: pyiptables-2.0.7.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for pyiptables-2.0.7.tar.gz
Algorithm Hash digest
SHA256 323d75e43a95007cf4945e75eeb0f029b2e1aeda3ddf15f08da022ce189c424c
MD5 12c73c7ba21677436b97926374971671
BLAKE2b-256 778f44f6f01a111d2e863ea437c3855836e85cd6eb5568a93f96173449e15ea0

See more details on using hashes here.

File details

Details for the file pyiptables-2.0.7-py3-none-any.whl.

File metadata

  • Download URL: pyiptables-2.0.7-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for pyiptables-2.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a1f192b15b1bb627a2232e17b3defe34ec691980138d53ade897682f8739d027
MD5 9125b987a7dccab8bca5c1252ff92324
BLAKE2b-256 8373a93d913efb25a1cb4e0373366862dc65c5f0ab4baaa2589001c3b5e3eb5e

See more details on using hashes here.

Supported by

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