mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Added iptables counter update script
This commit is contained in:
parent
80e4fe0529
commit
bb6186c33b
6 changed files with 47 additions and 23 deletions
15
lib/iptable.rb
Normal file
15
lib/iptable.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
module Iptable
|
||||
def counter_update(registrar_code, ip)
|
||||
counter_proc = "/proc/net/xt_recent/#{registrar_code}"
|
||||
|
||||
begin
|
||||
File.open(counter_proc, 'a') do |f|
|
||||
f.puts "+#{ip}"
|
||||
end
|
||||
rescue Errno::ENOENT => e
|
||||
logger.error "ERROR: cannot open #{counter_proc}: #{e}"
|
||||
rescue IOError => e
|
||||
logger.error "ERROR: cannot write #{ip} to #{counter_proc}: #{e}"
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue