mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Allow specifying multiple ips for webclients #2744
This commit is contained in:
parent
dcf39d1017
commit
4adaac6f47
6 changed files with 15 additions and 12 deletions
|
@ -8,7 +8,8 @@ module Repp
|
|||
end
|
||||
|
||||
before do
|
||||
if request.ip != ENV['webclient_ip']
|
||||
webclient_request = ENV['webclient_ips'].split(',').map(&:strip).include?(request.ip)
|
||||
unless webclient_request
|
||||
error! I18n.t('ip_is_not_whitelisted'), 401 unless @current_user.registrar.api_ip_white?(request.ip)
|
||||
end
|
||||
|
||||
|
@ -20,7 +21,7 @@ module Repp
|
|||
message = 'Certificate mismatch! Cert common name should be:'
|
||||
request_name = env['HTTP_SSL_CLIENT_S_DN_CN']
|
||||
|
||||
if request.ip == ENV['webclient_ip']
|
||||
if webclient_request
|
||||
webclient_cert_name = ENV['webclient_cert_common_name'] || 'webclient'
|
||||
error! "Webclient #{message} #{webclient_cert_name}", 401 if webclient_cert_name != request_name
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue