はじめに
ログインユーザーのパスワードや enable secret に対するハッシュアルゴリズムがいくつかあります。
ハッシュアルゴリズムを指定しない場合は自動で選択されますが、algorithm-type
というオプションで明示的にも指定できます(昨日知りました)。
この記事では、指定しない場合と指定する場合それぞれの動作例を紹介します。
- 動作確認環境: Cisco IOSv 15.9(3)M2
指定なし
ユーザーパスワード
ios01(config)#username kingyo secret ? 0 Specifies an UNENCRYPTED secret will follow 5 Specifies a MD5 HASHED secret will follow 8 Specifies a PBKDF2 HASHED secret will follow 9 Specifies a SCRYPT HASHED secret will follow LINE The UNENCRYPTED (cleartext) user secret
この環境では、上記3つのハッシュアルゴリズムに対応しています。
このコマンド上で、5
や 9
を指定するのは、あくまでもその形式でハッシュ化された文字列をセットで指定するということです。
一方で、平文を指定して、ハッシュしたうえでコンフィグに保存しておきたい場合は、ここで平文を指定しいます。
ios01(config)#username kingyo secret dummpypassword ios01(config)#do sh run | inc kingyo username kingyo secret 9 $9$ZmV3mHR2JNE...(略)...fmQ/q6RVVt3Q
ハッシュアルゴリズムを特に指定しない場合は、今回は SCRYPT でハッシュ化されました。
enable secret
ios01(config)#enable secret himitsu ios01(config)#do sh run | inc enable enable secret 9 $9$TGudhy8wblij6s$KCVMA...(略)...br4rpnNTO5EEKy6AiLnDhrXQ6HG6
同じく SCRYPT でハッシュ化されました。
algorithm-type
による指定
平文指定と同時に algorithm-type
オプションでハッシュアルゴリズムを指定します。
MD5
algorithm-type
で md5
を指定します。
ユーザーパスワード
ios01(config)#username kingyo algorithm-type ? md5 Encode the password using the MD5 algorithm scrypt Encode the password using the SCRYPT hashing algorithm sha256 Encode the password using the PBKDF2 hashing algorithm ios01(config)#username kingyo algorithm-type md5 sec ios01(config)#username kingyo algorithm-type md5 secret dummpypassword ios01(config)#do sh run | inc kingyo username kingyo secret 5 $1$26Rc$Udv...(略)...MFnil7oS2/
投入後のコンフィグには、algorithm-type
オプションは表示されず、代わりに、例の数字とハッシュ化文字列の組み合わせになります。
enable secret
ios01(config)#enable algorithm-type ? md5 Encode the password using the MD5 algorithm scrypt Encode the password using the SCRYPT hashing algorithm sha256 Encode the password using the PBKDF2 hashing algorithm ios01(config)#enable algorithm-type md5 secret himitsu ios01(config)#do sh run | inc enable enable secret 5 $1$HV4O$b7a...(略)...FWAv6KChK.
SCRYPT
algorithm-type
で scrypt
を指定します。
以降、ユーザーパスワードでの例のみ紹介します。
ios01(config)#username kingyo algorithm-type scrypt secret dummpypassword ios01(config)#do sh run | inc kingyo username kingyo secret 9 $9$YbDbDq1mN2FjUc$...(略)...D0s4hYLjVAYtay6src
PBKDF2
algorithm-type
で sha256
を指定します。
ios01(config)#username kingyo algorithm-type sha256 secret dummpypassword ios01(config)#do sh run | inc kingyo username kingyo secret 8 $8$kMPJPfu1dkoCaM$...(略)...2ZPJ/USf6.usW9RVPe/dOJE5pe.Hzg
参考
共有ありがとうございます。
enableパスワードのハッシュアルゴリズムも設定できるみたいですね。
— えんでぃ (@stopendy0122) 2021年4月10日
SCRYPT (type 9) がかなり強そうに見えますwhttps://t.co/O0XNc2Xbcp