0.0
No commit activity in last 3 years
No release in over 3 years
Access controll by IP Address.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
> 0
>= 2

Runtime

>= 0.9.1
 Project Readme

deflectable

RailsアプリにIP制限 (ブラックリスト、ホワイトリスト)を適用

It is possible to add the ip limiting the rack app.

Installation

Add this line to your application's Gemfile:

gem 'deflectable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install deflectable

Usage

Configure

Generator

$ rails generate deflectable:install

Generated files

  • config/deflectable.yml
  • public/403.html

deflectable.yml

### config/deflectable.yml

# default false
:log: true

# :whitelist or :blacklist
:whitelist:
  - 192.168.1.1
  - 10.20.30.0/24  # ip range
  - 3ffe:505:2::1  # IPv6 supported

# default: config/deflectable.yml (Rails.root)
:config_path: Rails.root.join('vendor/app/config/setting.yml')

Modified config.ru

config.ru & deflectable.yml

# config.ru

use Deflectable::Watcher

Define the settings in the block (only config.ru)

deflectable.ymlを設置せずに、ブロックで定義することもできる。

Possible to omit the 'deflectable.yml'.

# config.ru

use Deflectable::Watcher do
  { :log => true,
    :whitelist => %w(192.168.1.1 10.20.30.0/24 3ffe:505:2::1)
  }
end