4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/letsencrypt_http_challenge/application_controller.rb', line 4
def index
challenge = params[:challenge].to_s
response = ENV['LE_HTTP_CHALLENGE_RESPONSE'].to_s
status = :ok
if challenge.length < 16
response = 'Challenge failed - The token must have at least 128 bits of entropy'
Rails.logger.error response
status = :bad_request
elsif response.match(challenge).nil?
response = 'Challenge failed - The token must match between the challenge and the response'
Rails.logger.error response
status = :bad_request
end
render plain: response, status: status
end
|