5 Commits
Author SHA1 Message Date
aitzol bce1639d25 bats 2024-05-05 17:12:45 +02:00
aitzol 0de34e5f74 2024-05-05 eguneraketa 2024-05-05 16:47:07 +02:00
aitzol 4857ee42e9 2024-05-05 eguneraketa 2024-05-05 16:45:21 +02:00
aitzol da5371f30f 2024-05-05 eguneraketa 2024-05-05 16:40:57 +02:00
aitzol 73838d1aa5 fixed firewall scripts 2024-03-04 09:09:14 +01:00
10 changed files with 39 additions and 19 deletions
+11
View File
@@ -1,5 +1,16 @@
# Changelog # Changelog
## Unreleased 2024-05-05
### Adjust config
* Replace deprecated legacy_ssl with c2s_direct_tls.
* Removed use_libevent = true. This means the default is now used which is epoll.
### Test
Added a test to check that no deprecated config settings are used.
## v1.3.2 ## v1.3.2
* Added Firewall module with optional custom blacklist * Added Firewall module with optional custom blacklist
+4 -4
View File
@@ -102,13 +102,13 @@ COPY *.bash /usr/local/bin/
RUN download-prosody-modules.bash \ RUN download-prosody-modules.bash \
&& docker-prosody-module-install.bash \ && docker-prosody-module-install.bash \
bookmarks `# XEP-0411: Bookmarks Conversion` \ #bookmarks `# XEP-0411: Bookmarks Conversion` \
carbons `# message carbons (XEP-0280)` \ #carbons `# message carbons (XEP-0280)` \
cloud_notify `# XEP-0357: Push Notifications` \ cloud_notify `# XEP-0357: Push Notifications` \
csi `# client state indication (XEP-0352)` \ #csi `# client state indication (XEP-0352)` \
e2e_policy `# require end-2-end encryption` \ e2e_policy `# require end-2-end encryption` \
filter_chatstates `# disable "X is typing" type messages` \ filter_chatstates `# disable "X is typing" type messages` \
smacks `# stream management (XEP-0198)` \ #smacks `# stream management (XEP-0198)` \
throttle_presence `# presence throttling in CSI` \ throttle_presence `# presence throttling in CSI` \
vcard_muc `# XEP-0153: vCard-Based Avatar (MUC)` \ vcard_muc `# XEP-0153: vCard-Based Avatar (MUC)` \
firewall `# anti-spam firewall` \ firewall `# anti-spam firewall` \
+3 -3
View File
@@ -6,11 +6,11 @@ local domain_pubsub = os.getenv("DOMAIN_PUBSUB")
-- XEP-0368: SRV records for XMPP over TLS -- XEP-0368: SRV records for XMPP over TLS
-- https://compliance.conversations.im/test/xep0368/ -- https://compliance.conversations.im/test/xep0368/
legacy_ssl_ssl = { c2s_direct_tls_ssl = {
certificate = "certs/" .. domain .. "/fullchain.pem"; certificate = "certs/" .. domain .. "/fullchain.pem";
key = "certs/" .. domain .. "/privkey.pem"; key = "certs/" .. domain .. "/privkey.pem";
} }
legacy_ssl_ports = { 5223 } c2s_direct_tls_ports = { 5223 }
-- https://prosody.im/doc/certificates#service_certificates -- https://prosody.im/doc/certificates#service_certificates
-- https://prosody.im/doc/ports#ssl_configuration -- https://prosody.im/doc/ports#ssl_configuration
+1 -1
View File
@@ -49,7 +49,7 @@ for ext in $exts; do
# firewall module configuration # firewall module configuration
if [ "$ext" == "firewall" ] ; then if [ "$ext" == "firewall" ] ; then
echo " - setting up mod_${ext}" 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\tspam_blocklist;\n};") 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};")
echo "${new_config}" >> "${config}" echo "${new_config}" >> "${config}"
fi fi
done done
-2
View File
@@ -7,8 +7,6 @@ admins = stringy.split(os.getenv("PROSODY_ADMINS"), ", ");
pidfile = "/var/run/prosody/prosody.pid" pidfile = "/var/run/prosody/prosody.pid"
use_libevent = true; -- improves performance
allow_registration = os.getenv("ALLOW_REGISTRATION"); allow_registration = os.getenv("ALLOW_REGISTRATION");
c2s_require_encryption = os.getenv("C2S_REQUIRE_ENCRYPTION"); c2s_require_encryption = os.getenv("C2S_REQUIRE_ENCRYPTION");
+3 -5
View File
@@ -1,8 +1,6 @@
version: "3.9"
services: services:
prosody: prosody:
image: prosody image: prosody/xmpp:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "5000:5000" - "5000:5000"
@@ -19,7 +17,7 @@ services:
- ./certs:/usr/local/etc/prosody/certs - ./certs:/usr/local/etc/prosody/certs
prosody_postgres: prosody_postgres:
image: prosody image: prosody/xmpp:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "5000:5000" - "5000:5000"
@@ -53,7 +51,7 @@ services:
POSTGRES_PASSWORD: prosody POSTGRES_PASSWORD: prosody
prosody_ldap: prosody_ldap:
image: prosody image: prosody/xmpp:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "5000:5000" - "5000:5000"
+13 -3
View File
@@ -57,8 +57,8 @@ load 'bats/bats-assert/load'
assert_output assert_output
} }
@test "Should activate legacy_ssl" { @test "Should activate c2s_direct_tls" {
run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Activated service 'legacy_ssl' on (\[::\]:5223|\[\*\]:5223), (\[::\]:5223|\[\*\]:5223)\"" run bash -c "sudo docker-compose logs $batsContainerName | grep -E \"Activated service 'c2s_direct_tls' on (\[::\]:5223|\[\*\]:5223), (\[::\]:5223|\[\*\]:5223)\""
assert_success assert_success
assert_output assert_output
} }
@@ -82,7 +82,17 @@ load 'bats/bats-assert/load'
} }
@test "Should show upload URL" { @test "Should show upload URL" {
run bash -c "sudo docker-compose logs $batsContainerName | grep \"URL: <https:\/\/upload.example.com:5281\/upload> - Ensure this can be reached by users\"" run bash -c "sudo docker-compose logs $batsContainerName | grep \"Serving 'file_share' at https:\/\/upload.example.com:5281\/file_share\""
assert_success assert_success
assert_output 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
}