1 Commits
Author SHA1 Message Date
aitzol 6d74a56f88 Update readme.md 2024-03-01 17:07:44 +01:00
24 changed files with 198 additions and 192 deletions
-31
View File
@@ -1,36 +1,5 @@
# Changelog
## v 1.3.6
* Updated to LuaRocks 3.13.0
* Updated to Prosody 13.0.6
* Updated deprecated modules
## v 1.3.5
* Added `prosodyctl check config` result to server test.
* A few minor tweaks.
* Move defaults to config files
## v 1.3.4
* Migration from Docker to Podman.
* Added websocket module.
* Replace deprecated legacy_ssl with c2s_direct_tls.
* Removed use_libevent = true. This means the default is now used which is epoll.
* Added a test to check that no deprecated config settings are used.
## v 1.3.3
* Updated to LuaRocks 3.12.2
* Updated to Lua 5.4
* Updated to Prosody 0.12.5
* Removed unused luarocks
## v1.3.2
* Added Firewall module with optional custom blacklist
## v1.3.1
* Added optional Firewall module for testing
+18 -12
View File
@@ -1,14 +1,14 @@
FROM debian:trixie-slim
FROM debian:bookworm-slim
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
ARG LUAROCKS_VERSION=3.13.0
ARG PROSODY_VERSION=13.0.6
ARG LUAROCKS_VERSION=3.9.2
ARG PROSODY_VERSION=0.12.4
ARG LUAROCKS_SHA256="245bf6ec560c042cb8948e3d661189292587c5949104677f1eecddc54dbe7e37"
ARG PROSODY_DOWNLOAD_SHA256="ec696f9cf562c3af4a04b07d3fb36a1cedcc4e69a392fddcfc524bc67d93050f"
ARG LUAROCKS_SHA256="bca6e4ecc02c203e070acdb5f586045d45c078896f6236eb46aa33ccd9b94edb"
ARG PROSODY_DOWNLOAD_SHA256="47d712273c2f29558c412f6cdaec073260bbc26b7dda243db580330183d65856"
LABEL luarocks.version="${LUAROCKS_VERSION}"
LABEL org.opencontainers.image.authors="Wproject Garapenak"
@@ -25,12 +25,12 @@ LABEL prosody.version="${PROSODY_VERSION}"
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
libicu76 \
libevent-dev `# this is no build dependency, but needed for luaevent` \
libicu72 \
libidn2-0 \
libpq-dev \
libsqlite3-0 \
lua5.4 \
liblua5.4-dev \
lua5.2 \
lua-bitop \
lua-dbi-mysql \
lua-dbi-postgresql \
@@ -44,7 +44,7 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN buildDeps='gcc git libc6-dev libidn2-dev liblua5.4-dev libsqlite3-dev libssl-dev libicu-dev make unzip' \
RUN buildDeps='gcc git libc6-dev libidn2-dev liblua5.2-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/* \
@@ -70,10 +70,10 @@ RUN buildDeps='gcc git libc6-dev libidn2-dev liblua5.4-dev libsqlite3-dev libssl
&& tar zxpf luarocks-${LUAROCKS_VERSION}.tar.gz \
&& cd luarocks-${LUAROCKS_VERSION} \
&& ./configure \
&& make \
&& make install \
&& make bootstrap \
&& cd / && rm -r /usr/src/luarocks \
\
&& luarocks install luaevent \
&& luarocks install luadbi \
`#&& luarocks install luadbi-mysql MYSQL_INCDIR=/usr/include/mariadb/` \
&& luarocks install luadbi-sqlite3 \
@@ -90,7 +90,7 @@ RUN groupadd -r prosody \
RUN mkdir -p /var/run/prosody/ \
&& chown prosody:prosody /var/run/prosody/
ENV __FLUSH_LOG=yes
ENV __FLUSH_LOG yes
VOLUME ["/usr/local/var/lib/prosody"]
@@ -102,10 +102,16 @@ 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)` \
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)` \
&& docker-prosody-module-pre-install.bash \
firewall `# anti-spam firewall` \
&& rm -rf "/usr/src/prosody-modules"
RUN echo "TLS_REQCERT allow" >> /etc/ldap/ldap.conf
+17 -11
View File
@@ -1,10 +1,7 @@
local getenv = Lua.os.getenv
plugin_paths = { "/usr/local/lib/prosody/custom-modules/" };
-- table of enabled modules
-- local mods_enabled = {
modules_enabled = {
local mods_enabled = {
-- Generally required
"roster"; -- Allow users to have a roster. Recommended ;)
"saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
@@ -21,7 +18,6 @@ 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
@@ -38,11 +34,10 @@ 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
@@ -50,12 +45,22 @@ 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_info"; -- This module lets you advertise various contact addresses for your XMPP service via XEP-0158.
"cloud_notify";
"server_contact_info"; -- This module lets you advertise various contact addresses for your XMPP service via XEP-0157.
};
-- modules_enabled = mods_enabled;
local enabled = os.getenv("ENABLE_FIREWALL") or "false"
local spam_blocklist = os.getenv("SPAM_BLOCKLIST") and "/usr/local/etc/prosody/firewall/" .. os.getenv("SPAM_BLOCKLIST") or "module:scripts/spam-blocklists.pfw"
if(enabled == "true")
then
table.insert(mods_enabled, "firewall");
firewall_scripts = {
spam_blocklist;
}
end
modules_enabled = mods_enabled;
-- These modules are auto-loaded, but should you want
-- to disable them then uncomment them here:
@@ -64,3 +69,4 @@ modules_disabled = {
-- "c2s"; -- Handle client connections
-- "s2s"; -- Handle server-to-server connections
};
+7 -9
View File
@@ -1,14 +1,12 @@
local getenv = Lua.os.getenv
default_storage = "sql"
sql = {
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");
driver = os.getenv("DB_DRIVER");
database = os.getenv("DB_DATABASE");
host = os.getenv("DB_HOST");
port = os.getenv("DB_PORT");
username = os.getenv("DB_USERNAME");
password = os.getenv("DB_PASSWORD");
}
-- make 0.10-distributed mod_mam use sql store
@@ -32,4 +30,4 @@ archive_expires_after = "1y"
--};
--}
http_max_content_size = getenv("HTTP_MAX_CONTENT_SIZE") or 1024 * 1024 * 10 -- Default is 10MB
http_max_content_size = os.getenv("HTTP_MAX_CONTENT_SIZE") or 1024 * 1024 * 10 -- Default is 10MB
+4 -8
View File
@@ -1,12 +1,8 @@
local getenv = Lua.os.getenv
local stringy = Lua.require "stringy"
e2e_policy_chat = getenv("E2E_POLICY_CHAT") or "required"
e2e_policy_muc = getenv("E2E_POLICY_MUC") or "required"
local whitelist = getenv("E2E_POLICY_WHITELIST") or ""
e2e_policy_whitelist = stringy.split(whitelist, ", ")
local stringy = require "stringy"
e2e_policy_chat = os.getenv("E2E_POLICY_CHAT")
e2e_policy_muc = os.getenv("E2E_POLICY_MUC")
e2e_policy_whitelist = stringy.split(os.getenv("E2E_POLICY_WHITELIST"), ", ")
e2e_policy_message_optional_chat = "For security reasons, OMEMO, OTR or PGP encryption is STRONGLY recommended for conversations on this server."
e2e_policy_message_required_chat = "For security reasons, OMEMO, OTR or PGP encryption is required for conversations on this server."
e2e_policy_message_optional_muc = "For security reasons, OMEMO, OTR or PGP encryption is STRONGLY recommended for MUC on this server."
+12
View File
@@ -0,0 +1,12 @@
local stringy = require "stringy"
contact_info = {
abuse = stringy.split(os.getenv("SERVER_CONTACT_INFO_ABUSE"), ", ");
admin = stringy.split(os.getenv("SERVER_CONTACT_INFO_ADMIN"), ", ");
feedback = stringy.split(os.getenv("SERVER_CONTACT_INFO_FEEDBACK"), ", ");
sales = stringy.split(os.getenv("SERVER_CONTACT_INFO_SALES"), ", ");
security = stringy.split(os.getenv("SERVER_CONTACT_INFO_SECURITY"), ", ");
support = stringy.split(os.getenv("SERVER_CONTACT_INFO_SUPPORT"), ", ");
}
welcome_message = "Kaixo $username, ongi etorri $host IM zerbitzura! Mesedez irakurri itzazu ondorengo <a href='https://lainoa.eus/terms/tos.html'>Erabilpen baldintzak</a>."
-21
View File
@@ -1,21 +0,0 @@
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 <a href='https://lainoa.eus/terms/tos.html'>Erabilpen baldintzak</a>."
+11 -12
View File
@@ -1,17 +1,16 @@
local getenv = Lua.os.getenv
local domain = os.getenv("DOMAIN")
local domain_http_upload = os.getenv("DOMAIN_HTTP_UPLOAD")
local domain_muc = os.getenv("DOMAIN_MUC")
local domain_proxy = os.getenv("DOMAIN_PROXY")
local domain_pubsub = os.getenv("DOMAIN_PUBSUB")
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 = {
certificate = "certs/" .. domain .. "/fullchain.pem";
legacy_ssl_ssl = {
certificate = "certs/" .. domain .. "/fullchain.pem";
key = "certs/" .. domain .. "/privkey.pem";
}
c2s_direct_tls_ports = { 5223 }
legacy_ssl_ports = { 5223 }
-- https://prosody.im/doc/certificates#service_certificates
-- https://prosody.im/doc/ports#ssl_configuration
@@ -25,9 +24,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 = getenv("HTTP_FILE_SHARE_SIZE_LIMIT") or 10 * 1024 * 1024 -- Default is 10MB
local size_limit = os.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 = getenv("HTTP_FILE_SHARE_DAILY_QUOTA") or 10 * size_limit -- Default is 10x the size limit
http_file_share_daily_quota = os.getenv("HTTP_FILE_SHARE_DAILY_QUOTA") or 10 * size_limit -- Default is 10x the size limit
Component (domain_muc) "muc"
name = "Prosody Chatrooms"
@@ -35,7 +34,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
+22
View File
@@ -1,6 +1,28 @@
#!/bin/bash
set -e
export ALLOW_REGISTRATION=${ALLOW_REGISTRATION:-true}
export DOMAIN_HTTP_UPLOAD=${DOMAIN_HTTP_UPLOAD:-"upload.$DOMAIN"}
export DOMAIN_MUC=${DOMAIN_MUC:-"conference.$DOMAIN"}
export DOMAIN_PROXY=${DOMAIN_PROXY:-"proxy.$DOMAIN"}
export DOMAIN_PUBSUB=${DOMAIN_PUBSUB:-"pubsub.$DOMAIN"}
export DB_DRIVER=${DB_DRIVER:-"SQLite3"}
export DB_DATABASE=${DB_DATABASE:-"prosody.sqlite"}
export E2E_POLICY_CHAT=${E2E_POLICY_CHAT:-"required"}
export E2E_POLICY_MUC=${E2E_POLICY_MUC:-"required"}
export E2E_POLICY_WHITELIST=${E2E_POLICY_WHITELIST:-""}
export LOG_LEVEL=${LOG_LEVEL:-"info"}
export C2S_REQUIRE_ENCRYPTION=${C2S_REQUIRE_ENCRYPTION:-true}
export S2S_REQUIRE_ENCRYPTION=${S2S_REQUIRE_ENCRYPTION:-true}
export S2S_SECURE_AUTH=${S2S_SECURE_AUTH:-true}
export SERVER_CONTACT_INFO_ABUSE=${SERVER_CONTACT_INFO_ABUSE:-"xmpp:abuse@$DOMAIN"}
export SERVER_CONTACT_INFO_ADMIN=${SERVER_CONTACT_INFO_ADMIN:-"xmpp:admin@$DOMAIN"}
export SERVER_CONTACT_INFO_FEEDBACK=${SERVER_CONTACT_INFO_FEEDBACK:-"xmpp:feedback@$DOMAIN"}
export SERVER_CONTACT_INFO_SALES=${SERVER_CONTACT_INFO_SALES:-"xmpp:sales@$DOMAIN"}
export SERVER_CONTACT_INFO_SECURITY=${SERVER_CONTACT_INFO_SECURITY:-"xmpp:security@$DOMAIN"}
export SERVER_CONTACT_INFO_SUPPORT=${SERVER_CONTACT_INFO_SUPPORT:-"xmpp:support@$DOMAIN"}
export PROSODY_ADMINS=${PROSODY_ADMINS:-""}
if [[ "$1" != "prosody" ]]; then
exec prosodyctl $*
exit 0;
+1 -7
View File
@@ -43,13 +43,7 @@ for ext in $exts; do
# Skip this if the modules should not be added to modules_enabled.
if [ "$ext" != "http_upload" ] && [ "$ext" != "vcard_muc" ] ; then
echo " - enabling within ${config}"
new_config=$(cat "${config}" | module="${ext}" perl -0pe 's/(modules_enabled[ ]*=[ ]*{[^}]*)};/$1\n\t"$ENV{module}";\n};/')
new_config=$(cat "${config}" | module="${ext}" perl -0pe 's/(mods_enabled[ ]*=[ ]*{[^}]*)};/$1\n\t"$ENV{module}";\n};/')
echo "${new_config}" > "${config}"
fi
# firewall module configuration
if [ "$ext" == "firewall" ] ; then
echo " - setting up mod_${ext}"
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
+42
View File
@@ -0,0 +1,42 @@
#!/bin/bash
set -e
source="/usr/src/prosody-modules"
target="/usr/local/lib/prosody/custom-modules"
cd ${source}
usage() {
echo "usage: $0 ext-name [ext-name ...]"
echo " ie: $0 carbons e2e_policy proxy65"
echo
echo 'Possible values for ext-name:'
find . -mindepth 1 -maxdepth 1 -type d | sort | sed s/\.\\/mod_//g | xargs
}
exts=
for ext; do
if [ -z "mod_$ext" ]; then
continue
fi
if [ ! -d "mod_$ext" ]; then
echo >&2 "error: $PWD/mod_$ext does not exist"
echo >&2
usage >&2
exit 1
fi
exts="$exts $ext"
done
if [ -z "$exts" ]; then
usage >&2
exit 1
fi
for ext in $exts; do
echo "Installing mod_${ext}"
echo " - copying to ${target}"
cp -r "${source}/mod_${ext}" "${target}/"
done
-1
View File
@@ -4,7 +4,6 @@ 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
tar -xzf tip.tar.gz -C "${dir}" --strip-components=1
rm tip.tar.gz
-4
View File
@@ -2,21 +2,17 @@ bashtel.ru
creep.im
darkengine.biz
default.rs
exploit.im
hiddenlizard.org
jabber.bitactive.com
jabber.cd
jabber.cz
jabber.freenet.de
jabber.ipredator.se
jabber.npw.net
jabber.sampo.ru
jabbim.pl
labas.biz
otr.chat
paranoid.scarab.name
rassnet.org
safetyjabber.com
sj.ms
trashserver.net
xmpp.bytesund.biz
+20 -19
View File
@@ -1,33 +1,34 @@
-- 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 prosody_admins = getenv("PROSODY_ADMINS") or "";
admins = stringy.split(prosody_admins, ", ");
local stringy = require "stringy"
admins = stringy.split(os.getenv("PROSODY_ADMINS"), ", ");
pidfile = "/var/run/prosody/prosody.pid"
allow_registration = getenv("ALLOW_REGISTRATION") or "true";
use_libevent = true; -- improves performance
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";
allow_registration = os.getenv("ALLOW_REGISTRATION");
authentication = getenv("AUTHENTICATION") or "internal_hashed";
c2s_require_encryption = os.getenv("C2S_REQUIRE_ENCRYPTION");
s2s_require_encryption = os.getenv("S2S_REQUIRE_ENCRYPTION");
s2s_secure_auth = os.getenv("S2S_SECURE_AUTH");
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 "";
authentication = os.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 "";
log = {
{levels = {min = getenv("LOG_LEVEL") or "info"}, to = "console"};
{levels = {min = os.getenv("LOG_LEVEL")}, to = "console"};
};
Include "conf.d/*.cfg.lua";
+10 -3
View File
@@ -158,9 +158,11 @@ docker build -t prosody/xmpp .
Next I recommend using a ```docker-compose.yml``` file:
```yaml
version: '3.7'
services:
server:
image: prosody/xmpp:latest
image: sarasmiseth/prosody:latest
restart: unless-stopped
ports:
- "5000:5000"
@@ -175,9 +177,9 @@ services:
- ./data:/usr/local/var/lib/prosody
```
Boot it via: ```docker compose up -d```.
Boot it via: ```docker-compose up -d```.
Inspect logs: ```docker compose logs -f```.
Inspect logs: ```docker-compose logs -f```.
### Volumes permissions
@@ -270,6 +272,11 @@ There is also ```docker-prosody-module-pre-install.bash``` which downloads the s
If you need additional configuration just overwrite the respective _cfg.lua_ file or add new ones.
#### Firewall module
Optionally, the Firewall module can be enabled through the ```ENABLE_FIREWALL``` environment variable. By default, the module obtains the list of spamming used known domains through the CDN service provided by [cdn.jsdelivr.net](https://cdn.jsdelivr.net/) at https://cdn.jsdelivr.net/gh/jabberspam/blacklist/blacklist.txt , but additionally a custom blacklist can be used through the ```SPAM_BLOCKLIST``` environment variable.
If you need more sophisticated rules, please refer to the module [documentation](https://modules.prosody.im/mod_firewall).
### Upgrade
When migrating from prosody 0.10, you need to update the database once:
+2
View File
@@ -1,3 +1,5 @@
version: "3.9"
services:
prosody:
image: prosody
+13 -22
View File
@@ -19,7 +19,7 @@ registerTestUser() {
local userName="$1"
local containerName="$2"
echo "Registering TestUser '$userName' in container '$containerName'"
sudo docker compose exec "$containerName" /bin/bash -c "prosodyctl register $userName example.com 12345678"
sudo docker compose exec "$containerName" /bin/bash -c "/entrypoint.bash register $userName example.com 12345678"
}
registerTestUsers() {
@@ -32,7 +32,8 @@ registerTestUsers() {
runTests() {
local containerName="$1"
python3 --version \
python --version \
&& python3 --version \
&& python3 -m venv venv \
&& source venv/bin/activate \
&& python --version \
@@ -41,19 +42,12 @@ runTests() {
&& pytest \
&& deactivate \
&& sleep 5 \
&& sudo docker compose logs "$containerName" \
&& sudo docker-compose logs "$containerName" \
&& export batsContainerName="$containerName" \
&& ./bats/bats-core/bin/bats tests.bats \
&& ./bats/bats-core/bin/bats tests-"$containerName".bats
}
checkFeatures() {
local containerName="$1"
sudo docker compose up -d "$containerName"
sudo docker compose exec -T "$containerName" prosodyctl check features || true
sudo docker compose down
}
generateCert "example.com"
generateCert "conference.example.com"
generateCert "proxy.example.com"
@@ -62,25 +56,22 @@ generateCert "upload.example.com"
# Run tests for first container with postgres
# Start postgres first and wait for 10 seconds before starting prosody.
sudo docker compose down
sudo docker compose up -d postgres
sudo docker-compose down
sudo docker-compose up -d postgres
sleep 10
sudo docker compose up -d prosody_postgres
sudo docker-compose up -d prosody_postgres
registerTestUsers prosody_postgres
runTests prosody_postgres
sudo docker compose down
sudo docker-compose down
# Run tests for second container with SQLite
sudo docker compose up -d prosody
sleep 5
sudo docker-compose up -d prosody
registerTestUsers prosody
runTests prosody
sudo docker compose down
sudo docker-compose down
# Run tests for prosody with ldap
sudo docker compose up -d prosody_ldap
sudo docker-compose up -d prosody_ldap
runTests prosody_ldap
sudo docker compose down
# Check server features
checkFeatures prosody
sudo docker-compose down
+1 -1
View File
@@ -4,7 +4,7 @@ load 'bats/bats-support/load'
load 'bats/bats-assert/load'
@test "Should use sqlite" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"Connecting to \[SQLite3\] \/usr\/local\/var\/lib\/prosody\/prosody\.sqlite\.\.\.\""
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Connecting to \[SQLite3\] \/usr\/local\/var\/lib\/prosody\/prosody\.sqlite\.\.\.\""
assert_success
assert_output
}
+2 -2
View File
@@ -4,13 +4,13 @@ load 'bats/bats-support/load'
load 'bats/bats-assert/load'
@test "Should use sqlite" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"Connecting to \[SQLite3\] \/usr\/local\/var\/lib\/prosody\/prosody\.sqlite\.\.\.\""
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Connecting to \[SQLite3\] \/usr\/local\/var\/lib\/prosody\/prosody\.sqlite\.\.\.\""
assert_success
assert_output
}
@test "Should use ldap" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"Host 'example.com' now set to use user provider 'ldap'\""
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Host 'example.com' now set to use user provider 'ldap'\""
assert_success
assert_output
}
+1 -1
View File
@@ -4,7 +4,7 @@ load 'bats/bats-support/load'
load 'bats/bats-assert/load'
@test "Should use postgres" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"Connecting to \[PostgreSQL\] prosody\.\.\.\""
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Connecting to \[PostgreSQL\] prosody\.\.\.\""
assert_success
assert_output
}
+15 -25
View File
@@ -4,95 +4,85 @@ load 'bats/bats-support/load'
load 'bats/bats-assert/load'
@test "Should send 5 messages" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"Received\[c2s\]: <message\" | wc -l"
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Received\[c2s\]: <message\" | wc -l"
assert_success
assert_output "5"
}
@test "Should select certificate for example.com" {
run bash -c "sudo docker compose logs $batsContainerName | grep \"Certificates loaded\" | grep \" example.com:tls\" | wc -l"
run bash -c "sudo docker-compose logs $batsContainerName | grep \"Certificates loaded\" | grep \" example.com:tls\" | wc -l"
assert_success
assert_output "1"
}
@test "Should select certificate for conference.example.com" {
run bash -c "sudo docker compose logs $batsContainerName | grep \"Certificates loaded\" | grep \"conference.example.com:tls\" | wc -l"
run bash -c "sudo docker-compose logs $batsContainerName | grep \"Certificates loaded\" | grep \"conference.example.com:tls\" | wc -l"
assert_success
assert_output "1"
}
@test "Should select certificate for proxy.example.com" {
run bash -c "sudo docker compose logs $batsContainerName | grep \"Certificates loaded\" | grep \"proxy.example.com:tls\" | wc -l"
run bash -c "sudo docker-compose logs $batsContainerName | grep \"Certificates loaded\" | grep \"proxy.example.com:tls\" | wc -l"
assert_success
assert_output "1"
}
@test "Should select certificate for pubsub.example.com" {
run bash -c "sudo docker compose logs $batsContainerName | grep \"Certificates loaded\" | grep \"pubsub.example.com:tls\" | wc -l"
run bash -c "sudo docker-compose logs $batsContainerName | grep \"Certificates loaded\" | grep \"pubsub.example.com:tls\" | wc -l"
assert_success
assert_output "1"
}
@test "Should select certificate for upload.example.com" {
run bash -c "sudo docker compose logs $batsContainerName | grep \"Certificates loaded\" | grep \"upload.example.com:tls\" | wc -l"
run bash -c "sudo docker-compose logs $batsContainerName | grep \"Certificates loaded\" | grep \"upload.example.com:tls\" | wc -l"
assert_success
assert_output "1"
}
@test "Should log error for user with wrong password" {
run bash -c "sudo docker compose logs $batsContainerName | grep \"Session closed by remote with error: undefined-condition (user intervention: authentication failed: authentication aborted by user)\""
run bash -c "sudo docker-compose logs $batsContainerName | grep \"Session closed by remote with error: undefined-condition (user intervention: authentication failed: authentication aborted by user)\""
assert_success
assert_output
}
@test "Should activate s2s" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"Activated service 's2s' on (\[::\]:5269|\[\*\]:5269), (\[::\]:5269|\[\*\]:5269)\""
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Activated service 's2s' on (\[::\]:5269|\[\*\]:5269), (\[::\]:5269|\[\*\]:5269)\""
assert_success
assert_output
}
@test "Should activate c2s" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"Activated service 'c2s' on (\[::\]:5222|\[\*\]:5222), (\[::\]:5222|\[\*\]:5222)\""
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Activated service 'c2s' on (\[::\]:5222|\[\*\]:5222), (\[::\]:5222|\[\*\]:5222)\""
assert_success
assert_output
}
@test "Should activate c2s_direct_tls" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"Activated service 'c2s_direct_tls' on (\[::\]:5223|\[\*\]:5223), (\[::\]:5223|\[\*\]:5223)\""
@test "Should activate legacy_ssl" {
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Activated service 'legacy_ssl' on (\[::\]:5223|\[\*\]:5223), (\[::\]:5223|\[\*\]:5223)\""
assert_success
assert_output
}
@test "Should activate proxy65" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"Activated service 'proxy65' on (\[::\]:5000|\[\*\]:5000), (\[::\]:5000|\[\*\]:5000)\""
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Activated service 'proxy65' on (\[::\]:5000|\[\*\]:5000), (\[::\]:5000|\[\*\]:5000)\""
assert_success
assert_output
}
@test "Should activate https" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"Activated service 'https' on (\[::\]:5281|\[\*\]:5281), (\[::\]:5281|\[\*\]:5281)\""
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Activated service 'https' on (\[::\]:5281|\[\*\]:5281), (\[::\]:5281|\[\*\]:5281)\""
assert_success
assert_output
}
@test "Should load module cloud_notify" {
run bash -c "sudo docker compose logs $batsContainerName | grep \"example.com:cloud_notify.*info.*Module loaded\""
run bash -c "sudo docker-compose logs $batsContainerName | grep \"example.com:cloud_notify.*info.*Module loaded\""
assert_success
assert_output
}
@test "Should show upload URL" {
run bash -c "sudo docker compose logs $batsContainerName | grep \"Serving 'file_share' at https:\/\/upload.example.com:5281\/file_share\""
run bash -c "sudo docker-compose logs $batsContainerName | grep \"URL: <https:\/\/upload.example.com:5281\/upload> - Ensure this can be reached by users\""
assert_success
assert_output
}
@test "Should not use deprecated config" {
run bash -c "sudo docker compose exec $batsContainerName /bin/bash -c \"/entrypoint.bash check\" | grep 'deprecated' -A 3"
assert_failure
}
@test "Should not have warnings in log" {
run bash -c "sudo docker compose logs $batsContainerName | grep -E \"warn\""
assert_failure
}