TLS プロキシーと HTTP サービス

OpenStack endpoints are HTTP services providing APIs to both end-users on public networks and to other OpenStack services on the management network. It is highly recommended that all of these requests, both internal and external, operate over TLS. To achieve this goal, API services must be deployed behind a TLS proxy that can establish and terminate TLS sessions. The following table offers a non-exhaustive list of open source software that can be used for this purpose:

In cases where software termination offers insufficient performance, hardware accelerators may be worth exploring as an alternative option. It is important to be mindful of the size of requests that will be processed by any chosen TLS proxy.

以下に、幾つかの主な有名 Web サーバ/TLS 終端でTLSを有効にする為の幾つかの推奨設定例を示します。

Before we delve into the configurations, we briefly discuss the ciphers' configuration element and its format. A more exhaustive treatment on available ciphers and the OpenSSL cipher list format can be found at: ciphers.

ciphers = "HIGH:!RC4:!MD5:!aNULL:!eNULL:!EXP:!LOW:!MEDIUM"

または

ciphers = "kEECDH:kEDH:kRSA:HIGH:!RC4:!MD5:!aNULL:!eNULL:!EXP:!LOW:!MEDIUM"

暗号オプションの文字列は「:」で区切られます。「!」は直後の要素の否定を意味します。要素の順番は、HIGH のような修飾語句により上書きされない限り、優先度を意味します。上のサンプル文字列の要素をもう少し具体的に見ていきましょう。

kEECDH:kEDH

楕円曲線ディフィー・ヘルマン (EECDH や ECDHE と略す)

一時ディフィー・ヘルマン (EDH や DHE と略す) は素体グループを使用します。

Both approaches provide Perfect Forward Secrecy (PFS). See Perfect forward secrecy for additional discussion on properly configuring PFS.

一時楕円曲線はサーバーが名前付き曲線を用いて設定されている必要があります。素体グループよりセキュリティが高く、計算コストが低いです。しかしながら、素体グループはより幅広く実装されているので、一般的にどちらも一覧に含まれます。

kRSA

Cipher suites using the RSA exchange, authentication or either respectively.

HIGH

ネゴシエーション段階で利用可能な最高のセキュリティ暗号を選択します。これらは一般的に 128 ビット以上の鍵を持ちます。

!RC4

RC4 使用不可。RC4 は TLS V3 の文脈で欠陥があります。On the Security of RC4 in TLS and WPA を参照してください。

!MD5

MD5 使用不可。MD5 は衝突耐性がないため、メッセージ認証コード (MAC) や署名に利用できません。

!aNULL:!eNULL

平文を禁止します。

!EXP

export 暗号アルゴリズムを無効化します。これは、設計として弱く、一般的に 40 ビットか 56 ビットの鍵を使用しています。

暗号システムにおけるアメリカ輸出規制を解かれていて、もはやサポートする必要がありません。

!LOW:!MEDIUM

Disallows low (56 or 64 bit long keys) and medium (128 bit long keys) ciphers because of their vulnerability to brute force attacks (example 2-DES). This rule still permits Triple Data Encryption Standard (Triple DES) also known as Triple Data Encryption Algorithm (TDEA) and the Advanced Encryption Standard (AES), each of which has keys greater than equal to 128 bits and thus more secure.

プロトコル

Protocols are enabled/disabled through SSL_CTX_set_options. We recommend disabling SSLv2/v3 and enabling TLS.

Pound

この Pound の例は AES-NI 支援機能を有効化します。これは、この機能をサポートするプロセッサーを持つシステムにおいて性能を改善する支援になります。デフォルトの設定ファイルは、Ubuntu の場合 /etc/pound/pound.cfg 、RHEL、CentOS、openSUSE、SUSE Linux Enterprise の場合 /etc/pound.cfg です。

## see pound(8) for details
daemon      1
######################################################################
## global options:
User        "swift"
Group       "swift"
#RootJail   "/chroot/pound"
## Logging: (goes to syslog by default)
##  0   no logging
##  1   normal
##  2   extended
##  3   Apache-style (common log format)
LogLevel    0
## turn on dynamic scaling (off by default)
# Dyn Scale 1
## check backend every X secs:
Alive       30
## client timeout
#Client     10
## allow 10 second proxy connect time
ConnTO      10
## use hardware-acceleration card supported by openssl(1):
SSLEngine   "aesni"
# poundctl control socket
Control "/var/run/pound/poundctl.socket"
######################################################################
## listen, redirect and ... to:
## redirect all swift requests on port 443 to local swift proxy
ListenHTTPS
    Address 0.0.0.0
    Port    443
    Cert    "/etc/pound/cert.pem"
    ## Certs to accept from clients
    ##  CAlist      "CA_file"
    ## Certs to use for client verification
    ##  VerifyList  "Verify_file"
    ## Request client cert - don't verify
    ##  Ciphers     "AES256-SHA"
    ## allow PUT and DELETE also (by default only GET, POST and HEAD)?:
    NoHTTPS11   0
    ## allow PUT and DELETE also (by default only GET, POST and HEAD)?:
    xHTTP       1
    Service
        BackEnd
            Address 127.0.0.1
            Port    80
        End
    End
End

Stud

ciphers 行は必要に応じていじる事が出来ますが、しかしながらこの例の値は合理的な初期値です。デフォルトの設定ファイルは、/etc/stud ディレクトリーにあります。しかしながら、デフォルトで提供されません。

# SSL x509 certificate file.
pem-file = "
# SSL protocol.
tls = on
ssl = off
# List of allowed SSL ciphers.
# OpenSSL's high-strength ciphers which require authentication
# NOTE: forbids clear text, use of RC4 or MD5 or LOW and MEDIUM strength ciphers
ciphers = "HIGH:!RC4:!MD5:!aNULL:!eNULL:!EXP:!LOW:!MEDIUM"
# Enforce server cipher list order
prefer-server-ciphers = on
# Number of worker processes
workers = 4
# Listen backlog size
backlog = 1000
# TCP socket keepalive interval in seconds
keepalive = 3600
# Chroot directory
chroot = ""
# Set uid after binding a socket
user = "www-data"
# Set gid after binding a socket
group = "www-data"
# Quiet execution, report only error messages
quiet = off
# Use syslog for logging
syslog = on
# Syslog facility to use
syslog-facility = "daemon"
# Run as daemon
daemon = off
# Report client address using SENDPROXY protocol for haproxy
# Disabling this until we upgrade to HAProxy 1.5
write-proxy = off

Nginx

This Nginx example requires TLS v1.1 or v1.2 for maximum security. The ssl_ciphers line can be tweaked based on your needs, however this is a reasonable starting place. The default configuration file is /etc/nginx/nginx.conf.

server {
    listen : ssl;
    ssl_certificate ;
    ssl_certificate_key ;
    ssl_protocols TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!RC4:!MD5:!aNULL:!eNULL:!EXP:!LOW:!MEDIUM
    ssl_session_tickets off;

    server_name _;
    keepalive_timeout 5;

    location / {

    }
}

Apache

デフォルトの設定ファイルは、Ubuntu の場合 /etc/apache2/apache2.conf 、RHEL と CentOS の場合 /etc/httpd/conf/httpd.conf 、openSUSE と SUSE Linux Enterprise の場合 /etc/apache2/httpd.conf です。

<VirtualHost <ip address>:80>
  ServerName <site FQDN>
  RedirectPermanent / https://<site FQDN>/
</VirtualHost>
<VirtualHost <ip address>:443>
  ServerName <site FQDN>
  SSLEngine On
  SSLProtocol +TLSv1 +TLSv1.1 +TLSv1.2
  SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!EXP:!LOW:!MEDIUM
  SSLCertificateFile    /path/<site FQDN>.crt
  SSLCACertificateFile  /path/<site FQDN>.crt
  SSLCertificateKeyFile /path/<site FQDN>.key
  WSGIScriptAlias / <WSGI script location>
  WSGIDaemonProcess horizon user=<user> group=<group> processes=3 threads=10
  Alias /static <static files location>
  <Directory <WSGI dir>>
    # For http server 2.2 and earlier:
    Order allow,deny
    Allow from all

    # Or, in Apache http server 2.4 and later:
    # Require all granted
  </Directory>
</VirtualHost>

Apache 中の Compute API SSL エンドポイント (短い WSGI スクリプトと組み合わせる必要あり)

<VirtualHost <ip address>:8447>
  ServerName <site FQDN>
  SSLEngine On
  SSLProtocol +TLSv1 +TLSv1.1 +TLSv1.2
  SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!EXP:!LOW:!MEDIUM
  SSLCertificateFile    /path/<site FQDN>.crt
  SSLCACertificateFile  /path/<site FQDN>.crt
  SSLCertificateKeyFile /path/<site FQDN>.key
  SSLSessionTickets Off
  WSGIScriptAlias / <WSGI script location>
  WSGIDaemonProcess osapi user=<user> group=<group> processes=3 threads=10
  <Directory <WSGI dir>>
    # For http server 2.2 and earlier:
    Order allow,deny
    Allow from all

    # Or, in Apache http server 2.4 and later:
    # Require all granted
  </Directory>
</VirtualHost>

HTTP Strict Transport Security

全ての製品で HTTP strict transport security (HSTS) を使用する事を推奨します。このヘッダは、ブラウザが単一のセキュアな接続を確立した後に、セキュアでない接続を確立する事を防止します。パブリック上あるいは信用出来ないドメイン上の HTTP サービスをデプロイした場合、HSTS は特に重要です。HSTS を有効にするためには、全リクエストでこのようなヘッダを送信するよう Web サーバを設定します。

Strict-Transport-Security: max-age=31536000; includeSubDomains

テストでは1日の短いタイムアウトで始め、テストでユーザーに問題が発生しなかった事を確認した後で設定を1年まで増やします。一旦このヘッダーに大きなタイムアウトを設定してしまうと、無効化する事は (設計上) 非常に困難です。

Perfect forward secrecy

Configuring TLS servers for perfect forward secrecy requires careful planning around key size, session IDs, and session tickets. In addition, for multi-server deployments, shared state is also an important consideration. The example configurations for Apache and Nginx above disable the session tickets options to help mitigate some of these concerns. Real-world deployments may desire to enable this feature for improved performance. This can be done securely, but would require special consideration around key management. Such configurations are beyond the scope of this guide. We suggest reading How to botch TLS forward secrecy by ImperialViolet as a starting place for understanding the problem space.