USE HTTPS by Running the Container with a Certificate

If you need to run the container with a certificate, follow these steps to generate the certificate and configure the local machine:

Run the IronSecureDoc Container With a Certificate

  1. Generate Certificate:

    # Generates a new HTTPS certificate for use with ASP.NET Core.
    # Saves the certificate at the specified path and protects it with a password.
    dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -p <CREDENTIAL_PLACEHOLDER>
    
    # Trusts the generated certificate on your local machine.
    dotnet dev-certs https --trust
    # Generates a new HTTPS certificate for use with ASP.NET Core.
    # Saves the certificate at the specified path and protects it with a password.
    dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -p <CREDENTIAL_PLACEHOLDER>
    
    # Trusts the generated certificate on your local machine.
    dotnet dev-certs https --trust
    SHELL

    Replace <CREDENTIAL_PLACEHOLDER> with a password.

  2. Run the Docker Container:

    # Runs the IronSecureDoc Docker container with both HTTP and HTTPS ports exposed.
    docker container run -d \
     -p 8081:8081 -p 8080:8080 \ # Maps container ports to host ports for HTTP and HTTPS.
     -e HTTP_PORTS=8080 \ # Sets the HTTP port for the application.
     -e HTTPS_PORTS=8081 \ # Sets the HTTPS port for the application.
     -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> \ # Provides the IronSecureDoc license key.
     -e ENVIRONMENT=Production \ # Configures the environment as Production.
     -v %USERPROFILE%\.aspnet\https:/https:ro \ # Mounts the directory to the container as read-only.
     -e CERTIFICATE_PATH=%USERPROFILE%\.aspnet\https\ironsecuredoc.pfx \ # Specifies the path to the certificate in the container.
     -e CERTIFICATE_PASSWORD=<CERTIFICATE_PASSWORD> \ # Password for the certificate.
     ironsoftwareofficial/ironsecuredoc:latest # Specifies the Docker image to use.
    # Runs the IronSecureDoc Docker container with both HTTP and HTTPS ports exposed.
    docker container run -d \
     -p 8081:8081 -p 8080:8080 \ # Maps container ports to host ports for HTTP and HTTPS.
     -e HTTP_PORTS=8080 \ # Sets the HTTP port for the application.
     -e HTTPS_PORTS=8081 \ # Sets the HTTPS port for the application.
     -e IronSecureDoc_LicenseKey=<IRONSECUREDOC_LICENSE_KEY> \ # Provides the IronSecureDoc license key.
     -e ENVIRONMENT=Production \ # Configures the environment as Production.
     -v %USERPROFILE%\.aspnet\https:/https:ro \ # Mounts the directory to the container as read-only.
     -e CERTIFICATE_PATH=%USERPROFILE%\.aspnet\https\ironsecuredoc.pfx \ # Specifies the path to the certificate in the container.
     -e CERTIFICATE_PASSWORD=<CERTIFICATE_PASSWORD> \ # Password for the certificate.
     ironsoftwareofficial/ironsecuredoc:latest # Specifies the Docker image to use.
    SHELL

    Replace <IRONSECUREDOC_LICENSE_KEY> and <CERTIFICATE_PASSWORD> with your actual IronSecureDoc license key and certificate password, respectively.

Frequently Asked Questions

What is the purpose of using HTTPS with IronSecureDoc?

Using HTTPS with IronSecureDoc ensures that your documents and data are transmitted securely over the internet, preventing unauthorized access or interception.

How do I generate an HTTPS certificate for IronSecureDoc?

You can generate an HTTPS certificate using the command `dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -p`, replacing `` with your desired password.

How can I make my local machine trust the generated certificate?

To trust the generated certificate on your local machine, use the command `dotnet dev-certs https --trust`.

What command is used to run the IronSecureDoc Docker container?

The command to run the IronSecureDoc Docker container is `docker container run -d -p 8081:8081 -p 8080:8080 -e HTTP_PORTS=8080 -e HTTPS_PORTS=8081 -e IronSecureDoc_LicenseKey=-e ENVIRONMENT=Production -v %USERPROFILE%\.aspnet\https:/https:ro -e CERTIFICATE_PATH=%USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -e CERTIFICATE_PASSWORD=ironsoftwareofficial/ironsecuredoc:latest`.

What ports should be exposed when running the IronSecureDoc Docker container?

When running the IronSecureDoc Docker container, both HTTP and HTTPS ports should be exposed: 8080 for HTTP and 8081 for HTTPS.

Where should the HTTPS certificate be mounted in the Docker container?

The HTTPS certificate should be mounted in the Docker container at `%USERPROFILE%\.aspnet\https` as a read-only volume.

How do I specify the certificate password when running the container?

Specify the certificate password using the environment variable `CERTIFICATE_PASSWORD` when running the Docker container.

What is required to configure the environment as Production?

Set the environment variable `ENVIRONMENT` to 'Production' to configure the IronSecureDoc container environment as Production.

What should be done with the placeholders in the Docker command?

Replace `` and `` with your actual IronSecureDoc license key and the certificate password, respectively, in the Docker command.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.