Cisco 841M J と Google Domains を使った DDNS 設定
ズバリな記事がなかったので備忘録を兼ねて。
IOS 15.8(3)M1a のこのルータで DDNS がしたい。CCP から DDNS の設定ができるが、設定できる内容は限定的なのでコマンドを使って設定する必要がある。今回使いたいサービスは Google Domains の DDNS なのだが ip ddns update method
を使うだけではうまくいかなかった。
この記事では DDNS に https を使う場合にどのようなことが起こるのか、調査方法と併わせて紹介する。
まずはログ出力を有効にしてみる。
841MJ#debug ip ddns update Dynamic DNS debugging is on 841MJ#debug ssl openssl errors TLS errors debugging is on
この状態で DDNS を作動させてみると以下のようなログが得られる。
Mar 22 15:05:24.371: DYNDNSUPD: Adding DNS mapping for test.example.com <=> 198.51.100.23 Mar 22 15:05:24.371: HTTPDNS: Update add called for test.example.com <=> 198.51.100.23 Mar 22 15:05:24.371: HTTPDNSUPD: Session ID = 0x8 Mar 22 15:05:24.371: HTTPDNSUPD: URL = 'https://myid:mypassword@domains.google.com/nic/update?hostname=test.example.com&myip=198.51.100.23' Mar 22 15:05:24.371: HTTPDNSUPD: Sending request Mar 22 15:05:24.391: opssl_SetPKIInfo entry Mar 22 15:05:24.395: opssl_SetPKIInfo done. Mar 22 15:05:24.459: 256316420:error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed:../VIEW_ROOT/cisco.comp/openssl/src/dist/ssl/s3_clnt.c:1249: Mar 22 15:05:24.459: HTTPDNSUPD: Call returned Request Aborted, update of test.example.com <=> 198.51.100.23 failed Mar 22 15:05:24.459: DYNDNSUPD: Another update completed (outstanding=0, total=0) Mar 22 15:05:24.463: HTTPDNSUPD: Clearing all session 8 info
DDNS が失敗しているくさい。このメッセージはどうも証明書の問題らしい。解決するにはルータ本体に証明書を追加すれば良い。証明書を得る手段はなんでも良いが、とりあえずブラウザで https://domains.google.com/nic/update を開いてみてルート CA 証明書をダウンロードする。2021年まで有効な GlobalSignRootCA-R2 の証明書が入手できたと思う。
あとはそれをルータに流し込む。以下は自分が設定した内容。
841MJ#configure t Enter configuration commands, one per line. End with CNTL/Z. 841MJ(config)#crypto ca trustpoint GlobalSignRootCA-R2 841MJ(ca-trustpoint)#enrollment terminal pem 841MJ(ca-trustpoint)#exit 841MJ(config)#crypto ca authenticate GlobalSignRootCA-R2 Enter the base 64 encoded CA certificate. End with a blank line or the word "quit" on a line by itself -----BEGIN CERTIFICATE----- MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1 MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8 eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG 3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO 291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7 TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg== -----END CERTIFICATE----- quit Certificate has the following attributes: Fingerprint MD5: 9414777E 3E5EFD8F 30BD41B0 CFE7D030 Fingerprint SHA1: 75E0ABB6 13851227 1C04F85F DDDE38E4 B7242EFE % Do you accept this certificate? [yes/no]: yes Trustpoint CA certificate accepted. % Certificate successfully imported 841MJ(config)#
DDNS を作動させて、うまくいけば以下のようなログが出て DDNS が成功する。
Mar 22 15:34:27.860: DYNUPD: SWIF comingup 'Virtual-Access3' Mar 22 15:34:31.212: DYNDNSUPD: Adding DNS mapping for test.example.com <=> 198.51.100.37 Mar 22 15:34:31.212: HTTPDNS: Update add called for test.example.com <=> 198.51.100.37 Mar 22 15:34:31.212: HTTPDNSUPD: Session ID = 0xA Mar 22 15:34:31.212: HTTPDNSUPD: URL = 'https://myid:mypassword@domains.google.com/nic/update?hostname=test.example.com&myip=198.51.100.37' Mar 22 15:34:31.212: HTTPDNSUPD: Sending request Mar 22 15:34:31.232: opssl_SetPKIInfo entry Mar 22 15:34:31.232: opssl_SetPKIInfo done. Mar 22 15:34:33.120: CRYPTO_OPSSL: Returning TCPFINErr as EOF rcvd Mar 22 15:34:33.144: opssl_SetPKIInfo entry Mar 22 15:34:33.144: opssl_SetPKIInfo done. Mar 22 15:34:35.699: CRYPTO_OPSSL: Returning TCPFINErr as EOF rcvd Mar 22 15:34:35.699: HTTPDNSUPD: Response for update test.example.com <=> 198.51.100.37 Mar 22 15:34:35.699: HTTPDNSUPD: DATA START good 198.51.100.37 Mar 22 15:34:35.699: HTTPDNSUPD: DATA END, Status is Response data recieved, successfully Mar 22 15:34:35.699: HTTPDNSUPD: Call returned SUCCESS, update of test.example.com <=> 198.51.100.37 succeeded Mar 22 15:34:35.699: DYNDNSUPD: Another update completed (outstanding=0, total=0) Mar 22 15:34:35.699: HTTPDNSUPD: Clearing all session 10 info
めでたし。
Introduce of redpen-paragraph.el
Table of Contents
This article is the same as Introduce of redpen-paragraph.el & translated on the article. http://d.hatena.ne.jp/karronoli/20160512
I had the opportunity to write the manual, I had created redpen-paragraph.el as Emacs Lisp package.
karronoli/redpen-paragraph.el: RedPen interface for proofreading paragraph.
I can use better RedPen by using this. It has passed about a year since created. I have written this artcle because long-awaited.
Introduce of RedPen
Quoted from http://redpen.cc/
RedPen is a proofreading tool to help writers or programmers who write technical documents or manuals that need to adhere to a writing standard.
RedPen supports some input file format, Markdown, AsciiDoc and LaTex, etc. RedPen developer member correct the issues I found. GitHub If you are ArchLinux user, Try AUR (en) - redpen. if need, you can use from systemd.
Quick start guide
Hit the key binded redpen-paragraph on any paragraph. Hit the key with C-u to proofread a file.
(define-key global-map (kbd "C-c C-r") 'redpen-paragraph)
Why did I create redpen-paragraph.el?
Because I want to proofread the org-mode in Emacs, and RedPen did not correspond to the org-mode. org-mode format is not so much complexity basically.
I think I may create the practical implementation if the use of the regular expression of org-mode. But I can't follow the trivial org-mode changes. Well, a part of the file, any paragraph can be proofreaded in additon to org-mode, isn't it? (Example: source code comments)
I had created redpen-paragraph.el from the above reasons.
What can?
Proofread the paragraph
M-x redpen-paragraph. You request the paragraph on cursor to redpen-server, view the errors by compilation-mode. You can jump the error position if found the error. But you should set a key binding.
Proofread in org-mode
You can proofread the visible text ignoring the invisible text in the paragraph. To change this behavior, You customize redpen-paragraph-alist variable per major-mode.
Proofread a file
Invoke with the prefix key(C-u), You can proofread to a original file. To proofread a original file always, add the bellow line to .emacs.el.
(defvar redpen-paragraph-force-reading-whole t)
Or, You should consider using flycheck also.
Detect the languages
RedPen support English and Japanese. The input text contains ASCII and not ASCII, it switch the language of RedPen in accordance with the ratio of English and not English.
Caution
Demo redpen-server
The redpen-server that can be used after installation of the elisp is demo use only. It is installed to my Heroku application. You worry About security, response speed and continuity of service, You must make a server instance on somewhere.
Character count of Japanese on Emacs
Emacs counts the one character of Japanese as two characters.
It can't point correct offset of the line with Japanese character by the reason.
I wonder if the setting of this behavior is where…
I found the flag!!
If non-nil, column numbers in error messages are screen columns. Otherwise they are interpreted as character positions, with each character occupying one column.
Eval it!
(setq compilation-error-screen-columns nil)
Future plan
I want to make a JavaScript Extension or issues, because RedPen have Ambiguous behavior, and don't have the function I want. The plan of redpen-paragraph.el is to change to use the json2 format.
今後の予定
RedPen には欲しい機能や「?」な挙動が幾らかあるので JavaScript や Issue で今後も突っついていきたいと思う.
redpen-paragraph.el は json2 フォーマットを使うように変更する.
注意点
デモ用途 redpen-server
elisp のインストール直後で利用できる redpen-server は自分が Heroku にデモ用途として設置している.セキュリティや応答性,サービスの継続性を気にする場合は各自でサーバを立てること.
Emacs の日本語カウント
Emacs は日本語の1文字を2文字分として解釈する.なのでエラー場所を表示するときに,日本語のある場所への正確な移動ができない.この挙動を変える設定はどこにあるんだろう…
切り替えフラグあった!!
If non-nil, column numbers in error messages are screen columns. Otherwise they are interpreted as character positions, with each character occupying one column.
(setq compilation-error-screen-columns nil)
なにができる?
文章単位での校正
M-x redpen-paragraph でカーソル上にある文章を redpen-server に投げて,返ってきた結果を compilation-mode で表示する.エラーがあれば,その項目を選んで文書中の該当箇所に飛べる.ただし毎回 M-x から呼ぶのは億劫なので,任意のキーに割り当てて使うことを想定している.
org-mode での校正
文章中の非表示文字を無視して,表示文字に対して校正する.redpen-paragraph-alist をカスタマイズすることでメジャーモードごとに挙動を変更できる.
ファイル単位での校正
キー割り当てをして C-u を付けて呼ぶと一時的にファイル単位で校正する.常にファイル単位で校正したい場合は .emacs.el に以下の記述をする.
(defvar redpen-paragraph-force-reading-whole t)
常にファイル単位で校正したい場合は flycheck も検討するといいと思う.
入力言語の判定
RedPen は英語と日本語に対応している.入力文章が ASCII 範囲内の文字とそれ以外の範囲の文字が混ざってる場合,それぞれの文字数の比に応じて RedPen の使用言語を切り替える.
redpen-paragraph.el の紹介
マニュアルを書く機会があったので redpen-paragrah.el という Emacs Lisp パッケージを作ってみた.これによって Emacs から RedPen をいい感じに使うことができる.この elisp は作ってから1年位使っていて,せっかくなので今回の記事を起こした.
RedPen の紹介
RedPen より引用.
RedPen はプログラマや記者が規約にしたがって文書 (マニュアルやソフトウェアドキュメント) を記述するのをサポートします。 RedPen は自然言語で記述された入力文書のチェックを自動化します。
RedPen には入力文書のフォーマットがいくつかあって,Markdown や AsciiDoc , LaTex 等サポートされてる.Pull Request や Issue もいい感じに対応してくれる.
Issues · redpen-cc/redpen · GitHub
ArchLinux ユーザは AUR (en) - redpen を使っておくと systemd から使えるので良かったらどうぞ.
クイックスタートガイド
どこかのキーに redpen-paragraph を割り当てて任意の文章上で起動.C-u 付きで起動すればファイル単位を校正できる.
(define-key global-map (kbd "C-c C-r") 'redpen-paragraph)