Tsung 使用 xmpp 认证
Posted
技术标签:
【中文标题】Tsung 使用 xmpp 认证【英文标题】:Tsung using xmpp authentication 【发布时间】:2014-01-09 13:27:32 【问题描述】:<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
<clients>
<client host="localhost" use_controller_vm="true"></client>
</clients>
<servers>
<server host="localhost" port="5222" type="tcp"></server>
</servers>
<load>
<arrivalphase phase="1" duration="1" unit="minute">
<users maxnumber="100" interarrival="5" unit="second"></users>
</arrivalphase>
</load>
<options>
<option type="ts_jabber" name="global_number" value="100"></option>
<option type="ts_jabber" name="userid_max" value="100"></option>
<option type="ts_jabber" name="domain" value="localhost"></option>
<option type="ts_jabber" name="username" value="ram"></option>
<option type="ts_jabber" name="passwd" value="ram123"></option>
</options>
<sessions>
<session probability="100" name="jabber-example" type="ts_jabber">
<request> <jabber type="connect" ack="no_ack"></jabber> </request>
<thinktime value="2"></thinktime>
<transaction name="authenticate">
<request> <jabber type="auth_get" ack="global"></jabber></request>
<request> <jabber type="auth_set_plain" ack="local"></jabber></request>
</transaction>
<request>
<jabber type="presence:initial" ack="no_ack"></jabber></request>
<thinktime value="100"></thinktime>
<transaction name="close">
<request> <jabber type="close" ack="local"></jabber></request>
</transaction>
</session>
</sessions>
</tsung>
</tsung>
这是我启动 tsung 后的 tsung.xml 文件代码,我在 ejabberd.log 中得到了日志文件:
I(<0.425.0>:ejabberd_listener:281) : (#Port<0.4419>) Accepted connection 192,168,1,583,47237 -> 192,168,1,583,5222
=INFO REPORT==== 2014-01-09 18:51:41 ===
I(<0.425.0>:ejabberd_listener:281) : (#Port<0.4421>) Accepted connection 192,168,1,583,42575 -> 192,168,1,583,5222
=INFO REPORT==== 2014-01-09 18:51:50 ===
I(<0.425.0>:ejabberd_listener:281) : (#Port<0.4423>) Accepted connection 192,168,1,583,50031 -> 192,168,1,583,5222
=INFO REPORT==== 2014-01-09 18:52:01 ===
I(<0.425.0>:ejabberd_listener:281) : (#Port<0.4425>) Accepted connection 192,168,1,583,51034 -> 192,168,1,583,5222
但我没有在日志文件中获取我的外部身份验证用户名。
【问题讨论】:
【参考方案1】:我遇到了和你一样的情况,你应该在你的tsung.xml中更改以下代码。
将auth_get
更改为auth_sasl
<transaction name="authenticate">
<request> <jabber type="auth_get" ack="global"></jabber></request>
<request> <jabber type="auth_set_plain" ack="local"></jabber></request>
</transaction>
我的配置文件如下。我得到了帮助 Tsung connected users are not shown 和http://tsung.erlang-projects.org/user_manual/conf-sessions.html 6.6.3.3. SASL 平原。祝你好运!
<!DOCTYPE tsung SYSTEM "/usr/local/tsung/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
<clients>
<client host="localhost" use_controller_vm="true"></client>
</clients>
<!-- Server side setup -->
<servers>
<server host="192.168.133.111" port="5222" type="tcp"></server>
</servers>
<load>
<arrivalphase phase="1" duration="2" unit="minute">
<users interarrival="2" unit="second"></users>
</arrivalphase>
</load>
<options>
<option type="ts_jabber" name="global_number" value="100"></option>
<option type="ts_jabber" name="userid_max" value="100"></option>
<option type="ts_jabber" name="domain" value="192.168.133.111"></option>
<option type="ts_jabber" name="username" value="user"></option>
<option type="ts_jabber" name="passwd" value="pass"></option>
</options>
<sessions>
<session probability="100" name="jabber-example" type="ts_jabber">
<request> <jabber type="connect" ack="local"></jabber> </request>
<thinktime value="2"></thinktime>
<transaction name="authenticate">
<request> <jabber type="auth_sasl" ack="local"></jabber> </request>
<request> <jabber type="connect" ack="local"></jabber> </request>
<request> <jabber type="auth_sasl_bind" ack="local" ></jabber></request>
<request> <jabber type="auth_sasl_session" ack="local" ></jabber></request>
</transaction>
<thinktime value="30"></thinktime>
<transaction name="close">
<request> <jabber type="close" ack="local"></jabber> </request>
</transaction>
</session>
</sessions>
</tsung>
【讨论】:
也感谢您的示例。以上是关于Tsung 使用 xmpp 认证的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 Tsung 编写用于负载测试“XMPP over BOSH”的 xml 脚本?
使用 Tsung 进行测试时 Tigase xmpp 服务器崩溃