Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] API Cert Upload Changes Domain_Names #4245

Open
MeCJay12 opened this issue Dec 19, 2024 · 0 comments
Open

[BUG] API Cert Upload Changes Domain_Names #4245

MeCJay12 opened this issue Dec 19, 2024 · 0 comments
Labels

Comments

@MeCJay12
Copy link

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • X Yes / No
  • Are you sure you're not using someone else's docker image?
    • X Yes / No
  • Have you searched for similar issues (both open and closed)?
    • X Yes / No

Describe the bug
When uploading certificate keys via the API, domain_names is reset to match the CN of the certificate which doesn't match the SAN of a certificate with multiple domains.

Nginx Proxy Manager Version
v2.12.1

To Reproduce

  1. Use the API to create a certificate object:
    url = f"http://npm.exmaple.com/api/nginx/certificates/"
    headers = { "Authorization": f"Bearer " + api_key }

    data = {
      "provider": "other",
      "nice_name": "speed.example.com, speed.ext.example.com",
      "domain_names": ['speed.example.com', 'speed.ext.example.com']
    }

    response = requests.post(url, headers=headers, json=data)
    id = response.json().get('id')
  1. Upload keys to the certificate object:
    url = f"http://npm.exmaple.com/api/nginx/certificates/{id}/upload"

    # public, chain, and private are variables containing respective keys
    files = {
      "certificate": ("cert.pem", public),
      "certificate_key": ("privekey.pem", private),
      "intermediate_certificate": ("chain.pem", chain)
    }

    response = requests.post(url, headers=headers, files=files)
  1. View certificate:
url = f"http://npm.exmaple.com/api/nginx/certificates/{id}
response = requests.get(url, headers=headers)
print(json.dumps(response.json(), indent=2))

{
  "id": 22,
  "created_on": "2024-12-19T02:56:58.000Z",
  "modified_on": "2024-12-19T02:56:59.000Z",
  "owner_user_id": 1,
  "provider": "other",
  "nice_name": "speed.example.com, speed.ext.example.com",
  "domain_names": [
    "speed.example.com"                                                       <<<<<<<<<<<
  ],
  "expires_on": "2025-01-29T11:48:02.000Z",
  "meta": {
    "certificate": "-----BEGIN CERTIFICATE-----...",
    "certificate_key": "-----BEGIN PRIVATE KEY-----...",
    "intermediate_certificate": "-----BEGIN CERTIFICATE-----..."
  }
}

Expected behavior

{
  "id": 22,
  "created_on": "2024-12-19T02:56:58.000Z",
  "modified_on": "2024-12-19T02:56:59.000Z",
  "owner_user_id": 1,
  "provider": "other",
  "nice_name": "speed.example.com, speed.ext.example.com",
  "domain_names": [
    "speed.example.com",                                                        <<<<<<<<<<<
    "speed.ext.example.com"                                                   <<<<<<<<<<<
  ],
  "expires_on": "2025-01-29T11:48:02.000Z",
  "meta": {
    "certificate": "-----BEGIN CERTIFICATE-----...",
    "certificate_key": "-----BEGIN PRIVATE KEY-----...",
    "intermediate_certificate": "-----BEGIN CERTIFICATE-----..."
  }
}

Screenshots
All CLI

Operating System
Script run on Windows with Python v3.12.7 connecting to NPM as a Docker container on Ubuntu 22.04.5 LTS

Additional context
N/A

@MeCJay12 MeCJay12 added the bug label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant