LoginSignup
1
1

More than 5 years have passed since last update.

Cisco IOS Local保存されるPasswordの設定

Last updated at Posted at 2016-08-11

1. はじめに

念願のCatalyst3750が我が家に届きました。
前から知りたかった、Password関連の正しい設定方法を勉強します。

2. 前提

扱うのはLocal(=Config)に保存されるPasswordのみです。
つまりTacacsやRadiusなどのリモート管理サーバは扱いません。

3. 先に回答を書く

現時点で「正解」と思われる方法を先に書いておきます。

Loginパスワードの設定方法(Console接続)

Switch(config)#username Jinnai73 secret [consolepassword]
Switch(config)#line console 0
Switch(config-line)#login local

Enableパスワードの設定方法
Switch(config)#enable secret [enablepassword]

4. 他の設定方法を知る

上記以外の方法で設定してある環境も多いでしょうから、他の方法も見ていきましょう。

4-1. Loginパスワード

下記のように、line console 0にパスワードを書く方法があります。

Switch(config)#line console 0
Switch(config-line)#password [consolepassword]
Switch(config-line)#login

この方法の問題点は、「Passwordがconfigの中に平文で記述されてしまう」という点です。
show runで確認してみましょう。

Switch#sh run | b line
line con 0
 password [consolepassword]
 login

確かにそのまま見えてしまっていますね。

これを平文ではなく暗号化で書き込む方法もあります。
service password-encryptionコマンドを使うことによって、平文で保存されることはなくなります。

Switch(config)#service password-encryption
Switch#sh run | b line
line con 0
 password 7 07342243401A160912020A1F173D24362C0E
 login

はい、暗号化されました。
しかし残念ながら、この方法はCisco非推奨です。
passwordの後ろにある7の数字、これは続く文字列がヴィジュネル暗号で暗号化されていることを意味しています。

Any Cisco IOS configuration file that contains encrypted passwords must be treated with the same care that is used for a cleartext list of those same passwords.

引用元:http://www.cisco.com/c/en/us/support/docs/ip/access-lists/13608-21.html

ということでpasswordコマンドは平文で駄目、service password-encryptionを併用して暗号化しても駄目、ということになります。
Ciscoの推奨は、暗号化ではなくhashでパスワードを保存することであり、そのための方法が

username Jinnai73 secret [password]

です。この場合、[password]はmd5でhash化されてconfigに保存されます。
似たような方法ですが、

username Jinnai73 password [password]

とやってservice password-encryptionで暗号化する方法は非推奨です。

4-2. Enableパスワード

上記と全く同様の議論になります。
enable passwordコマンドは駄目で、enable secretを使いましょう、ということです。

5. おわりに

Catalystスイッチ1日目ですが、なかなか勉強になりました。
username passwordは職場でも使ってしまっているので「これからどうしようかなあ」と頭を抱えております。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1