openssh源码分析笔记
1、客户端保活:
options.client_alive_interval
options.client_alive_count_max
在wait_until_can_do_something()函数中实现
2、主进程监听客户端连接请求
main()
server_accept_loop()
3、接受客户端连接请求后协商:
1)版本号协商:
main
sshd_exchange_identification
2)算法密钥协商:
main
do_ssh2_kex
3)用户名密码验证:
main
do_authentication2
input_service_request
input_service_request
authmethod_lookup
authmethod_lookup中遍历全局变量 authmethods
authmethods->method_passwd
method_passwd->userauth_passwd
userauth_passwd
auth_password
sys_auth_passwd
4、验证通过后shell启动流程
main()
do_authenticated
do_authenticated2
server_loop2
debug1: server_init_dispatch
debug1: server_input_channel_open: ctype session rchan 0 win 131072 max 32768
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_channel_req: channel 0 request pty-req reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req pty-req
debug1: Allocating pty.
debug1: session_pty_req: session 0 alloc /dev/pts/4
debug1: server_input_channel_req: channel 0 request shell reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req shell
Starting session: shell on pts/4 for root from 10.1.5.200 port 54717 id 0
session_input_channel_req
session_shell_req
do_exec
do_exec_pty
do_child
execve()
5、启动shell过程会写入 /var/run/utmp文件(linux通过w或who命令查看登录用户就是读取的该文件)
do_exec_pty
do_login
record_login
login_login
login_write
utm_write_entry
utmp_perform_logout
utmp_perform_login
utmp_write_library
pututline
openssh源码分析笔记的更多相关文章
- zeromq源码分析笔记之线程间收发命令(2)
在zeromq源码分析笔记之架构说到了zmq的整体架构,可以看到线程间通信包括两类,一类是用于收发命令,告知对象该调用什么方法去做什么事情,命令的结构由command_t结构体确定:另一类是socke ...
- ReentrantReadWriteLock源码分析笔记
ReentrantReadWriteLock包含两把锁,一是读锁ReadLock, 此乃共享锁, 一是写锁WriteLock, 此乃排它锁. 这两把锁都是基于AQS来实现的. 下面通过源码来看看Ree ...
- ArrayList源码分析笔记
ArrayList源码分析笔记 先贴出ArrayList一些属性 public class ArrayList<E> extends AbstractList<E> imple ...
- ROCKETMQ源码分析笔记1:tools
rocketmq源码解析笔记 大家好,先安利一下自己,本人男,35岁,已婚.目前就职于小资生活(北京),职位是开发总监. 姓名DaneBrown 好了.我保证本文绝不会太监!转载时请附上以上安利信息. ...
- 线程池之ThreadPoolExecutor线程池源码分析笔记
1.线程池的作用 一方面当执行大量异步任务时候线程池能够提供较好的性能,在不使用线程池的时候,每当需要执行异步任务时候是直接 new 一线程进行运行,而线程的创建和销毁是需要开销的.使用线程池时候,线 ...
- Android源码分析笔记--Handler机制
#Handler机制# Handler机制实际就是实现一个 异步消息循环处理器 Handler的真正意义: 异步处理 Handler机制的整体表述: 消息处理线程: 在Handler机制中,异步消息处 ...
- AQS源码分析笔记
经过昨晚的培训.对AQS源码的理解有所加强,现在写个小笔记记录一下 同样,还是先写个测试代码,debug走一遍流程, 然后再总结一番即可. 测试代码 import java.util.concurre ...
- ROCKETMQ源码分析笔记2:client
CLIENT 之前讲过tools里面有大量调用client的东西.为了从源码层面了解rocket,决定啃下client这块骨头. pom 先看pom,看看CLIENT依赖谁.看完后原来是依赖commo ...
- zeromq源码分析笔记之架构(1)
1.zmq概述 ZeroMQ是一种基于消息队列的多线程网络库,其对套接字类型.连接处理.帧.甚至路由的底层细节进行抽象,提供跨越多种传输协议的套接字.引用云风的话来说:ZeroMQ 并不是一个对 so ...
随机推荐
- php框架之odp(一)
熟悉odp框架的使用已经快一个月了,今天总结一下.odp和yii都是成熟的常用的php框架,因为odp是公司内部开发的,且公司内部用odp的较多,所以我就从odp框架入手.仅仅纪录自己的学习体会 一. ...
- Git 修正错误
大部分的人都会犯错.所以每VCS提供了一个功能,修正错误,直到特定的点. Git提供功能使用,我们可以撤销已作出的修改到本地资源库. 假设用户不小心做了一些更改,以他的本地的仓库,现在他要扔掉这些变化 ...
- Ubuntu上运行Blender,在控制台上查看运行结果
1.首先在控制台打开Blender. 具体操作:找到Blender的安装路径,我的是:/home/lcx/下载/blender-2.78c-linux-glibc219-x86_64 $cd /hom ...
- 分发系统介绍 expect脚本远程登录 expect脚本远程执行命令 expect脚本传递参数
expect脚本远程登录 yum install -y expect yum install -y tcl tclx tcl-devel 自动远程登录 #! /usr/bin/expect set h ...
- Centos7 防火墙常用配置及说明
一. Centos7和Centos6 防火墙的区别: 使用的工具不一样了.Centos6 使用的是iptables ,Centos7 使用的是filewall iptables 用于过滤数据包,属于网 ...
- Django框架详解
一.WSGI接口 WSGI服务网关接口:Web Server Gateway Interface缩写. WSGI是python定义的Web服务器和Web应用程序之间或框架之间的通用接口标准. WSGI ...
- D - Lake Counting
Due to recent rains, water has pooled in various places in Farmer John's field, which is represented ...
- 杭电ACM 1297 Children’s Queue
这道题是排序问题,可以用递归方法解决. 计算F(n): 一:当最后一个是男孩M时候,前面n-1个随便排出来,只要符合规则就可以,即是F(n-1): 二:当最后一个是女孩F时候,第n-1个肯定是女孩F, ...
- ASP.NET Core 的Windows和IIS宿主(自动翻译记录)
https://docs.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x 支持的操作系统 以下操作系统的支持: Win ...
- gulp安装及使用流程
1. 安装nodejs 去 https://nodejs.org/en/下载安装文件安装即可. 安装完成后,在终端输入node -v回车打印出nodejs的版本号,说明nodejs安装成功. 在终端输 ...