2 years ago

#63852

test-img

shtuceron

Self-sign certificate not valid for internal request on RHEL

I have .net core web service on RHEL using Nginx. It uses https with self-signed certificate.

config for Nginx is:

listen 443 ssl;
server_name  _;

ssl_certificate /etc/nginx/ssl/my_cert.crt;
ssl_certificate_key /etc/nginx/ssl/my_cert.key;

With this config and self-signed certificate I had error in communications with web service - service sends request to itself. The error was

System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.

I decided to make the certificate trusted. Added it to /usr/share/pki/ca-trust-source/anchors/ folder then used update-ca-trust command.

After that I had another error on the server:

System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException (111): Connection refused

How can I resolve this problem with certificate and is my way right?

One more thing: Connection refused error occur after client successfully connected to web service and web service trying to connect to itself (another endpoint)

c#

asp.net

nginx

ssl

rhel

0 Answers

Your Answer

Accepted video resources