LoginSignup
10
7

More than 5 years have passed since last update.

ドット(.)を含むS3バケットへgsutilからアクセスする

Last updated at Posted at 2015-02-05

ドット(.)を含むS3バケットへgsutilからアクセスすると、エラーが生じることがあるので、その原因と対応策を説明するとともに、根本的な問題解消の方法を提案する。

発生しうる問題

$ gsutil ls s3://dot.example.com

Failure: Host dot.example.com.s3.amazonaws.com returned an invalid certificate (remote hostname "dot.example.com.s3.amazonaws.com" does not match certificate): {'notAfter': 'Apr  9 23:59:59 2015 GMT', 'subjectAltName': (('DNS', '*.s3.amazonaws.com'), ('DNS', 's3.amazonaws.com')), 'subject': ((('countryName', u'US'),), (('stateOrProvinceName', u'Washington'),), (('localityName', u'Seattle'),), (('organizationName', u'Amazon.com Inc.'),), (('commonName', u'*.s3.amazonaws.com'),))}.

この問題が発生する原因

Amazon S3が提供しているワイルドカード証明書のSANが*.s3.amazonaws.comなので、dot.example.com.s3.amazonaws.comとホスト名ミスマッチが生じる。

この問題に対するワークアラウンド

https://github.com/GoogleCloudPlatform/gsutil/blob/master/gslib/commands/config.py
にも説明がある通り、

    [Boto]

[...]

      https_validate_certificates

[...]

# Set 'https_validate_certificates' to False to disable server certificate
# checking. The default for this option in the boto library is currently
# 'False' (to avoid breaking apps that depend on invalid certificates); it is
# therefore strongly recommended to always set this option explicitly to True
# in configuration files, to protect against "man-in-the-middle" attacks.
https_validate_certificates = True

BotoのConfig (e.g., ~/.boto)のここの

https_validate_certificates = True

https_validate_certificates = False

とすればよい。

まとめ

S3 Static Website Hosting機能を使わないバケットに対して、ドット(.)を含む名前を使わない。(重要)

S3のバケットを作成する際、そのバケットでStatic Website Hosting機能を使うかどうか判断してから、バケット名を決める。(重要)

10
7
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
10
7