Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support SSL/TLS client certificate files for jabber starttls

  • Loading branch information...
commit 40b80d889de7e472a9929beed9b502bc59a83876 1 parent 4307635
@teerapap teerapap authored
View
4 include/ts_jabber.hrl
@@ -58,6 +58,10 @@
node_type,
subid,
version ="1.0", %% 1.0 or "legacy", used by type=connect
+ cacertfile, %% PEM encoded CA certificates file, used by type=starttls
+ keyfile, %% user's private PEM encoded key file, used by type=starttls
+ keypass, %% passphase of user's private PEM encoded key file, used by type=starttls
+ certfile, %% the user's certificate file, userd by type=starttls
prefix %% username prefix
}).
View
6 src/tsung/ts_jabber.erl
@@ -182,7 +182,11 @@ presence_bidi(RcvdXml, State)->
starttls_bidi(_RcvdXml, #state_rcv{socket= Socket}=State)->
ssl:start(),
- {ok, SSL} = ts_ssl:connect(Socket, []),
+ #ts_request{param = Req} = State#state_rcv.request,
+ {ok, SSL} = ts_ssl:connect(Socket, [{certfile,Req#jabber.certfile},
+ {keyfile,Req#jabber.keyfile},
+ {password,Req#jabber.keypass},
+ {cacertfile,Req#jabber.cacertfile}]),
?LOGF("Upgrading to TLS : ~p",[SSL],?INFO),
{nodata, State#state_rcv{socket=SSL,protocol=ts_ssl}}.
View
8 src/tsung_controller/ts_config_jabber.erl
@@ -65,6 +65,10 @@ parse_config(Element = #xmlElement{name=jabber},
Resource= ts_config:getAttr(string,Element#xmlElement.attributes, resource, "tsung"),
Type= list_to_atom(TypeStr),
Version = ts_config:getAttr(string,Element#xmlElement.attributes, version, "1.0"),
+ Cacert = ts_config:getAttr(string,Element#xmlElement.attributes, cacertfile, ""),
+ KeyFile = ts_config:getAttr(string,Element#xmlElement.attributes, keyfile, ""),
+ KeyPass = ts_config:getAttr(string,Element#xmlElement.attributes, keypass, ""),
+ CertFile = ts_config:getAttr(string,Element#xmlElement.attributes, certfile, ""),
Room = ts_config:getAttr(string,Element#xmlElement.attributes, room, undefined),
Nick = ts_config:getAttr(string,Element#xmlElement.attributes, nick, undefined),
Group = ts_config:getAttr(string,Element#xmlElement.attributes, group, "Tsung Group"),
@@ -148,6 +152,10 @@ parse_config(Element = #xmlElement{name=jabber},
node_type = NodeType,
subid = SubId,
version = Version,
+ cacertfile = Cacert,
+ keyfile = KeyFile,
+ keypass = KeyPass,
+ certfile = CertFile,
prefix = UserPrefix
}
},
View
4 tsung-1.0.dtd
@@ -266,6 +266,10 @@ repeat | if | change_type | foreach | set_option | interaction )*>
resource CDATA "tsung"
node_type CDATA #IMPLIED
version CDATA #IMPLIED
+ cacertfile CDATA #IMPLIED
+ keyfile CDATA #IMPLIED
+ keypass CDATA #IMPLIED
+ certfile CDATA #IMPLIED
subid CDATA #IMPLIED >
<!ELEMENT xmpp_authenticate EMPTY >
Please sign in to comment.
Something went wrong with that request. Please try again.