Bug#958307: ejabberd: Fails to make a backup

2020-04-22 Thread Philipp Huebner
Hi

Am 20.04.20 um 14:06 schrieb Santiago Castillo Oli:
> The documentation (/usr/share/doc/ejabberd/README.Debian.gz says that
> backups are stored in /var/backups when ejabberd is upgraded or
> restored. I didn't check if this is working or is it also affected by
> this problem.
> 
> 
> There is not (or at least I didn't find) a proper place to store backups.
> 
> I think it should be documented where to store backups, or have and
> specific directory for backups that works.

executing
 /var/lib/dpkg/info/ejabberd.prerm upgrade
works like a charm.

The trick is to create a writable directory for ejabberd inside
/var/backups.


Indeed, the documentation could be improved.


Regards
-- 
 .''`.   Philipp Huebner 
: :'  :  pgp fp: 6719 25C5 B8CD E74A 5225  3DF9 E5CA 8C49 25E4 205F
`. `'`
  `-



signature.asc
Description: OpenPGP digital signature


Bug#958307: ejabberd: Fails to make a backup

2020-04-20 Thread Santiago Castillo Oli

Package: ejabberd
Version: 18.12.1-2
Severity: normal

Dear Maintainer,

I have a problem trying yo backup ejabberd database.

I'm using ejabberd (18.12.1-2) with debian buster.

When I do (as root):

ejabberdctl backup /tmp/ejabberd.backup

I don't get any errors, but there is no /tmp/ejabberd.backup file 
neither.


journalctl show some lines related with apparmor, although they are 
supposed to ALLOW the operations:


--x8--x8--x8--x8
abr 20 12:57:03 xmppsrv1 audit[5875]: AVC apparmor="ALLOWED" 
operation="mknod" profile="/usr/sbin/ejabberdctl" 
name="/tmp/ejabberd.backup.BUPTMP" pid=
abr 20 12:57:03 xmppsrv1 audit[5875]: AVC apparmor="ALLOWED" 
operation="open" profile="/usr/sbin/ejabberdctl" 
name="/tmp/ejabberd.backup.BUPTMP" pid=5
abr 20 12:57:03 xmppsrv1 audit[5875]: AVC apparmor="ALLOWED" 
operation="truncate" profile="/usr/sbin/ejabberdctl" 
name="/tmp/ejabberd.backup.BUPTMP" p
abr 20 12:57:03 xmppsrv1 kernel: audit: type=1400 
audit(1587380223.577:51): apparmor="ALLOWED" operation="mknod" 
profile="/usr/sbin/ejabberdctl" name=
abr 20 12:57:03 xmppsrv1 kernel: audit: type=1400 
audit(1587380223.577:52): apparmor="ALLOWED" operation="open" 
profile="/usr/sbin/ejabberdctl" name="
abr 20 12:57:03 xmppsrv1 kernel: audit: type=1400 
audit(1587380223.577:53): apparmor="ALLOWED" operation="truncate" 
profile="/usr/sbin/ejabberdctl" na
abr 20 12:57:03 xmppsrv1 audit[5875]: AVC apparmor="ALLOWED" 
operation="rename_src" profile="/usr/sbin/ejabberdctl" 
name="/tmp/ejabberd.backup.BUPTMP"
abr 20 12:57:03 xmppsrv1 audit[5875]: AVC apparmor="ALLOWED" 
operation="rename_dest" profile="/usr/sbin/ejabberdctl" 
name="/tmp/ejabberd.backup" pid=5
abr 20 12:57:03 xmppsrv1 kernel: audit: type=1400 
audit(1587380223.913:54): apparmor="ALLOWED" operation="rename_src" 
profile="/usr/sbin/ejabberdctl"
abr 20 12:57:03 xmppsrv1 kernel: audit: type=1400 
audit(1587380223.913:55): apparmor="ALLOWED" operation="rename_dest" 
profile="/usr/sbin/ejabberdctl"

--x8--x8--x8--x8

The fact is that there is no /tmp/ejabberd.backup file

According to /etc/apparmor.d/usr.sbin.ejabberdctl:
   /var/backups/   rw,
   /var/backups/ejabberd** rwlk,

So I tried:
ejabberdctl backup /var/backups/ejabberd.backup

and I get this error:
Can't store backup in "/var/backups/ejabberd.backup" at node 
ejabberd@localhost: {'EXIT',
 
 {error,
 
  {file_error,
 
   "/var/backups/ejabberd.backup.BUPTMP",
 
   eacces}}}


because /var/backups/ has 755 permissions and is owned by root:root.

I created a directory in /tmp, owned by ejabberd but it did not worked 
neither.



The only way I managed to make a backup was in /var/run/ejabberd (it is 
owned by ejabberd, and also with "rw" in 
/etc/apparmor.d/usr/sbin/ejabberdctl)


ejabberdctl backup /var/run/ejabberd/ejabberd.backup


The documentation (/usr/share/doc/ejabberd/README.Debian.gz says that 
backups are stored in /var/backups when ejabberd is upgraded or 
restored. I didn't check if this is working or is it also affected by 
this problem.



There is not (or at least I didn't find) a proper place to store 
backups.


I think it should be documented where to store backups, or have and 
specific directory for backups that works.


Regards and thank you.



-- System Information:
Debian Release: 10.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-8-amd64 (SMP w/1 CPU core)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8), 
LANGUAGE=es_ES.UTF-8 (charmap=UTF-8)

Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages ejabberd depends on:
ii  adduser3.118
ii  debconf [debconf-2.0]  1.5.71
ii  erlang-asn11:21.2.6+dfsg-1
ii  erlang-base [erlang-abi-17.0]  1:21.2.6+dfsg-1
ii  erlang-base64url   1.0-3
ii  erlang-crypto  1:21.2.6+dfsg-1
ii  erlang-goldrush0.2.0-1
ii  erlang-inets   1:21.2.6+dfsg-1
ii  erlang-jiffy   0.14.11+dfsg-4
ii  erlang-jose1.9.0-1
ii  erlang-lager   3.6.8-1
ii  erlang-mnesia  1:21.2.6+dfsg-1
ii  erlang-odbc1:21.2.6+dfsg-1
ii  erlang-os-mon  1:21.2.6+dfsg-1
ii  erlang-p1-cache-tab1.0.17-1
ii  erlang-p1-eimp 1.0.9-1
ii  erlang-p1-iconv1.0.10-1
ii  erlang-p1-pkix 1.0.0-3+deb10u1
ii  erlang-p1-stringprep   1.0.14-1
ii  erlang-p1-tls