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 ...
随机推荐
- Ubuntu和centos离线安装软件包(apt和yum)
linux安装软件包要解决包依赖问题,不能简单安装包本身. 离线安装基本思想都是先在一台设备上安装下载所有依赖包,然后拷贝所有依赖包到新设备上安装. Ubuntu下apt离线安装包 执行apt upd ...
- 零基础 Vue 开发环境搭建 打开运行Vue项目
[相关推荐]IntellIJ IDEA 配置 Vue 支持 打开Vue项目 所需文件 node.js环境(npm包管理器)(node-v8.11.3-x64.msi)(npmV5.6.0) cnpm ...
- [Bayes] Latent Gaussian Process Models
比较难理解,通过做题来入门. 目的:简单的了解下相关概念. 基础 热身 目的:找x到y的映射关系. 假设:Q latent functions {fi} fj 作为先验,跟x没什么直接关系,x只是作为 ...
- [Laravel] 15 - REST API: sidebar with unit test
前言 实现一个博客的侧边栏的链接,然后顺便对其进行单元测试的过程. Archives 一.视图中展示SQL结果 一条 sql 语句[查询] select year(created_at) year, ...
- JSON的多种转换
String message = httpSend(url, empName, loginPassWd); // 解析json字符串 message = message.replaceAll(&quo ...
- C# Linq删除父级的同时删除子级
之前使用Include获取外键对象列表后,进行删除,一直报错操作失败: 无法更改关系,因为一个或多个外键属性不可以为 null...后面还有一串.尝试了几种方式,比如将u.AlbumList=null ...
- Go学习笔记(三)Go语言学习
这里我就不写具体的教程了,整理了一些很适合入门学习的网站 菜鸟Go入门 http://www.runoob.com/go/go-basic-syntax.html Go 语言的基本数据类型 https ...
- spring框架排错
1.格式错误. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/sp ...
- FOREIGN MySQL 之 多表查询
一.多表联合查询 #创建部门 CREATE TABLE IF NOT EXISTS dept ( did int not null auto_increment PRIMARY KEY, dname ...
- Redux-example
Redux-example Examples from http://redux.js.org/docs/introduction/Examples.html Counter Vanilla Run ...