#5378 Incorrect error message at wrong password from private key file
Closed: fixed Opened by ofayans.

When I create a custom certificate and then use it at replica preparation, or new server install with the incorrect password, the operation fails with the error message "Failed to load ". It should be something more meaningful, like "incorrect password for pkcs!#12 file ".[[BR]]
How to reproduce:
1. Install master
2. Generate a certificate

# echo p@s$w0rd > passfile
# noise="$(mktemp)"
# head -c 20 /dev/urandom >"$noise"
# certutil -N -d nssdb -f passfile
# csr="$(mktemp)"
# crt="$(mktemp)"
# options="-t CT,C,C -v 120 -x -m 1"
# request_options="-1 -2 -4"
# request_input="\$'0\n1\n5\n6\n9\ny\ny\n\ny\n1\n7\nfile://'\$(readlink -f \$dbdir)/\$ca.crl\$'\n-1\n-1\n-1\nn\nn\n'"
# subject="CN=server.pesen.net,O=Self-signed"
# certutil -R -d nssdb -s "$subject" -f passfile -z "$noise" -o "$csr" "${request_options}" >/dev/null <<<"$request_input"
# certutil -C -d nssdb -f passfile -m 1 -i "$csr" -o "$crt" "${options[@]}" "$@"
# certutil -A -d nssdb -n "$nick" -f passfile -i "$crt" "${options[@]}"
  1. Export a certificate:

    pk12util -o replica.p12 -n ca1 -d nssdb -K 'p@s$w0rd' -W 'p@s$w0rd'

  2. Use the exported key during replica preparation with incorrect key password:

    ipa-replica-prepare --ip-address 192.168.122.171 -p '' --http-cert-file replica.p12 --dirsrv-cert-file replica.p12 --http-pin 'badpass' --dirsrv-pin 'p@s$w0rd' f22replica1.pesen.net


Use the same approach at new server installation.


Metadata Update from @ofayans:
- Issue assigned to someone
- Issue set to the milestone: FreeIPA 4.5 backlog

Changing the milestone as 4.5 is an already old release. Targetting 4.7.2/

Metadata Update from @frenaud:
- Issue close_status updated to: None
- Issue set to the milestone: FreeIPA 4.7.2 (was: FreeIPA 4.5 backlog)

master:

  • 9e1c26c755dd4ddf390d775a743105a8f6a2c460 certdb: provide meaningful err msg for wrong PIN
  • 6650d1b5631f77c0f07dd572bc27cdb98378997d ipa tests: CA less

ipa-4-7:

  • 112ea43d9541608bac53d431a13e31f0d329e22d certdb: provide meaningful err msg for wrong PIN
  • c7d7638bd3203adb44904c7f66ecd6218402293b ipa tests: CA less

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

master:

  • fbcb79af1398c6ef484c4003a39fa45ca2bb7546 ipatests: fix path in expected error message

ipa-4-7:

  • 6a066cc6f81a57be434964aceb49ce406d75ceed ipatests: fix path in expected error message
Metadata