public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Dovecot] Increase Timeout for HTTP Login Request
4ad24228
data/conf/dovecot/auth/passwd-verify.lua | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
Diff
diff --git a/data/conf/dovecot/auth/passwd-verify.lua b/data/conf/dovecot/auth/passwd-verify.lua
index cb2e928d..d235173d 100644
--- a/data/conf/dovecot/auth/passwd-verify.lua
+++ b/data/conf/dovecot/auth/passwd-verify.lua
@@ -3,10 +3,10 @@ function auth_password_verify(request, password)
return dovecot.auth.PASSDB_RESULT_USER_UNKNOWN, "No such user"
end
- json = require "cjson"
- ltn12 = require "ltn12"
- https = require "ssl.https"
- https.TIMEOUT = 5
+ local json = require "cjson"
+ local ltn12 = require "ltn12"
+ local https = require "ssl.https"
+ https.TIMEOUT = 30
local req = {
username = request.user,
@@ -16,8 +16,7 @@ function auth_password_verify(request, password)
}
req.protocol[request.service] = true
local req_json = json.encode(req)
- local res = {}
-
+ local res = {}
local b, c = https.request {
method = "POST",
url = "https://nginx:9082",
@@ -29,11 +28,16 @@ function auth_password_verify(request, password)
sink = ltn12.sink.table(res),
insecure = true
}
+
+ if c ~= 200 then
+ dovecot.i_info("HTTP request failed with " .. c .. " for user " .. request.user)
+ return dovecot.auth.PASSDB_RESULT_INTERNAL_FAILURE, "Upstream error"
+ end
+
local api_response = json.decode(table.concat(res))
if api_response.success == true then
return dovecot.auth.PASSDB_RESULT_OK, ""
end
-
return dovecot.auth.PASSDB_RESULT_PASSWORD_MISMATCH, "Failed to authenticate"
end