Skip to content

Commit

Permalink
Merge pull request #30 from Dunedan/enable-mod-mam
Browse files Browse the repository at this point in the history
Enable mod_mam for Message Archive Management
  • Loading branch information
Dunedan authored Aug 19, 2024
2 parents 2649aae + 053f7a5 commit d68f3e4
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
23 changes: 23 additions & 0 deletions roles/ejabberd/files/ejabberd-delete-old-mam-messages.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Unit]
Description=Deletion of MAM messages stored by ejabberd

[Service]
Type=oneshot
ExecStart=/usr/sbin/ejabberdctl delete_old_mam_messages all 31

User=ejabberd
Group=ejabberd

NoNewPrivileges=true
PrivateDevices=true
PrivateMounts=true
PrivateTmp=true
PrivateUsers=false
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=true
10 changes: 10 additions & 0 deletions roles/ejabberd/files/ejabberd-delete-old-mam-messages.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Run monthly deletion of MAM messages stored by ejabberd

[Timer]
OnCalendar=monthly
RandomizedDelaySec=1h
FixedRandomDelay=true

[Install]
WantedBy=timers.target
23 changes: 23 additions & 0 deletions roles/ejabberd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@
state: started
daemon_reload: true

- name: Systemd service unit deleting old MAM messages
ansible.builtin.copy:
src: ejabberd-delete-old-mam-messages.service
dest: /etc/systemd/system/ejabberd-delete-old-mam-messages.service
owner: root
group: root
mode: 0644

- name: Systemd timer for deleting old MAM messages
ansible.builtin.copy:
src: ejabberd-delete-old-mam-messages.timer
dest: /etc/systemd/system/ejabberd-delete-old-mam-messages.timer
owner: root
group: root
mode: 0644

- name: Enable systemd timer for deleting old MAM messages
ansible.builtin.systemd:
name: ejabberd-delete-old-mam-messages.timer
enabled: true
state: started
daemon_reload: true

- name: Create /etc/default/ejabberd
ansible.builtin.template:
src: ejabberd-default.j2
Expand Down
5 changes: 4 additions & 1 deletion roles/ejabberd/templates/ejabberd.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ access_rules:
## Expected by the ipstamp module for XpartaMuPP
ipbots:
- allow: ipbots
mam_modify:
- deny
muc_admin:
- allow: admin
- allow: muc_admins
Expand Down Expand Up @@ -283,7 +285,8 @@ modules:
## ipstamp module used by XpartaMuPP to insert IP addresses into the gamelist
mod_ipstamp: {}
mod_last: {}
## mod_mam:
mod_mam:
access_preferences: mam_modify
## ## Mnesia is limited to 2GB, better to use an SQL backend
## ## For small servers SQLite is a good fit and is very easy
## ## to configure. Uncomment this when you have SQL configured:
Expand Down

0 comments on commit d68f3e4

Please sign in to comment.