From f242c604d4e9afbfb2b4a6b602b73a1748feaa1e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 14 Jul 2019 03:12:25 +0200 Subject: [PATCH] Fix mode smacks --- conf/mod_smacks.lua | 291 +++++++++++++++++++++++++++++++++++++------- conf/nginx.conf | 2 +- scripts/backup | 2 +- scripts/install | 4 +- scripts/remove | 2 +- scripts/restore | 2 +- 6 files changed, 256 insertions(+), 47 deletions(-) diff --git a/conf/mod_smacks.lua b/conf/mod_smacks.lua index 709c4df..1ef6a50 100644 --- a/conf/mod_smacks.lua +++ b/conf/mod_smacks.lua @@ -1,20 +1,25 @@ --- XEP-0198: Stream Management for Prosody IM +-- XEP-0198: Stream Management for metronome IM -- -- Copyright (C) 2010-2015 Matthew Wild -- Copyright (C) 2010 Waqas Hussain -- Copyright (C) 2012-2015 Kim Alvefur -- Copyright (C) 2012 Thijs Alkemade -- Copyright (C) 2014 Florian Zeitz +-- Copyright (C) 2016-2017 Thilo Molitor -- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- local st = require "util.stanza"; +local dep = require "util.dependencies"; +local cache = dep.softreq("util.cache"); -- only available in metronome 0.10+ local uuid_generate = require "util.uuid".generate; +local jid = require "util.jid"; local t_insert, t_remove = table.insert, table.remove; local math_min = math.min; +local math_max = math.max; local os_time = os.time; local tonumber, tostring = tonumber, tostring; local add_filter = require "util.filters".add_filter; @@ -31,18 +36,101 @@ local sm3_attr = { xmlns = xmlns_sm3 }; local resume_timeout = module:get_option_number("smacks_hibernation_time", 300); local s2s_smacks = module:get_option_boolean("smacks_enabled_s2s", false); +local s2s_resend = module:get_option_boolean("smacks_s2s_resend", false); local max_unacked_stanzas = module:get_option_number("smacks_max_unacked_stanzas", 0); -local core_process_stanza = prosody.core_process_stanza; +local delayed_ack_timeout = module:get_option_number("smacks_max_ack_delay", 60); +local max_hibernated_sessions = module:get_option_number("smacks_max_hibernated_sessions", 10); +local max_old_sessions = module:get_option_number("smacks_max_old_sessions", 10); +local core_process_stanza = metronome.core_process_stanza; local sessionmanager = require"core.sessionmanager"; +assert(max_hibernated_sessions > 0, "smacks_max_hibernated_sessions must be greater than 0"); +assert(max_old_sessions > 0, "smacks_old_sessions must be greater than 0"); + local c2s_sessions = module:shared("/*/c2s/sessions"); -local session_registry = {}; + +local function init_session_cache(max_entries, evict_callback) + -- old metronome version < 0.10 (no limiting at all!) + if not cache then + local store = {}; + return { + get = function(user, key) + if not user then return nil; end + if not key then return nil; end + return store[key]; + end; + set = function(user, key, value) + if not user then return nil; end + if not key then return nil; end + store[key] = value; + end; + }; + end + + -- use per user limited cache for metronome >= 0.10 + local stores = {}; + return { + get = function(user, key) + if not user then return nil; end + if not key then return nil; end + if not stores[user] then + stores[user] = cache.new(max_entries, evict_callback); + end + return stores[user]:get(key); + end; + set = function(user, key, value) + if not user then return nil; end + if not key then return nil; end + if not stores[user] then stores[user] = cache.new(max_entries, evict_callback); end + stores[user]:set(key, value); + -- remove empty caches completely + if not stores[user]:count() then stores[user] = nil; end + end; + }; +end +local old_session_registry = init_session_cache(max_old_sessions, nil); +local session_registry = init_session_cache(max_hibernated_sessions, function(resumption_token, session) + if session.destroyed then return true; end -- destroyed session can always be removed from cache + session.log("warn", "User has too much hibernated sessions, removing oldest session (token: %s)", resumption_token); + -- store old session's h values on force delete + -- save only actual h value and username/host (for security) + old_session_registry.set(session.username, resumption_token, { + h = session.handled_stanza_count, + username = session.username, + host = session.host + }); + return true; -- allow session to be removed from full cache to make room for new one +end); + +local function stoppable_timer(delay, callback) + local stopped = false; + local timer = module:add_timer(delay, function (t) + if stopped then return; end + return callback(t); + end); + if timer and timer.stop then return timer; end -- new metronome api includes stop() function + return { + stop = function () stopped = true end; + timer; + }; +end + +local function delayed_ack_function(session) + -- fire event only if configured to do so and our session is not hibernated or destroyed + if delayed_ack_timeout > 0 and session.awaiting_ack + and not session.hibernating and not session.destroyed then + session.log("debug", "Firing event 'smacks-ack-delayed', queue = %d", + session.outgoing_stanza_queue and #session.outgoing_stanza_queue or 0); + module:fire_event("smacks-ack-delayed", {origin = session, queue = session.outgoing_stanza_queue}); + end + session.delayed_ack_timer = nil; +end local function can_do_smacks(session, advertise_only) if session.smacks then return false, "unexpected-request", "Stream management is already enabled"; end local session_type = session.type; - if session_type == "c2s" then + if session.username then if not(advertise_only) and not(session.resource) then -- Fail unless we're only advertising sm return false, "unexpected-request", "Client must bind a resource before enabling stream management"; end @@ -69,6 +157,40 @@ module:hook("s2s-stream-features", end end); +local function request_ack_if_needed(session, force, reason) + local queue = session.outgoing_stanza_queue; + if session.awaiting_ack == nil and not session.hibernating then + if (#queue > max_unacked_stanzas and session.last_queue_count ~= #queue) or force then + session.log("debug", "Queuing (in a moment) from %s - #queue=%d", reason, #queue); + session.awaiting_ack = false; + session.awaiting_ack_timer = stoppable_timer(1e-06, function () + if not session.awaiting_ack and not session.hibernating then + session.log("debug", "Sending (inside timer, before send)"); + (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })) + session.log("debug", "Sending (inside timer, after send)"); + session.awaiting_ack = true; + if not session.delayed_ack_timer then + session.delayed_ack_timer = stoppable_timer(delayed_ack_timeout, function() + delayed_ack_function(session); + end); + end + end + end); + end + end + + -- Trigger "smacks-ack-delayed"-event if we added new (ackable) stanzas to the outgoing queue + -- and there isn't already a timer for this event running. + -- If we wouldn't do this, stanzas added to the queue after the first "smacks-ack-delayed"-event + -- would not trigger this event (again). + if #queue > max_unacked_stanzas and session.awaiting_ack and session.delayed_ack_timer == nil then + session.log("debug", "Calling delayed_ack_function directly (still waiting for ack)"); + delayed_ack_function(session); + end + + session.last_queue_count = #queue; +end + local function outgoing_stanza_filter(stanza, session) local is_stanza = stanza.attr and not stanza.attr.xmlns and not stanza.name:find":"; if is_stanza and not stanza._cached then -- Stanza in default stream namespace @@ -77,19 +199,20 @@ local function outgoing_stanza_filter(stanza, session) cached_stanza._cached = true; if cached_stanza and cached_stanza.name ~= "iq" and cached_stanza:get_child("delay", xmlns_delay) == nil then - cached_stanza = cached_stanza:tag("delay", { xmlns = xmlns_delay, from = session.host, stamp = datetime.datetime()}); + cached_stanza = cached_stanza:tag("delay", { + xmlns = xmlns_delay, + from = jid.bare(session.full_jid or session.host), + stamp = datetime.datetime() + }); end queue[#queue+1] = cached_stanza; - session.log("debug", "#queue = %d", #queue); if session.hibernating then session.log("debug", "hibernating, stanza queued"); - return ""; -- Hack to make session.send() not return nil - end - if #queue > max_unacked_stanzas and not session.awaiting_ack then - session.awaiting_ack = true; - return tostring(stanza)..tostring(st.stanza("r", { xmlns = session.smacks })); + module:fire_event("smacks-hibernation-stanza-queued", {origin = session, queue = queue, stanza = cached_stanza}); + return nil; end + request_ack_if_needed(session, false, "outgoing_stanza_filter"); end return stanza; end @@ -108,14 +231,19 @@ local function wrap_session_out(session, resume) session.last_acknowledged_stanza = 0; end - add_filter(session, "stanzas/out", outgoing_stanza_filter, -1000); + add_filter(session, "stanzas/out", outgoing_stanza_filter, -999); local session_close = session.close; function session.close(...) if session.resumption_token then - session_registry[session.resumption_token] = nil; + session_registry.set(session.username, session.resumption_token, nil); + old_session_registry.set(session.username, session.resumption_token, nil); session.resumption_token = nil; end + -- send out last ack as per revision 1.5.2 of XEP-0198 + if session.smacks and session.conn then + (session.sends2s or session.send)(st.stanza("a", { xmlns = session.smacks, h = string.format("%d", session.handled_stanza_count) })); + end return session_close(...); end return session; @@ -125,7 +253,7 @@ local function wrap_session_in(session, resume) if not resume then session.handled_stanza_count = 0; end - add_filter(session, "stanzas/in", count_incoming_stanzas, 1000); + add_filter(session, "stanzas/in", count_incoming_stanzas, 999); return session; end @@ -153,10 +281,10 @@ function handle_enable(session, stanza, xmlns_sm) local resume = stanza.attr.resume; if resume == "true" or resume == "1" then resume_token = uuid_generate(); - session_registry[resume_token] = session; + session_registry.set(session.username, resume_token, session); session.resumption_token = resume_token; end - (session.sends2s or session.send)(st.stanza("enabled", { xmlns = xmlns_sm, id = resume_token, resume = resume })); + (session.sends2s or session.send)(st.stanza("enabled", { xmlns = xmlns_sm, id = resume_token, resume = resume, max = tostring(resume_timeout) })); return true; end module:hook_stanza(xmlns_sm2, "enable", function (session, stanza) return handle_enable(session, stanza, xmlns_sm2); end, 100); @@ -164,7 +292,7 @@ module:hook_stanza(xmlns_sm3, "enable", function (session, stanza) return handle module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) - module:add_timer(0, function () + stoppable_timer(1e-6, function () if can_do_smacks(session) then if stanza:get_child("sm", xmlns_sm3) then session.sends2s(st.stanza("enable", sm3_attr)); @@ -200,7 +328,11 @@ function handle_r(origin, stanza, xmlns_sm) end module:log("debug", "Received ack request, acking for %d", origin.handled_stanza_count); -- Reply with - (origin.sends2s or origin.send)(st.stanza("a", { xmlns = xmlns_sm, h = tostring(origin.handled_stanza_count) })); + (origin.sends2s or origin.send)(st.stanza("a", { xmlns = xmlns_sm, h = string.format("%d", origin.handled_stanza_count) })); + -- piggyback our own ack request + if #origin.outgoing_stanza_queue > 0 and origin.last_queue_count ~= #origin.outgoing_stanza_queue then + request_ack_if_needed(origin, true, "piggybacked by handle_r"); + end return true; end module:hook_stanza(xmlns_sm2, "r", function (origin, stanza) return handle_r(origin, stanza, xmlns_sm2); end); @@ -209,11 +341,19 @@ module:hook_stanza(xmlns_sm3, "r", function (origin, stanza) return handle_r(ori function handle_a(origin, stanza) if not origin.smacks then return; end origin.awaiting_ack = nil; + if origin.awaiting_ack_timer then + origin.awaiting_ack_timer:stop(); + end + if origin.delayed_ack_timer then + origin.delayed_ack_timer:stop(); + origin.delayed_ack_timer = nil; + end -- Remove handled stanzas from outgoing_stanza_queue - --log("debug", "ACK: h=%s, last=%s", stanza.attr.h or "", origin.last_acknowledged_stanza or ""); + -- origin.log("debug", "ACK: h=%s, last=%s", stanza.attr.h or "", origin.last_acknowledged_stanza or ""); local h = tonumber(stanza.attr.h); if not h then origin:close{ condition = "invalid-xml"; text = "Missing or invalid 'h' attribute"; }; + return; end local handled_stanza_count = h-origin.last_acknowledged_stanza; local queue = origin.outgoing_stanza_queue; @@ -225,11 +365,15 @@ function handle_a(origin, stanza) origin.log("debug", "Q item %d: %s", i, tostring(queue[i])); end end + for i=1,math_min(handled_stanza_count,#queue) do - t_remove(origin.outgoing_stanza_queue, 1); + local handled_stanza = t_remove(origin.outgoing_stanza_queue, 1); + module:fire_event("delivery/success", { session = origin, stanza = handled_stanza }); end + origin.log("debug", "#queue = %d", #queue); origin.last_acknowledged_stanza = origin.last_acknowledged_stanza + handled_stanza_count; + request_ack_if_needed(origin, false, "handle_a") return true; end module:hook_stanza(xmlns_sm2, "a", handle_a); @@ -246,12 +390,14 @@ function handle_unacked_stanzas(session) if #queue > 0 then session.outgoing_stanza_queue = {}; for i=1,#queue do - local reply = st.reply(queue[i]); - if reply.attr.to ~= session.full_jid then - reply.attr.type = "error"; - reply:tag("error", error_attr) - :tag("recipient-unavailable", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}); - core_process_stanza(session, reply); + if not module:fire_event("delivery/failure", { session = session, stanza = queue[i] }) then + local reply = st.reply(queue[i]); + if reply.attr.to ~= session.full_jid then + reply.attr.type = "error"; + reply:tag("error", error_attr) + :tag("recipient-unavailable", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}); + core_process_stanza(session, reply); + end end end end @@ -263,7 +409,7 @@ module:hook("pre-resource-unbind", function (event) if not session.resumption_token then local queue = session.outgoing_stanza_queue; if #queue > 0 then - session.log("warn", "Destroying session with %d unacked stanzas", #queue); + session.log("debug", "Destroying session with %d unacked stanzas", #queue); handle_unacked_stanzas(session); end else @@ -271,6 +417,7 @@ module:hook("pre-resource-unbind", function (event) local hibernate_time = os_time(); -- Track the time we went into hibernation session.hibernating = hibernate_time; local resumption_token = session.resumption_token; + module:fire_event("smacks-hibernation-start", {origin = session, queue = session.outgoing_stanza_queue}); timer.add_task(resume_timeout, function () session.log("debug", "mod_smacks hibernation timeout reached..."); -- We need to check the current resumption token for this resource @@ -284,8 +431,27 @@ module:hook("pre-resource-unbind", function (event) -- Check the hibernate time still matches what we think it is, -- otherwise the session resumed and re-hibernated. and session.hibernating == hibernate_time then + -- wait longer if the timeout isn't reached because push was enabled for this session + -- session.first_hibernated_push is the starting point for hibernation timeouts of those push enabled clients + -- wait for an additional resume_timeout seconds if no push occured since hibernation at all + local current_time = os_time(); + local timeout_start = math_max(session.hibernating, session.first_hibernated_push or session.hibernating); + if session.push_identifier ~= nil and not session.first_hibernated_push then + session.log("debug", "No push happened since hibernation started, hibernating session for up to %d extra seconds", resume_timeout); + return resume_timeout; + end + if current_time-timeout_start < resume_timeout and session.push_identifier ~= nil then + session.log("debug", "A push happened since hibernation started, hibernating session for up to %d extra seconds", current_time-timeout_start); + return current_time-timeout_start; -- time left to wait + end session.log("debug", "Destroying session for hibernating too long"); - session_registry[session.resumption_token] = nil; + session_registry.set(session.username, session.resumption_token, nil); + -- save only actual h value and username/host (for security) + old_session_registry.set(session.username, session.resumption_token, { + h = session.handled_stanza_count, + username = session.username, + host = session.host + }); session.resumption_token = nil; sessionmanager.destroy_session(session); else @@ -294,7 +460,6 @@ module:hook("pre-resource-unbind", function (event) end); return true; -- Postpone destruction for now end - end end); @@ -303,13 +468,24 @@ local function handle_s2s_destroyed(event) local queue = session.outgoing_stanza_queue; if queue and #queue > 0 then session.log("warn", "Destroying session with %d unacked stanzas", #queue); - handle_unacked_stanzas(session); + if s2s_resend then + for i = 1, #queue do + module:send(queue[i]); + end + session.outgoing_stanza_queue = nil; + else + handle_unacked_stanzas(session); + end end end module:hook("s2sout-destroyed", handle_s2s_destroyed); module:hook("s2sin-destroyed", handle_s2s_destroyed); +local function get_session_id(session) + return session.id or (tostring(session):match("[a-f0-9]+$")); +end + function handle_resume(session, stanza, xmlns_sm) if session.full_jid then session.log("warn", "Tried to resume after resource binding"); @@ -320,18 +496,28 @@ function handle_resume(session, stanza, xmlns_sm) end local id = stanza.attr.previd; - local original_session = session_registry[id]; + local original_session = session_registry.get(session.username, id); if not original_session then session.log("debug", "Tried to resume non-existent session with id %s", id); - session.send(st.stanza("failed", { xmlns = xmlns_sm }) - :tag("item-not-found", { xmlns = xmlns_errors }) - ); + local old_session = old_session_registry.get(session.username, id); + if old_session and session.username == old_session.username + and session.host == old_session.host + and old_session.h then + session.send(st.stanza("failed", { xmlns = xmlns_sm, h = string.format("%d", old_session.h) }) + :tag("item-not-found", { xmlns = xmlns_errors }) + ); + else + session.send(st.stanza("failed", { xmlns = xmlns_sm }) + :tag("item-not-found", { xmlns = xmlns_errors }) + ); + end; elseif session.username == original_session.username and session.host == original_session.host then - session.log("debug", "mod_smacks resuming existing session..."); + session.log("debug", "mod_smacks resuming existing session %s...", get_session_id(original_session)); + original_session.log("debug", "mod_smacks session resumed from %s...", get_session_id(session)); -- TODO: All this should move to sessionmanager (e.g. session:replace(new_session)) if original_session.conn then - session.log("debug", "mod_smacks closing an old connection for this session"); + original_session.log("debug", "mod_smacks closing an old connection for this session"); local conn = original_session.conn; c2s_sessions[conn] = nil; conn:close(); @@ -339,20 +525,23 @@ function handle_resume(session, stanza, xmlns_sm) original_session.ip = session.ip; original_session.conn = session.conn; original_session.send = session.send; + original_session.close = session.close; original_session.filter = session.filter; original_session.filter.session = original_session; original_session.filters = session.filters; original_session.stream = session.stream; original_session.secure = session.secure; original_session.hibernating = nil; + session.log = original_session.log; + session.type = original_session.type; wrap_session(original_session, true); -- Inform xmppstream of the new session (passed to its callbacks) original_session.stream:set_session(original_session); -- Similar for connlisteners c2s_sessions[session.conn] = original_session; - session.send(st.stanza("resumed", { xmlns = xmlns_sm, - h = original_session.handled_stanza_count, previd = id })); + original_session.send(st.stanza("resumed", { xmlns = xmlns_sm, + h = string.format("%d", original_session.handled_stanza_count), previd = id })); -- Fake an with the h of the from the client original_session:dispatch_stanza(st.stanza("a", { xmlns = xmlns_sm, @@ -361,11 +550,17 @@ function handle_resume(session, stanza, xmlns_sm) -- Ok, we need to re-send any stanzas that the client didn't see -- ...they are what is now left in the outgoing stanza queue local queue = original_session.outgoing_stanza_queue; - session.log("debug", "#queue = %d", #queue); + original_session.log("debug", "#queue = %d", #queue); for i=1,#queue do - session.send(queue[i]); + original_session.send(queue[i]); end - session.log("debug", "#queue = %d -- after send", #queue); + original_session.log("debug", "#queue = %d -- after send", #queue); + function session.send(stanza) + session.log("warn", "Tried to send stanza on old session migrated by smacks resume (maybe there is a bug?): %s", tostring(stanza)); + return false; + end + module:fire_event("smacks-hibernation-end", {origin = session, resumed = original_session, queue = queue}); + request_ack_if_needed(original_session, true, "handle_resume"); else module:log("warn", "Client %s@%s[%s] tried to resume stream for %s@%s[%s]", session.username or "?", session.host or "?", session.type, @@ -382,10 +577,24 @@ local function handle_read_timeout(event) local session = event.session; if session.smacks then if session.awaiting_ack then + if session.awaiting_ack_timer then + session.awaiting_ack_timer:stop(); + end + if session.delayed_ack_timer then + session.delayed_ack_timer:stop(); + session.delayed_ack_timer = nil; + end return false; -- Kick the session end + session.log("debug", "Sending (read timeout)"); + session.awaiting_ack = false; (session.sends2s or session.send)(st.stanza("r", { xmlns = session.smacks })); session.awaiting_ack = true; + if not session.delayed_ack_timer then + session.delayed_ack_timer = stoppable_timer(delayed_ack_timeout, function() + delayed_ack_function(session); + end); + end return true; end end diff --git a/conf/nginx.conf b/conf/nginx.conf index fe1efbc..54c092f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -31,7 +31,7 @@ location __PATH__/http-bind { # xmpp websockets location /xmpp-websocket { - proxy_pass http://localhost:5280/xmpp-websocket; + proxy_pass http://localhost:5290/xmpp-websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; diff --git a/scripts/backup b/scripts/backup index 972487e..54d290f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -72,7 +72,7 @@ ynh_backup --src_path="/etc/metronome/conf.d/$domain.cfg.lua" ynh_backup --src_path="/usr/lib/metronome/modules/mod_carbons.lua" ynh_backup --src_path="/usr/lib/metronome/modules/mod_http_altconnect.lua" -# ynh_backup --src_path="/usr/lib/metronome/modules/mod_smacks.lua" +ynh_backup --src_path="/usr/lib/metronome/modules/mod_smacks.lua" #================================================= # BACKUP SYSTEMD diff --git a/scripts/install b/scripts/install index fff8748..31aac51 100644 --- a/scripts/install +++ b/scripts/install @@ -162,7 +162,7 @@ chown -R metronome:metronome "/etc/metronome/conf.d/" cp ../conf/mod_carbons.lua /usr/lib/metronome/modules/mod_carbons.lua cp ../conf/mod_http_altconnect.lua /usr/lib/metronome/modules/mod_http_altconnect.lua -#cp ../conf/mod_smacks.lua /usr/lib/metronome/modules/mod_smacks.lua +cp ../conf/mod_smacks.lua /usr/lib/metronome/modules/mod_smacks.lua ynh_systemd_action --service_name=metronome --action=restart @@ -172,7 +172,7 @@ ynh_systemd_action --service_name=metronome --action=restart ynh_script_progression --message="Building Jitsi-Videobridge..." --time --weight=1 mkdir -p "$final_path/.sip-communicator" -cp ../conf/sip-communicator.properties "$final_path/.sip-communicator/sip-communicator.propertie" +cp ../conf/sip-communicator.properties "$final_path/.sip-communicator/sip-communicator.properties" chown -R $app: $final_path #================================================= diff --git a/scripts/remove b/scripts/remove index 4ba584a..a051fa6 100644 --- a/scripts/remove +++ b/scripts/remove @@ -124,7 +124,7 @@ mv /etc/metronome/conf.d/focus.$domain.cfg.lua.back /etc/metronome/conf.d/focus. ynh_secure_remove --file="/usr/lib/metronome/modules/mod_carbons.lua" ynh_secure_remove --file="/usr/lib/metronome/modules/mod_http_altconnect.lua" -#ynh_secure_remove --file="/usr/lib/metronome/modules/mod_smacks.lua" +ynh_secure_remove --file="/usr/lib/metronome/modules/mod_smacks.lua" ynh_systemd_action --service_name=metronome --action=restart diff --git a/scripts/restore b/scripts/restore index ee9a937..4a64999 100644 --- a/scripts/restore +++ b/scripts/restore @@ -130,7 +130,7 @@ chown -R metronome:metronome "/etc/metronome/conf.d/" ynh_restore_file --origin_path="/usr/lib/metronome/modules/mod_carbons.lua" ynh_restore_file --origin_path="/usr/lib/metronome/modules/mod_http_altconnect.lua" -# ynh_restore_file --origin_path="/usr/lib/metronome/modules/mod_smacks.lua" +ynh_restore_file --origin_path="/usr/lib/metronome/modules/mod_smacks.lua" ynh_systemd_action --service_name=metronome --action=restart