Linux SSL証明書の有効期限を監視する

Linuxサーバー

WebサーバーのSSL証明書であればnagios等で外部から監視することもできますが、certwatchというプログラムをインストールすると、ローカルのSSL証明書をお手軽に監視することができます。

RHELやCentOSの場合はパッケージcrypto-utilsに含まれています。

 yum install crypto-utils

下記パスに毎日有効期限をチェックするスクリプトが配置されます。

 /etc/cron.daily/certwatch

有効期限が近づくと下記のような警告メールがroot宛に送信されますので、メールエイリアスを変更して受信できるようにします。

 ################# SSL Certificate Warning ################
 
   Certificate for hostname 'onlineconsultant.jp', in file:
      /etc/pki/tls/certs/server.crt
 
   The certificate needs to be renewed; this can be done
   using the 'genkey' program.
 
   Browsers will not be able to correctly connect to this
   web site using SSL until the certificate is renewed.
 
 ##########################################################
                                  Generated by certwatch(1)

Lightbox 2 にキャプションをつける

WordPress

Lightbox 2 を使用してキャプションをつけたい時の簡単な方法です。

テキスト

titleにテキストを入力します。

 <a href="hogehoge" rel="lightbox[roadtrip]" title="キャプション">
   <img src="testtest.png">
 </a>

画像

titleにimgタグを書きます。
この時、記号はHTML表記で書くのがポイントです。

 <a href="hogehoge" rel="lightbox[roadtrip]" title="&lt;img src=&quot;/test/testtest.png&quot;&gt;">
   <img src="testtest.png">
 </a>

Let’s encrypt 複数ドメイン対応のSSL証明書を発行する

Linuxサーバー

Let’s Encryptで発行した証明書がwww無しドメイン用で先頭にwww.を付けるとSSL証明書の警告が表示されてしまうので、対応しました。

以下はexample.com用のSSL証明書をwww.example.comにも対応させる例です。

 ./certbot-auto certonly --webroot -d example.com -d www.example.com 
 -------------------------------------------------------------------------------
 You have an existing certificate that contains a portion of the domains you
 requested (ref: /etc/letsencrypt/renewal/example.com.conf)
 
 It contains these names: example.com
 
 You requested these names for the new certificate: example.com,
 www.example.com.
 
 Do you want to expand and replace this existing certificate with the new
 certificate?
 -------------------------------------------------------------------------------
 (E)xpand/(C)ancel: E
 Renewing an existing certificate
 Performing the following challenges:
 http-01 challenge for example.com
 http-01 challenge for www.example.com
 
 Select the webroot for example.com:
 -------------------------------------------------------------------------------
 1: Enter a new webroot
 -------------------------------------------------------------------------------
 Press 1 [enter] to confirm the selection (press 'c' to cancel): 1
 Input the webroot for example.com: (Enter 'c' to cancel):/var/www/html
 
 Select the webroot for www.example.com:
 -------------------------------------------------------------------------------
 1: Enter a new webroot
 2: /var/www/html
 -------------------------------------------------------------------------------
 Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
 Waiting for verification...
 Cleaning up challenges
 
 IMPORTANT NOTES:
  - Congratulations! Your certificate and chain have been saved at
    /etc/letsencrypt/live/eiyoukeisan.com/fullchain.pem. Your cert will
    expire on 2017-09-17. To obtain a new or tweaked version of this
    certificate in the future, simply run certbot-auto again. To
    non-interactively renew *all* of your certificates, run
    "certbot-auto renew"
  - If you like Certbot, please consider supporting our work by:
 
    Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
    Donating to EFF:                    https://eff.org/donate-le

Leaked Intent Receiver

Android

Activity has leaked IntentReceiver from com.google.android.gcm.GCMBroadcastReceiver that was originally registered here. Are you missing a call to unregisterReceiver?

AndroidのLogCatで、上記のようなエラーが出てくる時は、Activityで registerReceiver() をしているのに、ActivityのOnDestroy()に

 unregisterReceiver();

がない場合です。

タイトルのエラーの場合は

 GCMRegistrar.onDestroy(this);

をActivityのOnDestroy()に書く必要があります。