diff --git a/Dockerfile b/Dockerfile index 66fdd24..414f6bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,19 @@ -FROM debian:bookworm-slim +#FROM debian:bookworm-slim +FROM debian:trixie-slim ARG BUILD_DATE ARG VCS_REF ARG VERSION -ARG LUAROCKS_VERSION=3.12.2 -ARG PROSODY_VERSION=0.12.5 +#ARG LUAROCKS_VERSION=3.12.2 +#ARG PROSODY_VERSION=0.12.5 +ARG LUAROCKS_VERSION=3.13.0 +ARG PROSODY_VERSION=13.0.6 -ARG LUAROCKS_SHA256="b0e0c85205841ddd7be485f53d6125766d18a81d226588d2366931e9a1484492" -ARG PROSODY_DOWNLOAD_SHA256="778fb7707a0f10399595ba7ab9c66dd2a2288c0ae3a7fe4ab78f97d462bd399f" +#ARG LUAROCKS_SHA256="b0e0c85205841ddd7be485f53d6125766d18a81d226588d2366931e9a1484492" +#ARG PROSODY_DOWNLOAD_SHA256="778fb7707a0f10399595ba7ab9c66dd2a2288c0ae3a7fe4ab78f97d462bd399f" +ARG LUAROCKS_SHA256="245bf6ec560c042cb8948e3d661189292587c5949104677f1eecddc54dbe7e37" +ARG PROSODY_DOWNLOAD_SHA256="ec696f9cf562c3af4a04b07d3fb36a1cedcc4e69a392fddcfc524bc67d93050f" LABEL luarocks.version="${LUAROCKS_VERSION}" LABEL org.opencontainers.image.authors="Wproject Garapenak" @@ -25,8 +30,9 @@ LABEL prosody.version="${PROSODY_VERSION}" RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - libevent-dev `# this is no build dependency, but needed for luaevent` \ - libicu72 \ +# libevent-dev `# this is no build dependency, but needed for luaevent` \ +# libicu72 \ + libicu76 \ libidn2-0 \ libpq-dev \ libsqlite3-0 \ @@ -45,7 +51,7 @@ RUN apt-get update \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -RUN buildDeps='gcc git libc6-dev libidn2-dev liblua5.2-dev libsqlite3-dev libssl-dev libicu-dev make unzip' \ +RUN buildDeps='gcc git libc6-dev libidn2-dev liblua5.4-dev libsqlite3-dev libssl-dev libicu-dev make unzip' \ && set -x \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ && rm -rf /var/lib/apt/lists/* \ @@ -71,7 +77,8 @@ RUN buildDeps='gcc git libc6-dev libidn2-dev liblua5.2-dev libsqlite3-dev libssl && tar zxpf luarocks-${LUAROCKS_VERSION}.tar.gz \ && cd luarocks-${LUAROCKS_VERSION} \ && ./configure \ - && make bootstrap \ + && make \ + && make install \ && cd / && rm -r /usr/src/luarocks \ \ # && luarocks install luaevent \ @@ -103,15 +110,15 @@ COPY *.bash /usr/local/bin/ RUN download-prosody-modules.bash \ && docker-prosody-module-install.bash \ - bookmarks `# XEP-0411: Bookmarks Conversion` \ - carbons `# message carbons (XEP-0280)` \ - cloud_notify `# XEP-0357: Push Notifications` \ - csi `# client state indication (XEP-0352)` \ + #bookmarks `# XEP-0411: Bookmarks Conversion` \ + #carbons `# message carbons (XEP-0280)` \ + #cloud_notify `# XEP-0357: Push Notifications` \ + #csi `# client state indication (XEP-0352)` \ e2e_policy `# require end-2-end encryption` \ filter_chatstates `# disable "X is typing" type messages` \ smacks `# stream management (XEP-0198)` \ throttle_presence `# presence throttling in CSI` \ - vcard_muc `# XEP-0153: vCard-Based Avatar (MUC)` \ + #vcard_muc `# XEP-0153: vCard-Based Avatar (MUC)` \ #&& docker-prosody-module-pre-install.bash \ firewall `# anti-spam firewall` \ && rm -rf "/usr/src/prosody-modules" diff --git a/conf.d/01-modules.cfg.lua b/conf.d/01-modules.cfg.lua index 7f423db..0364d65 100644 --- a/conf.d/01-modules.cfg.lua +++ b/conf.d/01-modules.cfg.lua @@ -1,3 +1,5 @@ +local getenv = Lua.os.getenv + plugin_paths = { "/usr/local/lib/prosody/custom-modules/" }; -- table of enabled modules @@ -19,6 +21,7 @@ modules_enabled = { "carbons"; -- Share and sync conversations (XEP-0280) "csi_simple"; -- Buffer unimportant traffic for simple optimisation for clients using state indication "limits"; -- Enable bandwidth limiting for XMPP connections + "bookmarks"; -- Converts between old and new ways to store chat room bookmarks -- Nice to have "version"; -- Replies to server version requests @@ -35,10 +38,11 @@ modules_enabled = { -- HTTP modules "bosh"; -- Enable BOSH clients, aka "Jabber over HTTP" + "websocket"; -- Enable mod_websocket --"http_files"; -- Serve static files from a directory over HTTP -- Other specific functionality - "posix"; -- POSIX functionality, sends server to background, enables syslog, etc. + --"posix"; -- POSIX functionality, sends server to background, enables syslog, etc. --"groups"; -- Shared roster support "announce"; -- Send announcement to all online users --"welcome"; -- Welcome users who register accounts @@ -46,7 +50,9 @@ modules_enabled = { --"motd"; -- Send a message to users when they log in --"legacyauth"; -- Legacy authentication. Only used by some old clients and bots. "lastactivity"; - "server_contact_info"; -- This module lets you advertise various contact addresses for your XMPP service via XEP-0157. + "server_info"; -- This module lets you advertise various contact addresses for your XMPP service via XEP-0158. + "cloud_notify"; + }; -- modules_enabled = mods_enabled; diff --git a/conf.d/02-storage.cfg.lua b/conf.d/02-storage.cfg.lua index b933cf2..cfd177e 100644 --- a/conf.d/02-storage.cfg.lua +++ b/conf.d/02-storage.cfg.lua @@ -1,12 +1,14 @@ +local getenv = Lua.os.getenv + default_storage = "sql" sql = { - driver = os.getenv("DB_DRIVER") or "SQLite3"; - database = os.getenv("DB_DATABASE") or "prosody.sqlite"; - host = os.getenv("DB_HOST"); - port = os.getenv("DB_PORT"); - username = os.getenv("DB_USERNAME"); - password = os.getenv("DB_PASSWORD"); + driver = getenv("DB_DRIVER") or "SQLite3"; + database = getenv("DB_DATABASE") or "prosody.sqlite"; + host = getenv("DB_HOST"); + port = getenv("DB_PORT"); + username = getenv("DB_USERNAME"); + password = getenv("DB_PASSWORD"); } -- make 0.10-distributed mod_mam use sql store @@ -30,4 +32,4 @@ archive_expires_after = "1y" --}; --} -http_max_content_size = os.getenv("HTTP_MAX_CONTENT_SIZE") or 1024 * 1024 * 10 -- Default is 10MB +http_max_content_size = getenv("HTTP_MAX_CONTENT_SIZE") or 1024 * 1024 * 10 -- Default is 10MB diff --git a/conf.d/03-e2e-policy.cfg.lua b/conf.d/03-e2e-policy.cfg.lua index 466363e..a128587 100644 --- a/conf.d/03-e2e-policy.cfg.lua +++ b/conf.d/03-e2e-policy.cfg.lua @@ -1,9 +1,10 @@ -local stringy = require "stringy" +local getenv = Lua.os.getenv +local stringy = Lua.require "stringy" -e2e_policy_chat = os.getenv("E2E_POLICY_CHAT") or "required" -e2e_policy_muc = os.getenv("E2E_POLICY_MUC") or "required" +e2e_policy_chat = getenv("E2E_POLICY_CHAT") or "required" +e2e_policy_muc = getenv("E2E_POLICY_MUC") or "required" -local whitelist = os.getenv("E2E_POLICY_WHITELIST") or "" +local whitelist = getenv("E2E_POLICY_WHITELIST") or "" e2e_policy_whitelist = stringy.split(whitelist, ", ") e2e_policy_message_optional_chat = "For security reasons, OMEMO, OTR or PGP encryption is STRONGLY recommended for conversations on this server." diff --git a/conf.d/04-server_contact_info.cfg.lua b/conf.d/04-server_contact_info.cfg.lua deleted file mode 100644 index a0a93e3..0000000 --- a/conf.d/04-server_contact_info.cfg.lua +++ /dev/null @@ -1,29 +0,0 @@ -local stringy = require "stringy" -local function _split(s, sep) - if not s then return nil; end - sep = sep or ","; - local parts = {}; - for part in s:gmatch("[^"..sep.."]+") do - parts[#parts+1] = part; - end - return parts; -end - -local domain = os.getenv("DOMAIN") -local abuse = os.getenv("SERVER_CONTACT_INFO_ABUSE") or "xmpp:abuse@" .. domain -local admin = os.getenv("SERVER_CONTACT_INFO_ADMIN") or "xmpp:admin@" .. domain -local feedback = os.getenv("SERVER_CONTACT_INFO_FEEDBACK") or "xmpp:feedback@" .. domain -local sales = os.getenv("SERVER_CONTACT_INFO_SALES") or "xmpp:sales@" .. domain -local security = os.getenv("SERVER_CONTACT_INFO_SECURITY") or "xmpp:security@" .. domain -local support = os.getenv("SERVER_CONTACT_INFO_SUPPORT") or "xmpp:support@" .. domain - -contact_info = { - abuse = _split(abuse, ", "); - admin = _split(admin, ", "); - feedback = _split(feedback, ", "); - sales = _split(sales, ", "); - security = _split(security, ", "); - support = _split(support, ", "); -} - -welcome_message = "Kaixo $username, ongi etorri $host IM zerbitzura! Mesedez irakurri itzazu ondorengo Erabilpen baldintzak." diff --git a/conf.d/04-server_info.cfg.lua b/conf.d/04-server_info.cfg.lua new file mode 100644 index 0000000..1881e6e --- /dev/null +++ b/conf.d/04-server_info.cfg.lua @@ -0,0 +1,21 @@ +local getenv = Lua.os.getenv +local stringy = Lua.require "stringy" + +local domain = getenv("DOMAIN") +local abuse = getenv("SERVER_CONTACT_INFO_ABUSE") or "xmpp:abuse@" .. domain +local admin = getenv("SERVER_CONTACT_INFO_ADMIN") or "xmpp:admin@" .. domain +local feedback = getenv("SERVER_CONTACT_INFO_FEEDBACK") or "xmpp:feedback@" .. domain +local sales = getenv("SERVER_CONTACT_INFO_SALES") or "xmpp:sales@" .. domain +local security = getenv("SERVER_CONTACT_INFO_SECURITY") or "xmpp:security@" .. domain +local support = getenv("SERVER_CONTACT_INFO_SUPPORT") or "xmpp:support@" .. domain + +contact_info = { + abuse = stringy.split(abuse, ", "); + admin = stringy.split(admin, ", "); + feedback = stringy.split(feedback, ", "); + sales = stringy.split(sales, ", "); + security = stringy.split(security, ", "); + support = stringy.split(support, ", "); +} + +welcome_message = "Kaixo $username, ongi etorri $host IM zerbitzura! Mesedez irakurri itzazu ondorengo Erabilpen baldintzak." diff --git a/conf.d/05-vhost.cfg.lua b/conf.d/05-vhost.cfg.lua index 5f0651b..ce475e3 100644 --- a/conf.d/05-vhost.cfg.lua +++ b/conf.d/05-vhost.cfg.lua @@ -1,8 +1,10 @@ -local domain = os.getenv("DOMAIN") -local domain_http_upload = os.getenv("DOMAIN_HTTP_UPLOAD") or "upload." .. domain -local domain_muc = os.getenv("DOMAIN_MUC") or "conference." .. domain -local domain_proxy = os.getenv("DOMAIN_PROXY") or "proxy." .. domain -local domain_pubsub = os.getenv("DOMAIN_PUBSUB") or "pubsub." .. domain +local getenv = Lua.os.getenv + +local domain = getenv("DOMAIN") +local domain_http_upload = getenv("DOMAIN_HTTP_UPLOAD") or "upload." .. domain +local domain_muc = getenv("DOMAIN_MUC") or "conference." .. domain +local domain_proxy = getenv("DOMAIN_PROXY") or "proxy." .. domain +local domain_pubsub = getenv("DOMAIN_PUBSUB") or "pubsub." .. domain -- XEP-0368: SRV records for XMPP over TLS -- https://compliance.conversations.im/test/xep0368/ c2s_direct_tls_ssl = { @@ -23,9 +25,9 @@ VirtualHost (domain) -- Set up a http file upload Component (domain_http_upload) "http_file_share" http_file_share_expires_after = 60 * 60 * 24 * 7 -- a week in seconds - local size_limit = os.getenv("HTTP_FILE_SHARE_SIZE_LIMIT") or 10 * 1024 * 1024 -- Default is 10MB + local size_limit = getenv("HTTP_FILE_SHARE_SIZE_LIMIT") or 10 * 1024 * 1024 -- Default is 10MB http_file_share_size_limit = size_limit - http_file_share_daily_quota = os.getenv("HTTP_FILE_SHARE_DAILY_QUOTA") or 10 * size_limit -- Default is 10x the size limit + http_file_share_daily_quota = getenv("HTTP_FILE_SHARE_DAILY_QUOTA") or 10 * size_limit -- Default is 10x the size limit Component (domain_muc) "muc" name = "Prosody Chatrooms" @@ -33,7 +35,7 @@ Component (domain_muc) "muc" max_history_messages = 20 modules_enabled = { "muc_mam", - "vcard_muc" + --"vcard_muc" } -- Set up a SOCKS5 bytestream proxy for server-proxied file transfers diff --git a/docker-prosody-module-install.bash b/docker-prosody-module-install.bash index 0ac2bd1..1ad0e74 100755 --- a/docker-prosody-module-install.bash +++ b/docker-prosody-module-install.bash @@ -49,7 +49,7 @@ for ext in $exts; do # firewall module configuration if [ "$ext" == "firewall" ] ; then echo " - setting up mod_${ext}" - new_config=$(cat "${config}" | echo -e "\nlocal spam_blocklist = os.getenv(\"SPAM_BLOCKLIST\") and \"/usr/local/etc/prosody/firewall/\" .. os.getenv(\"SPAM_BLOCKLIST\") or \"module:scripts/spam-blocklists.pfw\"\n\nfirewall_scripts = {\n\t\"module:scripts/spam-blocking.pfw\";\n\tspam_blocklist;\n};") + new_config=$(cat "${config}" | echo -e "\nlocal spam_blocklist = getenv(\"SPAM_BLOCKLIST\") and \"/usr/local/etc/prosody/firewall/\" .. getenv(\"SPAM_BLOCKLIST\") or \"module:scripts/spam-blocklists.pfw\"\n\nfirewall_scripts = {\n\t\"module:scripts/spam-blocking.pfw\";\n\tspam_blocklist;\n};") echo "${new_config}" >> "${config}" fi done diff --git a/download-prosody-modules.bash b/download-prosody-modules.bash index b57a8b4..327ab3b 100755 --- a/download-prosody-modules.bash +++ b/download-prosody-modules.bash @@ -4,7 +4,7 @@ set -e dir="/usr/src/prosody-modules" mkdir -p "${dir}" -wget https://hg.prosody.im/prosody-modules/archive/233691533318.tar.gz -O tip.tar.gz -#wget https://hg.prosody.im/prosody-modules/archive/tip.tar.gz +#wget https://hg.prosody.im/prosody-modules/archive/233691533318.tar.gz -O tip.tar.gz +wget https://hg.prosody.im/prosody-modules/archive/tip.tar.gz tar -xzf tip.tar.gz -C "${dir}" --strip-components=1 rm tip.tar.gz diff --git a/prosody.cfg.lua b/prosody.cfg.lua index d7b801d..1bfb549 100644 --- a/prosody.cfg.lua +++ b/prosody.cfg.lua @@ -1,33 +1,33 @@ -- see example config at https://hg.prosody.im/-1.9/file/0.9.10/prosody.cfg.lua.dist -- easily extendable by putting into different config files within conf.d folder +local getenv = Lua.os.getenv +local stringy = Lua.require "stringy" -local stringy = require "stringy" - -local prosody_admins = os.getenv("PROSODY_ADMINS") or ""; +local prosody_admins = getenv("PROSODY_ADMINS") or ""; admins = stringy.split(prosody_admins, ", "); pidfile = "/var/run/prosody/prosody.pid" -allow_registration = os.getenv("ALLOW_REGISTRATION") or "true"; +allow_registration = getenv("ALLOW_REGISTRATION") or "true"; -c2s_require_encryption = os.getenv("C2S_REQUIRE_ENCRYPTION") or "true"; -s2s_require_encryption = os.getenv("S2S_REQUIRE_ENCRYPTION") or "true"; -s2s_secure_auth = os.getenv("S2S_SECURE_AUTH") or "true"; +c2s_require_encryption = getenv("C2S_REQUIRE_ENCRYPTION") or "true"; +s2s_require_encryption = getenv("S2S_REQUIRE_ENCRYPTION") or "true"; +s2s_secure_auth = getenv("S2S_SECURE_AUTH") or "true"; -authentication = os.getenv("AUTHENTICATION") or "internal_hashed"; +authentication = getenv("AUTHENTICATION") or "internal_hashed"; -ldap_base = os.getenv("LDAP_BASE"); -ldap_server = os.getenv("LDAP_SERVER") or "localhost"; -ldap_rootdn = os.getenv("LDAP_ROOTDN") or ""; -ldap_password = os.getenv("LDAP_PASSWORD") or ""; -ldap_filter = os.getenv("LDAP_FILTER") or "(uid=$user)"; -ldap_scope = os.getenv("LDAP_SCOPE") or "subtree"; -ldap_tls = os.getenv("LDAP_TLS") or "false"; -ldap_mode = os.getenv("LDAP_MODE") or "bind"; -ldap_admin_filter = os.getenv("LDAP_ADMIN_FILTER") or ""; +ldap_base = getenv("LDAP_BASE"); +ldap_server = getenv("LDAP_SERVER") or "localhost"; +ldap_rootdn = getenv("LDAP_ROOTDN") or ""; +ldap_password = getenv("LDAP_PASSWORD") or ""; +ldap_filter = getenv("LDAP_FILTER") or "(uid=$user)"; +ldap_scope = getenv("LDAP_SCOPE") or "subtree"; +ldap_tls = getenv("LDAP_TLS") or "false"; +ldap_mode = getenv("LDAP_MODE") or "bind"; +ldap_admin_filter = getenv("LDAP_ADMIN_FILTER") or ""; log = { - {levels = {min = os.getenv("LOG_LEVEL") or "info"}, to = "console"}; + {levels = {min = getenv("LOG_LEVEL") or "info"}, to = "console"}; }; Include "conf.d/*.cfg.lua"; diff --git a/tests/test.bash b/tests/test.bash index 7f3bbd4..da875bb 100755 --- a/tests/test.bash +++ b/tests/test.bash @@ -47,10 +47,10 @@ runTests() { && ./bats/bats-core/bin/bats tests-"$containerName".bats } -checkConfig() { +checkFeatures() { local containerName="$1" sudo docker compose up -d "$containerName" - sudo docker compose exec -T "$containerName" prosodyctl check config || true + sudo docker compose exec -T "$containerName" prosodyctl check features || true sudo docker compose down } @@ -82,5 +82,5 @@ sudo docker compose up -d prosody_ldap runTests prosody_ldap sudo docker compose down -# Check server config -checkConfig prosody +# Check server features +checkFeatures prosody