mirror of
https://github.com/osixia/container-openldap.git
synced 2026-11-14 00:03:41 -04:00
Add the Postfix Book schema in .schema and cn=config LDIF formats, document its incompatibility with virtualMail, and improve debug output and validation during schema conversion and file moves. Update the base image to osixia/baseimage:alpine-2.0.0-rc3 and document the changes for 2.6.15-beta.
29 lines
570 B
Bash
Executable File
29 lines
570 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
generate_password() {
|
|
openldap-ctl password generate
|
|
}
|
|
|
|
hash_password() {
|
|
if [ "$#" -ne 1 ] || [ -z "$1" ]; then
|
|
container log fatal "password to hash required"
|
|
fi
|
|
openldap-ctl password hash "$1"
|
|
}
|
|
|
|
ensure_hashed_password() {
|
|
local hashed_var="$1"
|
|
local label="$2"
|
|
|
|
[ -n "${!hashed_var}" ] && return 0
|
|
|
|
local plain_var
|
|
plain_var=$(generate_password)
|
|
|
|
container log warning "Generated ${label} password: ${plain_var}"
|
|
|
|
printf -v "${hashed_var}" '%s' "$(hash_password "${plain_var}")"
|
|
}
|