config/environments/development.rb:
require 'socket'
require 'ipaddr'
Rails.application.configure do
...
config.web_console.permissions = Socket.getifaddrs
.select { |ifa| ifa.addr.ipv4_private? }
.map { |ifa| IPAddr.new(ifa.addr.ip_address + '/' + ifa.netmask.ip_address) }
...
endAlternatively:
require 'socket'
require 'ipaddr'
Rails.application.configure do
...
config.web_console.permissions = Socket.getifaddrs.select { |ifa| ifa.addr.ipv4_private? }
.map { |ifa| '%s/%s' % [
ifa.addr.ip_address,
IPAddr.new(ifa.netmask.ip_address).to_i.digits(2).select{ |d| d == 1 }.length,
] }
...
endBefore web-console-4.0 the setting name is whitelisted_ips.