Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15165249
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: 系统运维

2008-05-24 20:00:07

3.1.  设置用户名和密码

提问 为每个单独的人员设置不同的用户名和密码

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#username neoshi  password ioscookbook    username weak nopassword

Router1(config)#aaa new-model

Router1(config)#aaa authentication login local_auth local

Router1(config)#line vty 0 4

Router1(config-line)#login authentication local_auth

Router1(config-line)#exit

Router1(config)#end

Router1#

注释 设置单独的用户名和密码的好处就不用多说了,这里只提一个就是在日志中会显示谁做了修改,比如%SYS-5-RELOAD: Reload requested by kdooley on vty0 (172.25.1.1).另外在username这个命令里面还有一个autocommand的选项,实现登录以后自动执行某个特定的命令的作用,下面的例子就是一个用户名为run无密码,登录以后显示完端口状态就自动退出的例子,很好用吧

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#aaa new-model

Router1(config)#aaa authentication login default local

Router1(config)#aaa authorization exec default local

Router1(config)#username run nopassword noescape

Router1(config)#username run autocommand show ip interface brief

Router1(config)#end

Router1#

 

3.2.  加密密码

提问 加密密码从而在配置文件中不明文显示

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#enable password oreilly

Router1(config)#line vty 0 4

Router1(config-line)#password cookbook

Router1(config-line)#line con 0

Router1(config-line)#password cookbook

Router1(config-line)#line aux 0

Router1(config-line)#password cookbook

Router1(config-line)#exit

Router1(config)#service password-encryption

Router1(config)#end

Router1#

注释 这种加密方式很弱,很容易被破解

3.3.  Using Better Password-Encryption Techniques

提问 使用强度高的加密方式而不是思科缺省的加密技术

回答

Router1#configure terminal 

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#enable secret ORAbooks

Router1(config)#end

Router1#

IOS 12.2(8)T后也可以对username的密码做高强度的加密

Router#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#username ijbrown secret oreilly

Router(config)#end

Router#

 

注释 由于这种加密方式使用的是MD5所以破解难度相对增大了。对于enable secret的密码有个小技巧就是密码设定正常没有?,不过可以通过^V+?的方式来输入。

3.4.  移去配置文件中的密码信息

提问 不想在配置文件中显示密码

回答 使用脚本略去

注释 简单的用show tech命令也可以

3.5.  解密思科的弱密码

提问 破解思科缺省的密码算法

回答 使用脚本略去

注释 可以使用BOSON网站上的免费工具

3.6.  显示当前登录用户

提问 显示当前登录设备的用户

回答

Router1#show users who

注释

3.7.  发信息给其它用户

提问 试图发送信息给登录在同一设备的其它用户

回答

Router1#send *

Router1#send console 0

Router1#send vty 2

Router1#send 66

 

注释 很好用的特性,比如当你重启的时候需要告诉别人,文本信息^Z结束

3.8.  修改可用VTY数目

提问 增加或者减少可登录用户的数目

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#line vty 0 9

Router1(config-line)#exit

Router1(config)#end

Router1#

 

注释 缺省可登录vty数目为5,不能删除,对于增加的可以使用no line vty x 删除,不能不能删除单独的vty,是删除所有大于xvty

3.9.  修改VTY的超时时长

提问 修改超时避免用户登录超时被系统断开

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#line vty 0 4

Router1(config-line)#exec-timeout 0 0   exec-timeout 240 0

Router1(config-line)#exit

Router1(config)#end

Router1#

 

注释 缺省用户10分钟空闲就会被踢掉系统,0 0可以用不超时,第一个0是分钟,第二个0是秒。同时为了防止有些用户掉死但是还占用vty端口的情况,建议使用下面命令来防止:

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#service tcp-keepalives-in

Router1(config)#end

Router1#

3.10.  限制用户登录可以使用的协议

提问 只允许用户用特定的协议来进行系统登录

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#line vty 0 4

Router1(config-line)#transport input telnet

Router1(config-line)#exit

Router1(config)#end

Router1#

 

注释 缺省情况下除了可以telnet登录,还支持以下协议登录lat pad v120 lapb-ta rlogin ssh

3.11.  配置用户登录可用总时长Enabling Absolute Timeouts on VTY Lines

提问 对用户登录总时长进行限制,不论是否在空闲还是活动

回答 Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#line vty 0 4

Router1(config-line)#absolute-timeout 5

Router1(config-line)#logout-warning 30

Router1(config-line)#exit

Router1(config)#end

Router1#

 

注释

3.12.  部署Banners

提问 设置登录时显示的警示性信息

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#banner exec  # This is an exec banner #

Router1(config)#banner login # This is a login banner #

Router1(config)#banner motd  $ This is a motd banner  $

Router1(config)#end

Router1#

 

注释 不用使用welcome之类的字样,下面是一个FBI的路由器登录banner做参考

Router1(config)#banner login #

Enter TEXT message.  End with the character '#'.

 

+--------------------------------------------------------------------+

|                       &n

bsp;      WARNING                               |

|                              -------                               |

| This system is solely for the use of authorized users for official |

| purposes.  You have no expectation of privacy in its use and to    |

| ensure that the system is functioning properly, individuals using  |

| this computer system are subject to having all of their activities |

| monitored and recorded by system personnel. Use of this system     |

| evidences an express consent to such monitoring and agreement that |

| if such monitoring reveals evidence of possible abuse or criminal  |

| activity, system personnel may provide the results of such         |

| monitoring to appropriate officials.                               |

+--------------------------------------------------------------------+

#

Router1(config)#end

Router1#

3.13.  在特定端口禁用Banners显示

提问 aux口用于modem连接,为了避免出现问题希望关闭banner显示

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#line aux 0    

Router1(config-line)#no motd-banner

Router1(config-line)#no exec-banner

Router1(config-line)#exit

Router1(config)#end

Router1#

 

注释

3.14.  禁用Line登录

提问 禁止在AUX或者Line端口进行设备登录

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#line aux 0

Router1(config-line)#transport input none

Router1(config-line)#no exec

Router1(config-line)#exec-timeout 0 1

Router1(config-line)#no password

Router1(config-line)#exit

Router1(config)#end

Router1#

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#access-list 98 deny any log

Router1(config)#line vty 0 4

Router1(config-line)#transport input none

Router1(config-line)#exec-timeout 0 1

Router1(config-line)#no exec

Router1(config-line)#access-class 98 in

Router1(config-line)#exit

Router1(config)#end

Router1#

 

注释

3.15.  为管理员保留特定的登录端口

提问 防止所有的登录端口都被占用,为管理员留一个后门

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#access-list 9 permit 172.25.1.1

Router1(config)#line vty 4

Router1(config-line)#access-class 9 in

Router1(config-line)#exit

Router1(config)#end

Router1#

或者

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#access-list 9 permit 172.25.1.1

Router1(config)#line vty 5 7

Router1(config-line)#rotary 25

Router1(config-line)#access-class 9 in

Router1(config-line)#exit

Router1(config)#end

Router1#

 

注释 在使用第二种rotary命令时就相应的改变登录时的端口号码,不是缺省的23

阅读(797) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~