Open Bug 766166 Opened 7 years ago Updated 2 years ago

Have a service protocol to communicate with ssltunnel

Categories

(Testing :: General, enhancement)

enhancement
Not set

Tracking

(Not tracked)

People

(Reporter: mayhemer, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

This protocol should provide info and allow modifications of ssltunnel config at run-time like:

- notification about ssltunnel server(s) is (are all) up and connections won't fail
- support for startTLS, meaning after some exact byte start ssl nego
- change certificates on server ports

My suggestion is to have a js implemented server that runs in the host application.  ssltunnel would be told to connect back to that server, the port would be given in the config file.  This way it notifies us about being up and we can then use that socket to communicate.
Blocks: 466524
Attached patch v1 (obsolete) — Splinter Review
Base for a service callback from ssltunnel.  Currently implements only a timeout, startup and shutdown notification.  At this moment ssltunnel doesn't read any commands from the client (controller) but it can be easily updated.

This blocks an important patch for support of ssl in xpcshell tests.  So I don't want to go with anything perfect and complicated right now.

Try: https://tbpl.mozilla.org/?tree=Try&rev=7e49e50e189f
Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Ted, I would like to ask for an advice here (instantiating a new component works locally, but not on try).

I have introduced a new js implemented component ('@mozilla.org/ssltunnel-control;1') that is built along with ssltunnel program and copied to bin/components (.js + .manifest).

This works for me locally, the component can be instantiated and works.  

But doesn't work (cannot be found in classes) on try server: 
https://tbpl.mozilla.org/?tree=Try&rev=aaa2f468c65d (then interesting changeset is https://hg.mozilla.org/try/rev/1b88d8b16feb)

Changes to Makefile.in are taken from httpd.js Makefile.in.


What am I doing wrong?

Thanks.
Flags: needinfo?(ted)
Attached patch v1.1Splinter Review
Try: https://tbpl.mozilla.org/?tree=Try&rev=4f888e3be240

- very basic communication service protocol between ssltunnel and the host application (test-harness)
- notifies about start of all configured servers and start up timeout
- currently no way to configure ssltunnel remotely, but there is a good base to include such features easily (definitely for a followup)
- ssltunnel-control.js is a test js module, no component
Attachment #678020 - Attachment is obsolete: true
Attachment #681466 - Flags: review?(ted)
I got the necessary info.
Flags: needinfo?(ted)
Comment on attachment 681466 [details] [diff] [review]
v1.1

Review of attachment 681466 [details] [diff] [review]:
-----------------------------------------------------------------

r- for an answer on the JS component question. Otherwise looks pretty good.

::: testing/mochitest/ssltunnel/ssltunnel-control.js
@@ +1,3 @@
> +/* This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
> + * You can obtain one at http://mozilla.org/MPL/2.0/. */

Is there any reason to prefer writing this as a JS component instead of just a JS module? The IDL doesn't add much value unless you plan on calling it from C++.

@@ +125,5 @@
> +
> +    this._inputstreampump = Cc["@mozilla.org/network/input-stream-pump;1"].createInstance(
> +                            Ci.nsIInputStreamPump);
> +    this._inputstreampump.init(this._inputstream, -1, -1, 0, 0, false);
> +    this._inputstreampump.asyncRead(this, null);

I think you can probably just use NetUtil.asyncFetch here:
https://developer.mozilla.org/en-US/docs/JavaScript_code_modules/NetUtil.jsm#asyncFetch%28%29

::: testing/mochitest/ssltunnel/ssltunnel.cpp
@@ +277,5 @@
> +{
> +  if (service_callback_addr.raw.family == 0)
> +    return true; // just ignore
> +
> +  AutoFD fd(PR_NewTCPSocket());

Note the patch in bug 767241 replaces AutoFD with a new class.
Attachment #681466 - Flags: review?(ted) → review-
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #5)
> Is there any reason to prefer writing this as a JS component instead of just
> a JS module? The IDL doesn't add much value unless you plan on calling it
> from C++.

Ted, first, thanks for the review.  

According this question:

My original intention was to have this as a component (hence the iface leftover too) and I put a lot of effort to achieve it, but it really was not that simple to do.  There is also a discussion on dev-platform about this [1].  I was trying hard, but that is really not that simple and people advised to rather have this as a module.

If you can help (or even do) the actual work to turn this to a component, then I'll be very happy.


[1] https://groups.google.com/forum/?fromgroups=#!topic/mozilla.dev.platform/o-p4kqie4oo
Assignee: honzab.moz → nobody
Status: ASSIGNED → NEW
Component: ssltunnel → General
You need to log in before you can comment on or make changes to this bug.