`
heiheben
  • 浏览: 138550 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

Cisco IOS Cookbook 中文精简版 3-23 用户访问和权限管理

阅读更多

 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,是删除所有大于x的vty
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 '#'.

+--------------------------------------------------------------------+
|                              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,而是3000+rotary的号码25=3025
3.16.  限制特定地址的Telnet登录  
提问 只允许特定的机器进行Telnet登录
回答
Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#access-list 99 permit 172.25.1.0 0.0.0.255
Router1(config)#access-list 99 deny any log               
Router1(config)#line vty 0 4
Router1(config-line)#access-class 99 in
Router1(config-line)#exit
Router1(config)#end
Router1#
注释 无
3.17.  对Telnet访问进行日志记录
提问 记录每次telnet的日志
回答
Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#access-list 90 permit any log
Router1(config)#line vty 0 4
Router1(config-line)#access-class 90 in
Router1(config-line)#exit
Router1(config)#end
Router1#
注释 需要注意的是不管登录成功还是失败,在日志中都是显示的permitted:
%SEC-6-IPACCESSLOGS: list 90 permitted 172.25.1.1 1 packet
3.18.  设置发起Telnet的源地址
提问 有时对端设备有安全设置只允许特定的地址发起telnet请求
回答
Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#ip telnet source-interface loopback0
Router1(config)#end
Router1#
或者
Router1#telnet 172.25.1.5 /source-interface loopback0
注释 缺省情况路由器会使用到目的地所使用的端口来做Telnet的源地址
3.19.  自动登录
注释 使用脚本略去,其实用SecueCRT很容易设定
3.20.  使用SSH登录
提问 启用SSH这种加密的登录方式
回答
Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#hostname Router1
Router1(config)#ip domain-name neoshi.net
Router1(config)#crypto key generate rsa
The name for the keys will be: Router1.oreilly.com
Choose the size of the key modulus in the range of 360 to 2048 for your
  General Purpose Keys. Choosing a key modulus greater than 512 may take
  a few minutes.

How many bits in the modulus [512]: 1024
Generating RSA keys ...
[OK]

Router1(config)#
Jun 27 15:04:15: %SSH-5-ENABLED: SSH 1.5 has been enabled
Router1(config)#ip ssh time-out 120
Router1(config)#ip ssh authentication-retries 4
Router1(config)#end
Router1#
注释 从IOS 12.3(4)T开始支持SSH v2,之前只支持v1,首先要确认你的IOS版本,然后确认支持安全特性3DES,才能开启SSH的特性
3.21.       改变IOS命令的特权等级
提问 修改特定IOS命令的特权等级
回答
Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#privilege exec level 1 show startup-config
Router1(config)#end
Router1#
注释 缺省情况路由器支持16种特权等级,命令一般归属于0,1和15三种特权等级,在特权等级0下面只支持disable, enable, exit, help, 和logout命令,1下面不能对配置进行修改,15就是enable的特权等级
3.22.  基于用户的特权等级Defining Per User Privileges
提问 给不同的用户赋予不同的特权等级
回答
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 neoshi privilege 10 password ioscookbook
Router1(config)#privilege exec level 10 show ip route
Router1(config)#privilege exec level 1 show ip      
Router1(config)#privilege exec level 1 show   
Router1(config)#end
Router1#
注释 通常的0,1和15三种等级弹性不足,可以定义更多的等级给不同的用户
3.22.       基于端口的特权等级
提问 根据登录的不同端口自动赋予特定的特权等级
回答
Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#line aux 0
Router1(config-line)#privilege level 5
Router1(config-line)#exit
Router1(config)#privilege exec level 5 show ip route
Router1(config)#privilege exec level 1 show ip      
Router1(config)#privilege exec level 1 show   
Router1(config)#end
Router1#
注释 无

分享到:
评论

相关推荐

    思科 Cisco IOS Cookbook 中文精简版 V1.5版

    本书共分为三个主要部分,涉及路由器配置与文件管理、路由器管理和用户访问与权限管理等方面。 1. **路由器配置和文件管理**:这部分介绍了如何通过TFTP配置路由器、保存配置到服务器、使用远端配置文件启动路由器...

    Cisco_IOS_Cookbook_中文精简版

    《Cisco IOS Cookbook》中文精简版提供了丰富的思科网络设备配置与管理知识,覆盖了从基本配置、文件管理到高级管理及安全策略的广泛主题,是网络工程师和IT专业人员不可或缺的实战指南。通过学习和应用书中的技巧与...

    CiscoIOS操作手册中文精简版

    以上知识点总结了《Cisco IOS Cookbook》中文精简版中涉及的关键技术和配置方法,对于从事网络工程领域工作的技术人员来说是非常有价值的资源。通过学习这些内容,不仅可以提升个人技能,还能有效提高网络系统的稳定...

    避开10大常见坑:DeepSeekAPI集成中的错误处理与调试指南.pdf

    在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!

    前端分析-2023071100789

    前端分析-2023071100789

    基于kinect的3D人体建模C++完整代码.cpp

    基于kinect的3D人体建模C++完整代码.cpp

    搞机工具箱10.1.0.7z

    搞机工具箱10.1.0.7z

    GRU+informer时间序列预测(Python完整源码和数据)

    GRU+informer时间序列预测(Python完整源码和数据),python代码,pytorch架构,适合各种时间序列直接预测。 适合小白,注释清楚,都能看懂。功能如下: 代码基于数据集划分为训练集测试集。 1.多变量输入,单变量输出/可改多输出 2.多时间步预测,单时间步预测 3.评价指标:R方 RMSE MAE MAPE,对比图 4.数据从excel/csv文件中读取,直接替换即可。 5.结果保存到文本中,可以后续处理。 代码带数据,注释清晰,直接一键运行即可,适合新手小白。

    性价比革命:DeepSeekAPI成本仅为GPT-4的3%的技术揭秘.pdf

    在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!

    基于ANSYS LSDyna的DEM-SPH-FEM耦合模拟滑坡入水动态行为研究,基于ANSYS LSDyna的DEM-SPH-FEM耦合的滑坡入水模拟分析研究,基于ansys lsdyna的滑坡入水

    基于ANSYS LSDyna的DEM-SPH-FEM耦合模拟滑坡入水动态行为研究,基于ANSYS LSDyna的DEM-SPH-FEM耦合的滑坡入水模拟分析研究,基于ansys lsdyna的滑坡入水模拟dem-sph-fem耦合 ,基于ANSYS LSDyna; 滑坡入水模拟; DEM-SPH-FEM 耦合,基于DEM-SPH-FEM耦合的ANSYS LSDyna滑坡入水模拟

    auto_gptq-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

    auto_gptq-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

    复件 复件 建设工程可行性研究合同[示范文本].doc

    复件 复件 建设工程可行性研究合同[示范文本].doc

    13考试真题最近的t64.txt

    13考试真题最近的t64.txt

    Microsoft Visual C++ 2005 SP1 Redistributable PackageX86

    好用我已经解决报错问题

    嵌入式开发入门:用C语言点亮LED灯的全栈开发指南.pdf

    # 踏入C语言的奇妙编程世界 在编程的广阔宇宙中,C语言宛如一颗璀璨恒星,以其独特魅力与强大功能,始终占据着不可替代的地位。无论你是编程小白,还是有一定基础想进一步提升的开发者,C语言都值得深入探索。 C语言的高效性与可移植性令人瞩目。它能直接操控硬件,执行速度快,是系统软件、嵌入式开发的首选。同时,代码可在不同操作系统和硬件平台间轻松移植,极大节省开发成本。 学习C语言,能让你深入理解计算机底层原理,培养逻辑思维和问题解决能力。掌握C语言后,再学习其他编程语言也会事半功倍。 现在,让我们一起开启C语言学习之旅。这里有丰富教程、实用案例、详细代码解析,助你逐步掌握C语言核心知识和编程技巧。别再犹豫,加入我们,在C语言的海洋中尽情遨游,挖掘无限可能,为未来的编程之路打下坚实基础!

    auto_gptq-0.4.2-cp38-cp38-win_amd64.whl

    auto_gptq-0.4.2-cp38-cp38-win_amd64.whl

    自动立体库设计方案.pptx

    自动立体库设计方案.pptx

    手把手教你用C语言实现贪吃蛇游戏:从算法设计到图形渲染.pdf

    # 踏入C语言的奇妙编程世界 在编程的广阔宇宙中,C语言宛如一颗璀璨恒星,以其独特魅力与强大功能,始终占据着不可替代的地位。无论你是编程小白,还是有一定基础想进一步提升的开发者,C语言都值得深入探索。 C语言的高效性与可移植性令人瞩目。它能直接操控硬件,执行速度快,是系统软件、嵌入式开发的首选。同时,代码可在不同操作系统和硬件平台间轻松移植,极大节省开发成本。 学习C语言,能让你深入理解计算机底层原理,培养逻辑思维和问题解决能力。掌握C语言后,再学习其他编程语言也会事半功倍。 现在,让我们一起开启C语言学习之旅。这里有丰富教程、实用案例、详细代码解析,助你逐步掌握C语言核心知识和编程技巧。别再犹豫,加入我们,在C语言的海洋中尽情遨游,挖掘无限可能,为未来的编程之路打下坚实基础!

    性能对决:DeepSeek-V3与ChatGPTAPI在数学推理场景的基准测试.pdf

    在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!

Global site tag (gtag.js) - Google Analytics