mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Check webclient cert in EPP when connecting from local network #2765
This commit is contained in:
parent
cac73b1224
commit
9fd38f161a
2 changed files with 18 additions and 0 deletions
|
@ -13,6 +13,15 @@ class Epp::SessionsController < EppController
|
|||
success = true
|
||||
@api_user = ApiUser.find_by(login_params)
|
||||
|
||||
if request.ip == ENV['webclient_ip'] && !Rails.env.test?
|
||||
client_md5 = Certificate.parse_md_from_string(request.env['HTTP_SSL_CLIENT_CERT'])
|
||||
server_md5 = Certificate.parse_md_from_string(File.read(ENV['cert_path']))
|
||||
if client_md5 != server_md5
|
||||
@msg = 'Authentication error; server closing connection (certificate is not valid)'
|
||||
success = false
|
||||
end
|
||||
end
|
||||
|
||||
if request.ip != ENV['webclient_ip'] && @api_user
|
||||
unless @api_user.api_pki_ok?(request.env['HTTP_SSL_CLIENT_CERT'], request.env['HTTP_SSL_CLIENT_S_DN_CN'])
|
||||
@msg = 'Authentication error; server closing connection (certificate is not valid)'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue