Coder Social home page Coder Social logo

docker-openldap-encrypted-backup's Introduction

konrad54/docker-openldap-encrypted-backup

Licence AGPLv3

This Docker image runs both: the openldap service and a configurable cron backup.

Prepare private & public key for encrypt and decrypt backup files

openssl req -x509 -nodes -newkey rsa:4096 -keyout ldapbackup-secure.priv.pem -out ldapbackup-secure.pub.pem -subj '/C=a/ST=b/L=c/O=d/OU=e/CN=example.com/[email protected]'
docker container run --rm -v /home/user/conf/ldapbackup-secure.pub.pem:/source:ro  -v ldap_certs:/target alpine:latest cp -TR /source /target/ldapbackup-secure.pub.pem

run container

 docker run --name ldap --detach \
 -p 389:389 \
 -p 636:636 \
 -e TZ=Europe/Berlin \
 -e LDAP_ADMIN_PASSWORD=admin \
 -e LDAP_ORGANISATION=example \
 -e LDAP_DOMAIN=example.org \
 -e LDAP_TLS_KEY_FILENAME=ldap.key \
 -e LDAP_TLS_CRT_FILENAME=ldap.pem \
 -e LDAP_CRYPT_PUBLIC_KEY_FILENAME=ldapbackup-secure.pub.pem \
 -e LDAP_TLS_CA_CRT_FILENAME=ca.pem \
 -e LDAP_TLS_VERIFY_CLIENT=never \
 -e LDAP_TLS_PROTOCOL_MIN=1.2 \
 -e LDAP_TLS_CIPHER_SUITE=SECURE128:-VERS-SSL3.0:+VERS-TLS1.2 \
 -e LDAP_BACKUP_DATA_CRON_EXP="* * * * *" \
 -e LDAP_BACKUP_CONFIG_CRON_EXP="* * * * *" \
 -e LDAP_BACKUP_TTL=30 \
 -e BACKUP_FILESYSTEM_GROUPID=4000 \
 -v ldap_certs:/container/service/slapd/assets/certs \
 -v ldap_init:/container/service/slapd/assets/config/bootstrap/schema/example \
 -v ldap_data:/var/lib/ldap \
 -v ldap_conf:/etc/ldap/slapd.d \
 -v /data/openldap/backup:/data/backup \
 -v /06-load-ppolicy.ldif:/container/service/slapd/assets/config/bootstrap/ldif/06-load-ppolicy.ldif \
 -v /07-configure-ppolicy.ldif:/container/service/slapd/assets/config/bootstrap/ldif/07-configure-ppolicy.ldif \
 konrad54/openldap-encrypted-backup:1.1.9-07 \
 --copy-service --loglevel info

Backup location

  • Container -> /data/backup
  • Docker-Host -> /data/openldap/backup

Restore LDAP

  1. decrypt LDAP backup
cd /data/openldap/backup
docker container run --rm \
-e backupfile=abc-data.gz.enc \
-v /data/openldap/backup:/data/backup \
-v /directory-of-private-key/ldapbackup-secure.priv.pem:/ldapbackup-secure.priv.pem:ro \
konrad54/openssl-decrypt-file:1.0.1
  1. start restore with encrypted backup file
 docker exec -it ldap slapd-restore-data abc-data.gz 
  1. delete decrypted LDAP backup
sudo rm abc-data.gz 

How to build image

mkdir /tmp/openldap-encrypted-backup
cd /tmp/openldap-encrypted-backup
vi Dockerfile
vi slapd-backup

docker build -t konrad54/openldap-encrypted-backup:1.1.9-07 .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.