mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
renames
This commit is contained in:
@@ -13,7 +13,7 @@ def _install_chatctl() -> None:
|
||||
"""Setup chatctl."""
|
||||
files.put(
|
||||
src=importlib.resources.files(__package__)
|
||||
.joinpath("chatctl/chatctl.py")
|
||||
.joinpath("dovecot/doveauth.py")
|
||||
.open("rb"),
|
||||
dest="/home/vmail/chatctl",
|
||||
user="vmail",
|
||||
@@ -103,8 +103,8 @@ def _configure_dovecot(mail_server: str) -> bool:
|
||||
|
||||
# luarocks install http lpeg_patterns fifo
|
||||
auth_script = files.put(
|
||||
src=importlib.resources.files(__package__).joinpath("dovecot/auth.lua"),
|
||||
dest="/etc/dovecot/auth.lua",
|
||||
src=importlib.resources.files(__package__).joinpath("dovecot/doveauth.lua"),
|
||||
dest="/etc/dovecot/doveauth.lua",
|
||||
user="root",
|
||||
group="root",
|
||||
mode="644",
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
-- Lua based authentication script for Dovecot.
|
||||
--
|
||||
-- It calls external chatctl command to answer requests.
|
||||
|
||||
-- Hexadecimal aka base16 encoding.
|
||||
function hex(data)
|
||||
return (data:gsub(".", function(char) return string.format("%2X", char:byte()) end))
|
||||
end
|
||||
|
||||
-- Escape shell argument by hex encoding it and wrapping in quotes.
|
||||
function escape(data)
|
||||
return ("'"..hex(data).."'")
|
||||
end
|
||||
|
||||
function auth_password_verify(request, password)
|
||||
if os.execute("/home/vmail/chatctl hexauth "..escape(request.user).." "..escape(password)) then
|
||||
return dovecot.auth.PASSDB_RESULT_OK, {}
|
||||
end
|
||||
return dovecot.auth.PASSDB_RESULT_PASSWORD_MISMATCH, ""
|
||||
end
|
||||
|
||||
function auth_passdb_lookup(request)
|
||||
if os.execute("/home/vmail/chatctl hexlookup "..escape(request.user)) then
|
||||
return dovecot.auth.PASSDB_RESULT_OK, {}
|
||||
end
|
||||
return dovecot.auth.PASSDB_RESULT_USER_UNKNOWN, "no such user"
|
||||
end
|
||||
|
||||
function auth_userdb_lookup(request)
|
||||
if os.execute("/home/vmail/chatctl hexlookup "..escape(request.user)) then
|
||||
return dovecot.auth.USERDB_RESULT_OK, "uid=vmail gid=vmail"
|
||||
end
|
||||
|
||||
return dovecot.auth.USERDB_RESULT_USER_UNKNOWN, "no such user"
|
||||
end
|
||||
@@ -7,11 +7,11 @@ auth_mechanisms = plain
|
||||
# Authentication for system users.
|
||||
passdb {
|
||||
driver = lua
|
||||
args = file=/etc/dovecot/auth.lua
|
||||
args = file=/etc/dovecot/doveauth.lua
|
||||
}
|
||||
userdb {
|
||||
driver = lua
|
||||
args = file=/etc/dovecot/auth.lua
|
||||
args = file=/etc/dovecot/doveauth.lua
|
||||
}
|
||||
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user