Voicemails records must be deleted when tenant deleted

Description

files (=voicemails records) are not removed when tenant deleted

files are stored in folders using the context name like : /var/spool/asterisk/voicemail/CONTEXT/VOICEMAIL_NUMBER/

issue example:

  • we have a tenant T1 having a context name 'my context' and a voicemail number 1234

  • there are some messages records for the voicemail number 1234

  • we delete this tenant T1

  • we create another tenant T2 with the same context name 'my context' and same voicemail number 1234

-> collision: the new tenant will be able to access the messages records of the previous tenant T1

Zendesk Ticket IDs

None

Attachments

1
  • 10 Aug 2023, 01:35 PM

Activity

Show:

Nabil Ben Youssef September 12, 2023 at 11:56 AM

  • I deployed the updated code on my stack.

  • I created a new tenant

  • I created a new phone user

  • I created a new voicemail record by calling this new user

  • I checked that the voicemail record file was properly created in /var/spool/asterisk/voicemail/<context>/<extension>/INBOX

  • I called the tenant deletion with the API DELETE /tenants/<tenant_uuid>

  • I checked that the folder /var/spool/asterisk/voicemail/<context> is deleted

  • I checked wazo-confd + wazo-sysconfd logs that there are no errors

Nabil Ben Youssef August 10, 2023 at 1:42 PM

I should delete voicemails records before deleting the tenant (and their related resources). Otherwise I will lost its contexts and I will not know which contexts to delete.

Nabil Ben Youssef August 10, 2023 at 1:39 PM
Edited

After discussion with , the best place to put the code deleting the voicemails records is in wazo-sysconfd.

  • wazo-sysconfd can be used to execute commands with root access.

  • wazo-sysconfd already removes voicemails records (not the full context folder, but one voicemail record by one).

So wazo-confd (with the event listener and the sync_db) will call sysconfd that will delete the context folder for the voicemails.

Two things to do:

  • I must see how to delete the context folder in sysconfd instead of deleting voicemails records one by one.

  • I must call sysconfd from confd (sync_db and event listener)

Nabil Ben Youssef August 10, 2023 at 1:35 PM

we could use cron as the sync_db is executed with root user:

Nabil Ben Youssef August 10, 2023 at 1:04 PM
Edited

wazo-confd service is executed with www-data Linux user.

 

Groups:

www-data:x:33:asterisk,wazo-agid,wazo-dxtora,wazo-agentd,wazo-call-logd asterisk:x:116:www-data,wazo-agid

Users

www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin asterisk:x:109:116:Asterisk PBX daemon,,,:/var/lib/asterisk:/usr/sbin/nologin

 

 

We may have an issue with the Linux rights:

root@debian-buster:~# ls /var/spool/asterisk/voicemail/ -l total 8 drwxr-x--- 3 asterisk asterisk 4096 jul 26 2022 default-key-vYHVm-internal drwxr-x--- 3 asterisk asterisk 4096 mrt 27 11:14 internal

The folder of the context cannot be deleted by the wazo-confd service. The groups of the asterisk user cannot delete the folders

Done

Details

Priority

Assignee

Reporter

Approvers

Pascal Cadotte

Fix versions

Sprint

Zendesk Support

Created July 12, 2023 at 5:38 PM
Updated September 20, 2023 at 5:57 PM
Resolved September 19, 2023 at 1:50 PM