[PR #25] [MERGED] Add automatic config admin password replacement #14, escaping sed characters #54

Closed
opened 2026-02-27 16:47:49 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rroemhild/docker-test-openldap/pull/25
Author: @karloie
Created: 2/2/2021
Status: Merged
Merged: 2/4/2021
Merged by: @rroemhild

Base: masterHead: master


📝 Commits (1)

  • 3d2df86 escaping reserved sed characters

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 bootstrap/slapd-init.sh (+1 -0)

📄 Description

Hi and thanks for your project! I have been looking for an easy way to run AD integration tests and your project was exactly what I needed.

But sometimes when I build the image the slappasswd salted password contains characters that needs to be escaped for use with sed. I've added a line in slapd-init.sh that escapes the password.

Examples of build failures:

docker build . -t rroemhild/docker-test-openldap

+ configure_admin_config_pw
+ echo 'Configure admin config password...'
Configure admin config password...
++ slappasswd -h '{SSHA}' -s GoodNewsEveryone
+ adminpw='{SSHA}dMRxzMI4+Ef13/oj5V496x9AcYLan/Iz'
+ sed -i 's/ADMINPW/{SSHA}dMRxzMI4+Ef13/oj5V496x9AcYLan/Iz/g' /bootstrap/config/configadminpw.ldif
sed: -e expression #1, char 31: unknown option to `s'
+ configure_admin_config_pw
Configure admin config password...
+ echo 'Configure admin config password...'
++ slappasswd -h '{SSHA}' -s GoodNewsEveryone
+ adminpw='{SSHA}MgDOk2BtkagO1fsmB/O4Hdj39l9DIDFE'
+ sed -i 's/ADMINPW/{SSHA}MgDOk2BtkagO1fsmB/O4Hdj39l9DIDFE/g' /bootstrap/config/configadminpw.ldif
sed: -e expression #1, char 35: unknown option to `s'

The escape code is taken from here: https://stackoverflow.com/questions/407523/escape-a-string-for-a-sed-replace-pattern


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rroemhild/docker-test-openldap/pull/25 **Author:** [@karloie](https://github.com/karloie) **Created:** 2/2/2021 **Status:** ✅ Merged **Merged:** 2/4/2021 **Merged by:** [@rroemhild](https://github.com/rroemhild) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`3d2df86`](https://github.com/rroemhild/docker-test-openldap/commit/3d2df86ddac2def785fb409c62c77b9ecf138e5e) escaping reserved sed characters ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `bootstrap/slapd-init.sh` (+1 -0) </details> ### 📄 Description Hi and thanks for your project! I have been looking for an easy way to run AD integration tests and your project was exactly what I needed. But sometimes when I build the image the _slappasswd_ salted password contains characters that needs to be escaped for use with _sed_. I've added a line in _slapd-init.sh_ that escapes the password. **Examples of build failures:** docker build . -t rroemhild/docker-test-openldap ``` + configure_admin_config_pw + echo 'Configure admin config password...' Configure admin config password... ++ slappasswd -h '{SSHA}' -s GoodNewsEveryone + adminpw='{SSHA}dMRxzMI4+Ef13/oj5V496x9AcYLan/Iz' + sed -i 's/ADMINPW/{SSHA}dMRxzMI4+Ef13/oj5V496x9AcYLan/Iz/g' /bootstrap/config/configadminpw.ldif sed: -e expression #1, char 31: unknown option to `s' ``` ``` + configure_admin_config_pw Configure admin config password... + echo 'Configure admin config password...' ++ slappasswd -h '{SSHA}' -s GoodNewsEveryone + adminpw='{SSHA}MgDOk2BtkagO1fsmB/O4Hdj39l9DIDFE' + sed -i 's/ADMINPW/{SSHA}MgDOk2BtkagO1fsmB/O4Hdj39l9DIDFE/g' /bootstrap/config/configadminpw.ldif sed: -e expression #1, char 35: unknown option to `s' ``` The escape code is taken from here: https://stackoverflow.com/questions/407523/escape-a-string-for-a-sed-replace-pattern --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 16:47:49 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/docker-test-openldap#54
No description provided.