Newline in cert file makes the upload-signed-cert fail

Bug #1876155 reported by Camille Rodriguez
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
vault-charm
Fix Released
Medium
Unassigned

Bug Description

If a cert file has a newline at the end of it, the juju action fails with :
$ juju run-action --wait vault/leader upload-signed-csr pem="$(cat signed-csr-vault.pem |base64)" root-ca="$(cat root-ca.pem |base64)" allowed-domains='mydomain.com'
unit-vault-0:
  UnitId: vault/0
  id: "90"
  message: 'hvac.exceptions.InvalidRequest: no data found in PEM block'
  results:
    Stderr: |
      /var/lib/juju/agents/unit-vault-0/charm/lib/charm/vault_pki.py:204: DeprecationWarning: Call to deprecated function '_post'. This method will be removed in version '0.8.0' Please use the 'post' method on the 'hvac.adapters' class moving forward.
        json={'certificate': pem})

The charm should be able to handle newline at the end of a cert file. This especially happens when the cert was generated on Windows with CR/LF and it causes headaches for no reason.

Changed in vault-charm:
importance: Undecided → Medium
status: New → Triaged
Changed in vault-charm:
assignee: nobody → Martin Kalcok (martin-kalcok)
Changed in vault-charm:
status: Triaged → In Progress
Changed in vault-charm:
status: In Progress → Fix Committed
Revision history for this message
Aurelien Lourot (aurelien-lourot) wrote :
Changed in vault-charm:
milestone: none → 20.10
assignee: Martin Kalcok (martin-kalcok) → nobody
Changed in vault-charm:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.