dataplaneapi icon indicating copy to clipboard operation
dataplaneapi copied to clipboard

When queries to individual pem file, seems dataplaneapi not able to find pem file

Open broxio opened this issue 1 year ago • 1 comments

I have pem file store in /etc/haproxy/ssl/ directory. I am trying to access the pem file using the following endpoint. the content of pem file is as follows:

-----BEGIN CERTIFICATE-----
certXXXXXXXXXX
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
chainXXXXXXXXXX
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
keyXXXXXXXXX
-----END PRIVATE KEY-----

the following is the response of the endpoint that lists all the pem files in the directory.

endpoint : /v2/services/haproxy/storage/ssl_certificates
[
  {
    "description": "managed SSL file",
    "file": "/etc/haproxy/ssl/le_wildcard_example.com.pem",
    "storage_name": "le_wildcard_example.com.pem"
  },
  {
    "description": "managed SSL file",
    "file": "/etc/haproxy/ssl/le_wildcard_foobar.com.pem",
    "storage_name": "le_wildcard_foobar.com.pem"
  }
]

but when I try to queries to individual pem file, it is not working as expected.

endpoint: /v2/services/haproxy/storage/ssl_certificates/le_wildcard_example.com.pem
{
  "code": 404,
  "message": "missing object: file le_wildcard_example.com.pem doesn't exist in dir: /etc/haproxy/ssl"
}

permisssion is 644 for the pem file. I am not sure what is the issue here. haproxy is running on 3.0.0 and dataplane api is 2.9.3 and below is dataplaneapi configuration

dataplaneapi.yml

config_version: 2
name: devmachine
mode: single
dataplaneapi:
  socket_path: /var/run/data-plane.sock
  debug_socket_path: /var/run/dataplane-debug.sock
  host: 0.0.0.0
  port: 5555
  advertised:
    api_address: ""
    api_port: 0
  scheme:
  - http
  userlist:
    userlist: dataplaneapi
  transaction:
    transaction_dir: /var/lib/dataplaneapi/transactions
    backups_number: 10
    backups_dir: /var/lib/dataplaneapi/backups
  resources:
    maps_dir: /etc/haproxy/maps
    ssl_certs_dir: /etc/haproxy/ssl
    general_storage_dir: /etc/haproxy/general
    spoe_dir: /etc/haproxy/spoe
  user:
  - name: xxx
    insecure: true
    password: xxx

broxio avatar Jun 07 '24 04:06 broxio

Have you tried URL-encode the file name?

mjuraga avatar May 09 '25 12:05 mjuraga