28
30

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Let's Encrypt でhttps化してくれるコンテナ (https-portal)

Last updated at Posted at 2020-06-17

日本語のREADME

通常

docker-compose.yml
https-portal:
  image: steveltn/https-portal:1
  ports:
    - '80:80'
    - '443:443'
  restart: always
  volumes:
    - ./certs:/var/lib/https-portal
  environment:
    #STAGE: 'production'
    #FORCE_RENEW: 'true'
    DOMAINS: >-
      example.com -> http://111.111.111.111

複数ドメイン

docker-compose.yml
https-portal:
  image: steveltn/https-portal:1
  ports:
    - '80:80'
    - '443:443'
  restart: always
  volumes:
    - ./certs:/var/lib/https-portal
  environment:
    #STAGE: 'production'
    #FORCE_RENEW: 'true'
    DOMAINS: >-
      example.com -> http://111.111.111.111
      ,example2.com -> http://111.111.111.112

443のポートを変える場合

docker-compose.yml
https-portal:
  image: steveltn/https-portal:1
  ports:
    - '80:80'
    - '10443:443'
  restart: always
  volumes:
    - ./certs:/var/lib/https-portal
  environment:
    #STAGE: 'production'
    #FORCE_RENEW: 'true'
    DOMAINS: >-
      example.com -> http://111.111.111.111

NAT下の場合

docker-compose.yml
https-portal:
  image: steveltn/https-portal:1
  ports:
    - '80:80'
    - '443:443'
  restart: always
  volumes:
    - ./certs:/var/lib/https-portal
  # NAT下の場合、hostsを使えばいけるっぽい?
  extra_hosts:
    - 'example.com:127.0.0.1'
  environment:
    #STAGE: 'production'
    #FORCE_RENEW: 'true'
    DOMAINS: >-
      example.com -> http://111.111.111.111

コンテナとリンクする場合

docker-compose.yml
https-portal:
  image: steveltn/https-portal:1
  ports:
    - '80:80'
    - '443:443'
  links:
    - nginx
  restart: always
  volumes:
    - ./certs:/var/lib/https-portal
  environment:
    #STAGE: 'production'
    #FORCE_RENEW: 'true'
    DOMAINS: >-
      example.com -> http://nginx

nginx:
  image: nginx

テスト段階では production を使わないほうが良い

公式

Certbotでの認証は以下がある。チャレンジのタイプ - Let's Encrypt - フリーな SSL/TLS 証明書

  • HTTP-01
    • Webサーバの認証用ファイルを80番ポートでアクセスしてもらい、発行されたワンタイムトークンと検証する。
    • セキュリティの観点から80番ポートを変える気はないとのこと。
  • DNS-01
    • ワンタイムトークンを対象ドメインのTXTレコードに登録し検証する。
  • TLS-SNI-01
  • TLS-ALPN-01
    • 開発中の様子。Apache、Nginx、Certbotにはまだ対応していない。

steveltn/https-portalはHTTP-01に対応している。

basic認証

https-portal:
  # ...
  environment:
    DOMAINS: 'username:password@example.com -> <upstream>'
28
30
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
30

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?