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.5.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for pyiptables-2.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a53065d2ccf47dc138d68bfe7e037b9d89ca7a7551f570963f898f6bf1ec2f38 |
|
MD5 | 9930bfa6984d3b9c31559bc17d0ce257 |
|
BLAKE2b-256 | 0c6cb89ddc05243b44fa928d397fcce3be45d2d17ac2337866add62e33d73086 |