[GH-ISSUE #2191] Custom Certificate Import not working- Upload Failed:0 #1568

Closed
opened 2026-02-26 07:31:35 +03:00 by kerem · 4 comments
Owner

Originally created by @ghostersk on GitHub (Aug 7, 2022).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2191

EDIT:
The issue was not in docker, but it could not read the certificates, as it was created with sudo... I do not understand why it could not read those files when I could read them without sudo as normal user


I just installed NPM and try to add my self signed certs. I tried multiple generating methods but none of them works. It is latest Docker installation.
Screenshot_20220807_134641

version: '3'
networks:
  main:
    external: true
services:
  npm:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    hostname: npm
    environment:
      DISABLE_IPV6: 'true'
    networks:
      main:
        ipv4_address: 10.100.111.253
    ports:
      - '127.0.0.1:80:80'
      - '127.0.0.1:81:81'
      - '127.0.0.1:443:443'
    volumes:
      - /opt/configdockers/npm/data:/data
      - /opt/configdockers/npm/letsencrypt:/etc/letsencrypt

I tried to generate Certificates with CA and import cert-key.pem as key and cert.pem as certificate:

sslpath=$(pwd)
mycn="localserver"
dnsname="*.local.com"

echo "Generating CA key and cert"
openssl genrsa -aes256 -out $sslpath/cakey.pem 4096
openssl req -new -x509 -sha256 -days 3650 -key $sslpath/cakey.pem \
-out $sslpath/ca.pem 
mkdir -p /usr/local/share/ca-certificates
cp $sslpath/ca.pem /usr/local/share/ca-certificates/ca.crt
sudo update-ca-certificates

echo "Generating RSA Key cert-key.pem"
openssl genrsa -out $sslpath/cert-key.pem 4096
mkdir -p $sslpath/$mycn
echo "Creating CSR: $sslpath/$mycn/cert.csr"
openssl req -new -sha256 -subj "/CN=$mycn" -key $sslpath/cert-key.pem \
-out $sslpath/$mycn/cert.csr
echo "subjectAltName=DNS:$dnsname" > $sslpath/$mycn/extfile.cnf
echo "Creating Certificate $sslpath/$mycn/cert.pem"
openssl x509 -req -sha256 -days 3650 -in $sslpath/$mycn/cert.csr \
-CA $sslpath/ca.pem -CAkey $sslpath/cakey.pem \
-out $sslpath/$mycn/cert.pem -extfile $sslpath/$mycn/extfile.cnf \
-CAcreateserial

Also I just tried to generate simple certificate but still same issue:

openssl req -x509 -nodes -days 3650 -subj "/C=GB/ST=QC/O=Company, Inc./CN=test.com" -addext "subjectAltName=DNS:*.test.com;test.com" -newkey rsa:2048 -keyout key.key -out cert.crt;

No posts here given me any solution. I believe it was said that this is already solved in all of them.
I have suspicion that it cannot upload those certificates, but i cannot find any reason why as there is no error in NPM logs
I tried to run it from localhost:81, 127.0.0.1:81 and from the docker image ip too

Originally created by @ghostersk on GitHub (Aug 7, 2022). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2191 EDIT: The issue was not in docker, but it could not read the certificates, as it was created with sudo... I do not understand why it could not read those files when I could read them without sudo as normal user ----------- I just installed NPM and try to add my self signed certs. I tried multiple generating methods but none of them works. It is latest Docker installation. ![Screenshot_20220807_134641](https://user-images.githubusercontent.com/68815071/183291217-cd0fbecb-d87f-4c16-8996-a7ad699aa4be.png) ``` version: '3' networks: main: external: true services: npm: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped hostname: npm environment: DISABLE_IPV6: 'true' networks: main: ipv4_address: 10.100.111.253 ports: - '127.0.0.1:80:80' - '127.0.0.1:81:81' - '127.0.0.1:443:443' volumes: - /opt/configdockers/npm/data:/data - /opt/configdockers/npm/letsencrypt:/etc/letsencrypt ``` I tried to generate Certificates with CA and import cert-key.pem as key and cert.pem as certificate: ``` sslpath=$(pwd) mycn="localserver" dnsname="*.local.com" echo "Generating CA key and cert" openssl genrsa -aes256 -out $sslpath/cakey.pem 4096 openssl req -new -x509 -sha256 -days 3650 -key $sslpath/cakey.pem \ -out $sslpath/ca.pem mkdir -p /usr/local/share/ca-certificates cp $sslpath/ca.pem /usr/local/share/ca-certificates/ca.crt sudo update-ca-certificates echo "Generating RSA Key cert-key.pem" openssl genrsa -out $sslpath/cert-key.pem 4096 mkdir -p $sslpath/$mycn echo "Creating CSR: $sslpath/$mycn/cert.csr" openssl req -new -sha256 -subj "/CN=$mycn" -key $sslpath/cert-key.pem \ -out $sslpath/$mycn/cert.csr echo "subjectAltName=DNS:$dnsname" > $sslpath/$mycn/extfile.cnf echo "Creating Certificate $sslpath/$mycn/cert.pem" openssl x509 -req -sha256 -days 3650 -in $sslpath/$mycn/cert.csr \ -CA $sslpath/ca.pem -CAkey $sslpath/cakey.pem \ -out $sslpath/$mycn/cert.pem -extfile $sslpath/$mycn/extfile.cnf \ -CAcreateserial ``` Also I just tried to generate simple certificate but still same issue: ``` openssl req -x509 -nodes -days 3650 -subj "/C=GB/ST=QC/O=Company, Inc./CN=test.com" -addext "subjectAltName=DNS:*.test.com;test.com" -newkey rsa:2048 -keyout key.key -out cert.crt; ``` No posts here given me any solution. I believe it was said that this is already solved in all of them. I have suspicion that it cannot upload those certificates, but i cannot find any reason why as there is no error in NPM logs I tried to run it from localhost:81, 127.0.0.1:81 and from the docker image ip too
kerem 2026-02-26 07:31:35 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@rezzorix commented on GitHub (Aug 8, 2022):

Looks like the container has no permissions to upload/write into the folders...

With what user have you started the container? sudo by any chance?

<!-- gh-comment-id:1207846975 --> @rezzorix commented on GitHub (Aug 8, 2022): Looks like the container has no permissions to upload/write into the folders... With what user have you started the container? sudo by any chance?
Author
Owner

@ghostersk commented on GitHub (Aug 8, 2022):

I do not remember. when i look for the permissions in the docker all belongs to root.
I run docker without sudo as it is set up to run without. I store folders in /opt and those folders require sudo for me.
But I can write inside of the container to those volumes.
Can you let me know what folder, path should I check if is writable or what user it shoul have?
This is list of users in the container:

root:*:19079:0:99999:7:::
daemon:*:19079:0:99999:7:::
bin:*:19079:0:99999:7:::
sys:*:19079:0:99999:7:::
sync:*:19079:0:99999:7:::
games:*:19079:0:99999:7:::
man:*:19079:0:99999:7:::
lp:*:19079:0:99999:7:::
mail:*:19079:0:99999:7:::
news:*:19079:0:99999:7:::
uucp:*:19079:0:99999:7:::
proxy:*:19079:0:99999:7:::
www-data:*:19079:0:99999:7:::
backup:*:19079:0:99999:7:::
list:*:19079:0:99999:7:::
irc:*:19079:0:99999:7:::
gnats:*:19079:0:99999:7:::
nobody:*:19079:0:99999:7:::
_apt:*:19079:0:99999:7:::
<!-- gh-comment-id:1208317797 --> @ghostersk commented on GitHub (Aug 8, 2022): > I do not remember. when i look for the permissions in the docker all belongs to root. I run docker without sudo as it is set up to run without. I store folders in /opt and those folders require sudo for me. But I can write inside of the container to those volumes. Can you let me know what folder, path should I check if is writable or what user it shoul have? This is list of users in the container: ``` root:*:19079:0:99999:7::: daemon:*:19079:0:99999:7::: bin:*:19079:0:99999:7::: sys:*:19079:0:99999:7::: sync:*:19079:0:99999:7::: games:*:19079:0:99999:7::: man:*:19079:0:99999:7::: lp:*:19079:0:99999:7::: mail:*:19079:0:99999:7::: news:*:19079:0:99999:7::: uucp:*:19079:0:99999:7::: proxy:*:19079:0:99999:7::: www-data:*:19079:0:99999:7::: backup:*:19079:0:99999:7::: list:*:19079:0:99999:7::: irc:*:19079:0:99999:7::: gnats:*:19079:0:99999:7::: nobody:*:19079:0:99999:7::: _apt:*:19079:0:99999:7::: ```
Author
Owner

@rezzorix commented on GitHub (Aug 9, 2022):

Hmm I also see that you set
ports: - '127.0.0.1:80:80' - '127.0.0.1:81:81' - '127.0.0.1:443:443'
Which I believe is not correct... set it to
ports: - '80:80' - '81:81' - '443:443'
Then try again.

<!-- gh-comment-id:1208873158 --> @rezzorix commented on GitHub (Aug 9, 2022): Hmm I also see that you set ` ports: - '127.0.0.1:80:80' - '127.0.0.1:81:81' - '127.0.0.1:443:443'` Which I believe is not correct... set it to ` ports: - '80:80' - '81:81' - '443:443'` Then try again.
Author
Owner

@ghostersk commented on GitHub (Aug 10, 2022):

I just installed it on VM with Debian 11 and same error...

<!-- gh-comment-id:1211204010 --> @ghostersk commented on GitHub (Aug 10, 2022): I just installed it on VM with Debian 11 and same error...
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#1568
No description provided.