USE HTTPS by Running the Container with a Certificate

This article was translated from English: Does it need improvement?
Translated
View the article in English

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.

よくある質問

なぜドキュメントのセキュリティに HTTPS が重要なのか?

HTTPS はデータ転送を暗号化し、機密情報が転送中に傍受されることなく秘密に保たれるようにするため、ドキュメントのセキュリティにとって非常に重要です。

自分のアプリケーション用に HTTPS 証明書を作成するにはどうすればいいですか?

ASP.NET Core で使用するために新しい証明書を生成するには、コマンド dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\ironsecuredoc.pfx -p <CREDENTIAL_PLACEHOLDER> を実行して HTTPS 証明書を作成できます。

自分のローカルマシンで HTTPS 証明書が信頼されていることを確認するにはどうすればよいですか?

ローカルマシンで HTTPS 証明書を信頼するには、コマンド dotnet dev-certs https --trust を使用します。このコマンドは、生成された証明書をシステムに信頼させるように設定します。

HTTPS サポートを利用した Docker コンテナを実行するプロセスは何ですか?

HTTPS サポート付きで Docker コンテナを実行するには、HTTP および HTTPS ポートを公開し、IronSecureDoc_LicenseKeyCERTIFICATE_PASSWORD などの必要な環境変数を設定し、証明書のディレクトリを読み取り専用としてマウントします。

Docker セットアップで HTTPS 用にどのポートを設定すべきですか?

Docker セットアップで HTTPS を設定するには、ホストポートにコンテナポートをマッピングし、ポート 8081 を HTTPS 用、ポート 8080 を HTTP 用に公開します。

Docker コンテナに証明書のパスワードを渡すにはどうすればよいですか?

Docker 実行コマンドを実行するときに環境変数 CERTIFICATE_PASSWORD を使用して Docker コンテナに証明書のパスワードを渡します。

Docker で環境を「Production」として設定するために必要な手順は何ですか?

Docker で環境を「Production」として設定するには、Docker 実行コマンドに環境変数 ENVIRONMENT=Production を設定します。

Docker コマンドでプレースホルダーはどのように処理されるべきですか?

Docker コマンドでは、<IRONSECUREDOC_LICENSE_KEY><CERTIFICATE_PASSWORD> などのプレースホルダーを実際の IronSecureDoc ライセンスキーと証明書パスワードに置き換えて、適切な機能を確保します。

Curtis Chau
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

準備はいいですか?
バージョン: 2024.10 ただ今リリースされました