linux rsh通信实现_RSH的网络通信细节

rsh

服务侦听

514/TCP

口,

client

建立到

server

514/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\0\0\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

等于

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
LoadRunner监控Linux rstat协议允许网络上的用户获得同一网络上各机器的性能参数。 需要下载3个包: (1)rsh-0.17-14.i386.rpm (2)rsh-server-0.17-14.i386.rpm (3)rpc.rstatd-4.0.1.tar.gz 一、安装rsh 查看是否安装并卸载rsh [root@localhost /]# rpm –qa |grep rsh      --查看是否安装rsh [root@localhost /]# rpm –e + 版本号   --卸载该版本 安装rsh,rsh-server [root@localhost /]# rpm –ivh rsh-0.17-14.i386.rpm [root@localhost /]# rpm –ivh rsh-server-0.17-14.i386.rpm 二、安装rstatd 下载并安装rstatd,下载地址:http://sourceforge.net/projects/rstatd,上传至/usr/local 查看是否安装,一般来说Linux都没有安装 [root@localhost /]# find / -name rpc.rstatd 安装rstatd [root@localhost /]# tar -xzvf rpc.rstatd-4.0.1.tar.gz [root@localhost /]# cd rpc.rstatd-4.0.1 [root@localhost /]# ./configure [root@localhost /]# make [root@localhost /]# make install 三、安装完成后配置rstatd目标守护进程xinetd,配置文件于/etc/xinet.d目录下 修改/etc/xinetd.d目录下面的3个conf(rogin,rsh,rexec)中的disable均设置为no [root@localhost /]# cd /etc/xinetd.d      --进入到/etc/xinetd.conf目录中 [root@localhost /]# vi rlogin     --编辑disable=no,保存 [root@localhost /]# vi rsh  --编辑disable=no,保存 [root@localhost /]# vi rexec --编辑disable=no,保存 四、启动rpc.rstatd [root@localhost /]# rpc.rstatd --启动rpc.rstatd进程 [root@localhost /]# rpcinfo -p --执行此命令检查rpc服务的状态 如果未出现上图的rstatd说明没有安装成功,需要重复以上步骤。 到这里为止,LR监控Linux必要的服务都已安装好了。 五、关闭防火墙 [root@localhost /]# service iptables stop 六、利用LR中的Controller监控Linux资源 在Controller中,将System Resource Graphs中的Unix resources拖到右侧的资源监控区域。 鼠标右键选择Add Measurements,添加被监控Linux的IP地址x.x.x.x,选择需要监控的性能指标,确认。 七、遇到的问题 1. LoadRunner监控Linux资源时弹出如下错误: Monitor name :UNIX Resources. Cannot initialize the monitoring on 192.168.52.189. Error while creating the RPC client. Ensure that the machine can be connected and that it runs the rstat daemon (use rpcinfo utility for this

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值