nikoladsp

certs

Aug 17th, 2025
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.71 KB | None | 0 0
  1. DOMAIN="sdk.local"
  2.  
  3. mkdir -p /artifacts/valid && cd /artifacts/valid
  4.  
  5. openssl genrsa -out ca.key 2048
  6. openssl req -new -key ca.key -x509 -days 1825 -subj "/C=US/OU=sdk" -out ca.pem
  7. cp ca.pem ca.crt
  8.  
  9. openssl genrsa -out ldapserver.key
  10. openssl req -new -key ldapserver.key -out ldapserver.csr \
  11.   -subj "/CN=ldap.${DOMAIN}/C=US/OU=sdk" \
  12.   -addext "subjectAltName=DNS:ldap.${DOMAIN},DNS:localhost,IP:127.0.0.1"
  13.  
  14. DAYS_VALID=730
  15. openssl x509 -req -in ldapserver.csr -CA ca.pem -CAkey ca.key -CAcreateserial \
  16.   -out ldapserver.pem -days ${DAYS_VALID} -extfile <(printf "subjectAltName=DNS:ldap.${DOMAIN},DNS:localhost,IP:127.0.0.1")
  17.  
  18. echo $(( $(date +%s) + ${DAYS_VALID}*24*60*60 )) > /artifacts/expiry_timestamp
Advertisement
Add Comment
Please, Sign In to add comment