aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/certmanager.lua4
-rw-r--r--core/configmanager.lua38
-rw-r--r--core/features.lua2
-rw-r--r--core/moduleapi.lua8
4 files changed, 29 insertions, 23 deletions
diff --git a/core/certmanager.lua b/core/certmanager.lua
index 9e0ace6a..1c9cefed 100644
--- a/core/certmanager.lua
+++ b/core/certmanager.lua
@@ -189,10 +189,6 @@ local core_defaults = {
single_ecdh_use = tls.features.options.single_ecdh_use;
no_renegotiation = tls.features.options.no_renegotiation;
};
- verifyext = {
- "lsec_continue", -- Continue past certificate verification errors
- "lsec_ignore_purpose", -- Validate client certificates as if they were server certificates
- };
curve = tls.features.algorithms.ec and not tls.features.capabilities.curves_list and "secp384r1";
curveslist = {
"X25519",
diff --git a/core/configmanager.lua b/core/configmanager.lua
index 023545d7..6c6b670b 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -34,8 +34,9 @@ local parser = nil;
local config_mt = { __index = function (t, _) return rawget(t, "*"); end};
local config = setmetatable({ ["*"] = { } }, config_mt);
-local delayed_warnings = {};
local files = {};
+local credentials_directory = nil;
+local credential_fallback_fatal = true;
-- When host not found, use global
local host_mt = { __index = function(_, k) return config["*"][k] end }
@@ -45,11 +46,12 @@ function _M.getconfig()
end
function _M.get(host, key)
- if host and key and delayed_warnings[host.."/"..key] then
- local warning = delayed_warnings[host.."/"..key];
- log("warn", "%s", warning.text);
+ local v = config[host][key];
+ if v and errors.is_error(v) then
+ log("warn", "%s:%d: %s", v.context.filename, v.context.fileline, v.text);
+ return nil;
end
- return config[host][key];
+ return v;
end
function _M.rawget(host, key)
local hostconfig = rawget(config, host);
@@ -250,10 +252,6 @@ do
t_insert(warnings, ("%s:%d: Duplicate option '%s'"):format(config_file, get_line_number(config_file), k));
end
set_options[option_path] = true;
- if errors.is_error(v) then
- delayed_warnings[option_path] = v;
- return;
- end
set(config_table, env.__currenthost or "*", k, v);
end
});
@@ -371,19 +369,17 @@ do
env.FileLine = filereader(config_path, "*l");
env.FileLines = linereader(config_path);
- if _G.prosody.paths.credentials then
- env.Credential = filereader(_G.prosody.paths.credentials, "*a");
- elseif _G.prosody.process_type == "prosody" then
+ if credentials_directory then
+ env.Credential = filereader(credentials_directory, "*a");
+ elseif credential_fallback_fatal then
env.Credential = function() error("Credential() requires the $CREDENTIALS_DIRECTORY environment variable to be set", 2) end
else
env.Credential = function()
return errors.new({
- type = "continue",
- text = ("%s:%d: Credential() requires the $CREDENTIALS_DIRECTORY environment variable to be set")
- :format(config_file, get_line_number(config_file));
- });
+ type = "continue";
+ text = "Credential() requires the $CREDENTIALS_DIRECTORY environment variable to be set";
+ }, { filename = config_file; fileline = get_line_number(config_file) });
end
-
end
local chunk, err = envload(data, "@"..config_file, env);
@@ -405,4 +401,12 @@ do
end
+function _M.set_credentials_directory(directory)
+ credentials_directory = directory;
+end
+
+function _M.set_credential_fallback_mode(mode)
+ credential_fallback_fatal = mode == "error";
+end
+
return _M;
diff --git a/core/features.lua b/core/features.lua
index d8cefe74..8e155f70 100644
--- a/core/features.lua
+++ b/core/features.lua
@@ -12,6 +12,8 @@ return {
"mod_cloud_notify";
-- mod_muc has built-in vcard support
"muc_vcard";
+ -- mod_http_altconnect bundled
+ "http_altconnect";
-- Roles, module.may and per-session authz
"permissions";
-- prosody.* namespace
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index b93536b5..50524b32 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -136,10 +136,14 @@ function api:require(lib)
return f();
end
-function api:depends(name)
+function api:depends(name, soft)
local modulemanager = require"prosody.core.modulemanager";
if self:get_option_inherited_set("modules_disabled", {}):contains(name) then
- error("Dependency on disabled module mod_"..name);
+ if not soft then
+ error("Dependency on disabled module mod_"..name);
+ end
+ self:log("debug", "Not loading disabled soft dependency mod_%s", name);
+ return nil, "disabled";
end
if not self.dependencies then
self.dependencies = {};