RSH的网络通信细节
2010-09-19 15:27
127 查看
rsh
服务侦听
514/TCP
口,
client
建立到
server
的
514/TCP
的连接。服务端会先检查
TCP
连接的源端口是否位于
[512,1023]
区间,否则服务端进程终止。
*nix
最早要求范围是
[1,1023]
,后来为消除一些安全隐患,改成
[512,1023]
。但这是实现相关的,并且各个
系统
的
man
手册可能与其当前实现不同步,某些版本
Solaris
的
man
手册就有问题,应实测。
为什么
rshd
有这个限制?一般
rsh
、
rcp
、
rlogin
被
设置
成
setuid-to-root
,
client
要想访问远端
rshd
,只能用系统自带的
rsh
、
rcp
、
rlogin
,但这三个程序会如实指定
client_user
字段,不存在伪造的可能。只有
root
用户才能使用
[1,1023]
的端口。
那么
rshd
如何检查端口?
client
向
server
发送如下请求数据
:
[port]/0<client_user>/0<server_user>/0<command>/0
Port ---- ANSI
字符串形式的端口号,不是短整型形式的端口号。
client_user ----
客户端当前用户名
server_user ----
试图远程使用的服务端用户名
command ----
试图远程使用的服务端命令
port
本身是可选项。如果指定了
port
,服务端会建立到客户端这个端口
(port)
的
TCP
连接,
rshd
会将
stderr
重定向到这条连接上。
*nix
要求
port
在
[1,1023]
上,并且成功建立连接,否则服务端进程终止。但这是实现相关的,
Solaris
、
Linux
自带
rsh
命令,抓包表明它们都提供
port
字段,并且没有命令行开关改变这个行为。
server
向
client
发送如下响应数据
:
<ret><data>
ret
等于
0x00
表示成功,
data
对应执行结果,一般是
/n
分隔、结尾的文本。
ret
等于
0x01
表示失败,
data
对应错误信息,一般也是
/n
分隔、结尾的文本。
Application reaches max limit on rsh
connections
It appears from the customer's application
that it is reaching the max limit (and even going beyond) on the max allowed
number of port connections when doing repeated rsh to the server's
in.rshd,-
which allows connections only
from the "ephemeral" reserved ports (ports 512-1023).
Many Error Messages of the kind below
appear in /var/adm/messages for 5-10 minutes, and, after which connections
start to work again.
Customer is getting
these error messages at peak load times.
His ultra is a ftp/rsh/rcp server for many differnt remote client
machines.
Error msg
example: (/var/log/messages)
"Apr
1 11:07:10 asncomm rsh[16295]: can't get stderr port: Resource
temporarily unavailable"
The message isn't from xinetd throttling
too high of a connection rate. It is from rshd, due to a failure of rresvport.
Note that the EAGAIN associated error message translation is documented on the
manpage for rresvport:
“The rresvport() function returns a valid,
bound socket descriptor on success.
It
returns -1 on error with the global value errno set according to the reason for
failure.
The error code EAGAIN is
overloaded to mean ''All network ports in use.''
参考:
rsh的网络通信细节
http://www.netexpert.cn/thread-3717-1-1.html
服务侦听
514/TCP
口,
client
建立到
server
的
514/TCP
的连接。服务端会先检查
TCP
连接的源端口是否位于
[512,1023]
区间,否则服务端进程终止。
*nix
最早要求范围是
[1,1023]
,后来为消除一些安全隐患,改成
[512,1023]
。但这是实现相关的,并且各个
系统
的
man
手册可能与其当前实现不同步,某些版本
Solaris
的
man
手册就有问题,应实测。
为什么
rshd
有这个限制?一般
rsh
、
rcp
、
rlogin
被
设置
成
setuid-to-root
,
client
要想访问远端
rshd
,只能用系统自带的
rsh
、
rcp
、
rlogin
,但这三个程序会如实指定
client_user
字段,不存在伪造的可能。只有
root
用户才能使用
[1,1023]
的端口。
那么
rshd
如何检查端口?
client
向
server
发送如下请求数据
:
[port]/0<client_user>/0<server_user>/0<command>/0
Port ---- ANSI
字符串形式的端口号,不是短整型形式的端口号。
client_user ----
客户端当前用户名
server_user ----
试图远程使用的服务端用户名
command ----
试图远程使用的服务端命令
port
本身是可选项。如果指定了
port
,服务端会建立到客户端这个端口
(port)
的
TCP
连接,
rshd
会将
stderr
重定向到这条连接上。
*nix
要求
port
在
[1,1023]
上,并且成功建立连接,否则服务端进程终止。但这是实现相关的,
Solaris
、
Linux
自带
rsh
命令,抓包表明它们都提供
port
字段,并且没有命令行开关改变这个行为。
server
向
client
发送如下响应数据
:
<ret><data>
ret
等于
0x00
表示成功,
data
对应执行结果,一般是
/n
分隔、结尾的文本。
ret
等于
0x01
表示失败,
data
对应错误信息,一般也是
/n
分隔、结尾的文本。
Application reaches max limit on rsh
connections
It appears from the customer's application
that it is reaching the max limit (and even going beyond) on the max allowed
number of port connections when doing repeated rsh to the server's
in.rshd,-
which allows connections only
from the "ephemeral" reserved ports (ports 512-1023).
Many Error Messages of the kind below
appear in /var/adm/messages for 5-10 minutes, and, after which connections
start to work again.
Customer is getting
these error messages at peak load times.
His ultra is a ftp/rsh/rcp server for many differnt remote client
machines.
Error msg
example: (/var/log/messages)
"Apr
1 11:07:10 asncomm rsh[16295]: can't get stderr port: Resource
temporarily unavailable"
The message isn't from xinetd throttling
too high of a connection rate. It is from rshd, due to a failure of rresvport.
Note that the EAGAIN associated error message translation is documented on the
manpage for rresvport:
“The rresvport() function returns a valid,
bound socket descriptor on success.
It
returns -1 on error with the global value errno set according to the reason for
failure.
The error code EAGAIN is
overloaded to mean ''All network ports in use.''
参考:
rsh的网络通信细节
http://www.netexpert.cn/thread-3717-1-1.html
相关文章推荐
- RSH的网络通信细节
- 【计算机网络】TCP通信的细节及TCP连接对HTTP事务处理性能影响
- 网络通信基础细节记录(持续更新)
- 网络编程之基本通信函数
- Linux程序设计学习笔记----网络通信编程API及其示例应用
- 开源网络通信库参考
- [Linux C编程]网络通信
- Docker实现跨主机容器实例网络通信(2)——利用OpenVSwitch构建多主机Docker网络
- socket编程(1)—— 一对一通信(本地IPC和网络)
- 20145337 《信息安全系统设计基础》实验五 网络通信
- 网络通信_wireshark工具使用
- 网络中进程通信的标识
- java例程练习(网络编程[简单UDP通信试验])
- IT观察】网络通信、图片显示、数据库操作……Android程序员如何利用开源框架
- Android 网络通信框架Volley(一)
- APUE读书笔记-16网络通信-01简介
- Java 用socket实现网络通信
- IOS 用封装API AsyncSocket进行网络通信
- 网络通信的中文乱码问题及解决方法
- SuSE Linux10.1 网络设置以及和主机通信