2018/06/25

[MySQL] XAMPPのMySQLとphpMyAdminのパスワード設定

XAMPPのMySQLとphpMyAdminのパスワード設定
http://cly7796.net/wp/other/password-setting-of-mysql-root-and-phpmyadmin-of-xampp/

2018/06/10

[Python] 文字列内で変数を展開する

3.6 より formatted string literal が利用可能

Python 3.6の新機能f-strings(フォーマット文字列リテラル)について
http://codom.hatenablog.com/entry/2016/12/27/000000

Python3.6 から追加された文法機能
https://qiita.com/shirakiya/items/2767b30fd4f9c05d930b

ヒアドキュメント文字列でも利用可能

2018/05/27

[Windows] リネームしたはずのフォルダ名が元の名前に戻ってしまう

Explorer からフォルダ名変更 → 他のフォルダに移動すると、元の名前に戻ってしまう。
変更後にフォルダのプロパティを見ると、[全般]タブでは変更後の名前になっているが、隣の[共有]タブでは変更前の名前のままになっていることが確認できる。
原因は多岐にわたるようだが、当該フォルダ内の「隠しファイル」が影響している場合がある。

<autorun.infが影響する場合>
If this problem occurs again, enable hidden items to be shown in windows explorer. Find a Setup Information File called "autorun.inf" and edit or delete this file with administrator rights. Restart your computer and your problem should be fixed.

autorun.inf

[Autorun]
Label=Drive

https://social.technet.microsoft.com/Forums/en-US/b4da4617-f4ec-465e-a43d-f7e365784f99/still-cant-rename-folders-in-windows-10-file-explorer?forum=win10itprogeneral

他にも「desktop.ini」が影響する場合等々。
隠しファイルを表示できる状態にし、当該ファイルを削除で事象解消できることを確認

2018/05/21

[Ruby] `connect_nonblock': SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate) (OpenSSL::SSL::SSLError)

証明書を検証をしない方法でエラー抑止

require 'open-uri'
require 'openssl'
puts open('https://www.google.com/', :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE).read

[Ruby] open-uri の HTTPS リクエストで certificate verify failed
http://mofuken.blogspot.jp/2012/12/ruby-open-uri-https-certificate-verify.html

2018/05/17

[セキュリティ] certbot で Let's Encrypt 証明書更新

sudo /usr/local/bin/certbot \
    certonly \
    --webroot \
    -d example.com\
    -w /var/app/current/example.com

[aws] Elastic Beanstalk 単一インスタンス+ワイルドカード証明書(Let's Encrypt)で http 通信を利用する際の設定

Elastic Load Balancing(ELB)使用時は、Certificate Managerで作成したSSL証明書適用でOKだが、シングルインスタンスではNGなので、自前の証明書を適用。

<証明書取得>
certbot インストール
sudo pip install certbot

Zone APEX用証明書
sudo /usr/local/bin/certbot certonly \
--manual \
--preferred-challenges dns-01 \
--server https://acme-v02.api.letsencrypt.org/directory \
--domains example.com

SSLCertificateFile    "/etc/letsencrypt/live/example.com/fullchain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/example.com/privkey.pem"
が生成。
Route 53 で _acme-challenge.example.com の TXTレコードに指示された値を設定し、有効化。


ワイルドカードサブドメイン用証明書
sudo /usr/local/bin/certbot certonly \
--manual \
--preferred-challenges dns-01 \
--server https://acme-v02.api.letsencrypt.org/directory \
--domains *.example.com

SSLCertificateFile    "/etc/letsencrypt/live/example.com-0001/fullchain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/example.com-0001/privkey.pem"
が生成。
Route 53 で _acme-challenge.example.com の TXTレコードに指示された値を設定し、有効化。


<証明書設定>

/etc/httpd/conf.d/ssl.conf
以下の通り設定

  LoadModule ssl_module modules/mod_ssl.so
  Listen 443
  NameVirtualHost *:443

  <VirtualHost *:443>
    ServerName example.com
    DocumentRoot "/var/app/current/example/example.com"
    SSLEngine             on
    SSLCertificateFile    "/etc/letsencrypt/live/example.com-0001/fullchain.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/example.com-0001/privkey.pem"
    <Directory "/var/app/current/example/example.com">
      AllowOverride All
      Require all granted
    </Directory>
  </VirtualHost>

  <VirtualHost *:443>
    ServerName example.com
    DocumentRoot "/var/app/current/example/sub.example.com"
    SSLEngine             on
    SSLCertificateFile    "/etc/letsencrypt/live/example.com/fullchain.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/example.com/privkey.pem"
    <Directory "/var/app/current/example/sub.example.com">
      AllowOverride All
      Require all granted
    </Directory>
  </VirtualHost>

  SSLCipherSuite        EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
  SSLProtocol           All -SSLv2 -SSLv3
  SSLHonorCipherOrder   On
  SSLSessionTickets     Off
  Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"
  Header always set X-Frame-Options DENY
  Header always set X-Content-Type-Options nosniff

サーバ再起動後、SSL Sever Test にて確認。


installation error on amazon linux
https://github.com/certbot/certbot/issues/1680#issuecomment-358728515

CertbotでDNSによる認証(DNS-01)で無料のSSL/TLS証明書を取得する
http://blog.jicoman.info/2017/04/certbot_dns_01/

Let's Encryptのワイルドカード証明書を早速発行してもらう
https://narusejun.com/archives/23/

付録: Amazon Linux 2 での Let's Encrypt と Certbot の使用
https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/SSL-on-an-instance.html

SSL Server Test
https://www.ssllabs.com/ssltest/