Last active
May 14, 2021 07:06
-
-
Save naokiri/a97db9c2803ed1237cc505d7c1599395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cut the network cable, use 1CD linux like isolated environment. | |
# Don't leave something on disk | |
mkdir workspace | |
sudo mount -t tmpfs tmpfs workspace | |
cd workspace | |
gpg --expert --full-generate-key | |
# Certificate のみを生成し、マスターキーとする。このマスターキーのパスフレーズが必要。 | |
# Yubikey5に入れる場合、RSA4096が推奨されているはず。楕円曲線暗号にも対応していたか? | |
gpg -K --keyid-format short | |
# keyID 確認 | |
gpg --export-secret-keys {keyID} | paperkey > secret.txt | |
# secret.txtを印刷して耐火金庫に入れておく。こちらの場合復号に公開鍵も必要になる。 | |
gpg --armor --export-secret-keys {keyID} > master.key | |
# master.keyファイルを作った場合、どこか暗号化したオフラインディスクに入れる。 | |
# どちらかはサブキーを更新したりする場合に必要となる。 | |
gpg --output ./revoke.asc --gen-revoke {keyID} | |
# revoke.ascも印刷して耐火金庫に入れるなり、暗号化したオフラインディスクに入れるなり。 | |
gpg --expert --edit-key {keyID} | |
> addkey | |
# Certificate, Sign, Authentication用の鍵を各々作る。有効期限は設定しておく。 | |
gpg --export {keyID} | hokey lint | |
# hokeyがあれば。Best practiceに沿っていれば緑、おそらくマスターキーが無期限なところが赤となるが、それ以外は良しだと思われる。 | |
gpg --card-edit | |
gpg/card> key 1 | |
gpg/card> keytocard | |
# 各鍵をyubikeyの各用途の鍵入れに移す。この操作で今後一切これらの鍵はエキスポートできなくなる。 | |
# マスターキーのパスフレーズとyubikeyのadmin PINが求められる。 | |
gpg --delete-secret-key {keyID} | |
cd ../ | |
sudo umount ./workspace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment