Conjur - Permission denied when restoring or upgrading from backup

Conjur - Permission denied when restoring or upgrading from backup

97
Created On 11/10/26 10:58 AM - Last Modified 11/10/26 16:11 PM


Symptom


When restoring from a Conjur backup or upgrading a Conjur Leader using backup/restore, the `evoke restore ...` command fails and the output includes the error:

================================================================================
Error executing action `run` on resource 'bash[restore database role dump]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash" "/tmp/chef-script20210331-1138-1b44uj5" ----
STDOUT: Restoring database roles.
Error messages about existing roles are expected.
STDERR: /opt/conjur/backup/roles.sql: Permission denied
---- End output of "bash" "/tmp/chef-script20210331-1138-1b44uj5" ----


Environment


The Conjur host server has SELinux enabled.

Cause


This can be caused by either of the following conditions:
- Permissions on the roles.sql file are incorrect.
- Permissions on the /opt/conjur/backup directory are incorrect.

These permissions can be verified by running the command ls -la /opt/conjur/backup in the Conjur Docker container. For example:

$ docker exec conjur-appliance ls -la /opt/conjur/backup
total 236
d---------. 2 conjur 784196 4096 Mar 31 17:38 .
drwxr-xr-x. 1 conjur conjur 44 Mar 31 17:27 ..
----------. 1 conjur 299634 30683 Jun 24 2020 2020-06-24T20-23-51Z.tar.xz.gpg
----------. 1 conjur root 31011 Jun 25 2020 2020-06-25T13-15-12Z.tar.xz.gpg
-rw-r--r--. 1 conjur 784196 56978 Mar 31 15:25 2021-03-31T15-25-22Z.tar.xz.gpg
-rw-rw-r--. 1 conjur conjur 104513 Mar 31 15:25 conjur.db
-rw-------. 1 conjur 784196 88 Jun 24 2020 key
-rw-rw-r--. 1 conjur conjur 1067 Mar 31 15:25 roles.sql

In this example, the file permissions are correct (the conjur user and group have read permissions on the file). However, the directory permissions are not correct (d---------). This prevents any user from opening any file in this directory.

In this case, the incorrect directory permissions are caused by mounting a Docker volume without the appropriate SELinux label (:z), so the container is unable to access the files within the volume.  



Resolution


To fix the directory permissions on the mounted volume, update the volume argument for the Conjur container to include the :z flag. For example:

docker run \
    --name conjur-appliance \
    ...
    --volume /opt/cyberark/dap/backups:/opt/conjur/backup:z \
    ...
    registry.tld/conjur-appliance:<version>

For more information, see the offical documentation on preparing the Conjur environment .



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj0000001a33CAA&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail