Project

ipaccess

0.0
No release in over 3 years
Low commit activity in last 3 years
This library allows you to control IP access for sockets and other objects
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.10
~> 2.16
>= 1.1.0
>= 1.0.0
>= 0.1.2
>= 3.8.0
>= 2.1.0
>= 2.6.0
>= 0.8.2

Runtime

>= 1.5.0
 Project Readme

IP Access Control for Ruby

Gem Version

ipaccess version 1.2 (Mortal Compat)

Description

This library provides classes for controlling IP access in your programs. You can use it to build your own routines for checking IP addresses against access lists or simply use altered sockets implementation which is also shipped with this library.

Features

What's in the bag?

There are two classes used to evaluate IP access: IPAccess::List and IPAccess::Set.

First class maintains a list of rules and methods for checking whether given IP matches them. Second class is more general – it throws exceptions and distinguishes between incoming and outgoing IP traffic. That's because it maintains two access lists.

The classes described above do not interfere with any network classes and/or objects unless you code them to do that. However, this library also provides special variants of socket handling classes that use IPAccess::Set instances to control access of the real TCP/IP traffic in an easy way.

Synopsis

Total control:

require 'ipaccess/net/http'
require 'open-uri'

# Add host's IP by to black list of global output access set
IPAccess::Set::Global.output.blacklist 'example.org'

# Arm all future sockets used by Net::HTTP
IPAccess.arm Net::HTTP

# Open URI
open 'http://example.org/'

Access management for specific socket objects:

# load patched sockets
require 'ipaccess/socket'

# assume IP given by untrusted user
ip_from_user = '192.168.5.5'

# create new access set
acl = IPAccess::Set.new

# blacklist private and local subnets
acl.output.block :private, :local

# create TCP socket with IP access control
socket = IPAccess::TCPSocket(ip_from_user, 80, acl)

Requirements

Download

Source code

Gem

Installation

  • gem install ipaccess

More information

See IPAccess module's documentation for more information.

License

Copyright (c) 2009-2014 by Paweł Wilk.

IPAccess is copyrighted software owned by Paweł Wilk (pw@gnu.org). You may redistribute and/or modify this software as long as you comply with either the terms of the LGPL (see {file:docs/LGPL}), or Ruby's license (see {file:docs/COPYING}).

THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.