teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

証明書をダウンロードし、SSL証明取得のロジックを入れたが変わらず

2021/02/11 05:19

投稿

enix3
enix3

スコア1

title CHANGED
File without changes
body CHANGED
@@ -45,12 +45,32 @@
45
45
  # 日付関数
46
46
  dt_now = datetime.datetime.now()
47
47
 
48
+ # 証明書のディレクトリ指定
49
+ dirname = os.getcwd()
50
+ if os.name == 'nt':
51
+ print("on windows")
52
+ ca_path = os.path.join(dirname, 'opt\mysql\ssl\ca.pem')
53
+ cert_path = os.path.join(dirname, 'opt\mysql\ssl\client-cert.pem')
54
+ key_path = os.path.join(dirname, 'opt\mysql\ssl\client-key.pem')
55
+ elif os.name == 'posix':
56
+ print("on mac or linux")
57
+ ca_path = os.path.join(dirname, 'opt/mysql/ssl/ca.pem')
58
+ cert_path = os.path.join(dirname, 'opt/mysql/ssl/client-cert.pem')
59
+ key_path = os.path.join(dirname, 'opt/mysql/ssl/client-key.pem')
60
+
61
+
62
+
48
63
  # DBとDBにログインするユーザの定義
49
64
  dns = {
50
65
  'user': 'XXXX',
51
66
  'host': 'us-cdbr-east-03.cleardb.com',
52
67
  'password': 'XXXX',
53
68
  'database': 'heroku_5c65651484c4266'
69
+ # 以下追加。
70
+ 'client_flags': [ClientFlag.SSL],
71
+ 'ssl_ca': ca_path,
72
+ 'ssl_cert': cert_path,
73
+ 'ssl_key': key_path
54
74
  }
55
75
  db = MySQL(**dns)
56
76
 

1

機密情報がオープンされていたので修正を行いました。ご指摘ありがとうございます。

2021/02/11 05:19

投稿

enix3
enix3

スコア1

title CHANGED
File without changes
body CHANGED
@@ -47,9 +47,9 @@
47
47
 
48
48
  # DBとDBにログインするユーザの定義
49
49
  dns = {
50
- 'user': 'b43c007fae4cbb',
50
+ 'user': 'XXXX',
51
51
  'host': 'us-cdbr-east-03.cleardb.com',
52
- 'password': '1a23f146',
52
+ 'password': 'XXXX',
53
53
  'database': 'heroku_5c65651484c4266'
54
54
  }
55
55
  db = MySQL(**dns)