Closed Bug 947897 Opened 11 years ago Closed 8 years ago

Configure WiFi proxy settings for Firefox OS in the App Manager

Categories

(DevTools Graveyard :: WebIDE, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: arroway, Unassigned)

References

Details

Attachments

(2 files, 3 obsolete files)

The idea is to add a feature in the App Manager to make it easier to configure proxy settings in Firefox Os profile, to allow intercepting traffic.

There a several steps: 
- configure proxy to catch non-secure traffic (http, ftp)
- configure proxy to catch SSL traffic: need to create and set up a certificate database
- create the UI, likely in a "Device configuration" tab below the "Permissions" in the Device panel on the App Manager


[1] https://developer.mozilla.org/en-US/Firefox_OS/Security/Intercepting_traffic_using_a_proxy
Assignee: nobody → stephouillon
For the frontend, you'll need a "settings" tab that is generic enough to allow other features (enable FPS, enable tiles outline, enable layers outline, …). Ping me once you are at this stage.

Also -

allowing the user to touch about:config remotely will allow him to turn on "devtools.debugger.forbid-certified-apps" (bad). So in the actor code, you need to check first that this pref is `on`.
Attached patch proxy_prefs.patch (obsolete) — Splinter Review
I implemented getters and setters for accessing preferences, and whitelisted the preferences which can be accessed.

As for saving the saving the new prefs: if prefs.js is modified while the application is running, the changes are overwritten when it exists (see disclaimer in prefs.js). I tried to save the new settings to a user_prefs.js file I created, but when the phone reboots I still lose the settings.

I still need to deal with the certificate database, but first I will set up the UI.
Flags: needinfo?(paul)
Don't allow any pref access if the pref `devtools.debugger.forbid-certified-apps` is `true`.

Using a white list is not useful (some other people might want to change unrelated prefs with this actor).

saveCACert won't work because it's executed server side (move it in the "Front" object at the end of the file).

Use Services.prefs.savePrefFile(null) instead of Services.prefs.savePrefFile(newPrefsFile).

See for example: http://mxr.mozilla.org/mozilla-central/source/b2g/chrome/content/settings.js#409
Flags: needinfo?(paul)
(In reply to Paul Rouget [:paul] from comment #3)
> Don't allow any pref access if the pref
> `devtools.debugger.forbid-certified-apps` is `true`.
> 
> Using a white list is not useful (some other people might want to change
> unrelated prefs with this actor).

ok if you think it will be reused.
 
> saveCACert won't work because it's executed server side (move it in the
> "Front" object at the end of the file).

ok, I'll do that

> Use Services.prefs.savePrefFile(null) instead of
> Services.prefs.savePrefFile(newPrefsFile).

It won't work either: if you modify prefs.js while the b2g process is running, as soon as the phone reboots it will overwrite every change that was performed. That's what I observed, and that's what is stated at the beginning of the file prefs.js.
Hi All,

I have a problem about use prefs.js to configure proxy setting.
I set my proxy setting to prefs.js, It work on Firefox OS browser.
But in App for example -> Contacts:
it can't work on Contacts Oauth page which is used by facebook sync/gamil import/ outlook import login.
Because it didn't popup auth window ask for proxy username/password.
poeple can't use facebook sync/gamil import/ outlook import in Contacts when the network behind a proxy.

Could you consider to fixed that !?
Flags: needinfo?(stephouillon)
Flags: needinfo?(paul)
(In reply to Joe Young from comment #5)
> Hi All,
> 
> I have a problem about use prefs.js to configure proxy setting.
> I set my proxy setting to prefs.js, It work on Firefox OS browser.
> But in App for example -> Contacts:
> it can't work on Contacts Oauth page which is used by facebook sync/gamil
> import/ outlook import login.
> Because it didn't popup auth window ask for proxy username/password.
> poeple can't use facebook sync/gamil import/ outlook import in Contacts when
> the network behind a proxy.
> 
> Could you consider to fixed that !?

This bug is unrelated (this bug is about setting up a proxy for developers).

I encourage you to ask your question here: https://support.mozilla.org/en-US/questions/new/firefox-os/customize
Flags: needinfo?(paul)
Flags: needinfo?(stephouillon)
Attachment #8345292 - Attachment is obsolete: true
I added two patches:
1/ the first one is the backend API to get and set preferences on the phone
2/ the second one is the UI in the App Manager

For SSL proxy to work, the user still needs to do some hacking [1] to make the phone browser trust the proxy certificate. 

[1] https://developer.mozilla.org/en-US/Firefox_OS/Security/Intercepting_traffic_using_a_proxy
NB: Some APIs don't respect proxy settings.
See Also: → 829766
(In reply to Frederik Braun [:freddyb] from comment #10)
> NB: Some APIs don't respect proxy settings.

Some even change them, like the APN.
Depends on: 829766, 902345
Fabrice, does the APN change the *WiFi* proxy settings? (will change the bug title to make it clear)
Summary: Configure proxy settings for Firefox OS in the App Manager → Configure WiFi proxy settings for Firefox OS in the App Manager
(In reply to Stéphanie Ouillon [:arroway] from comment #12)
> Fabrice, does the APN change the *WiFi* proxy settings? (will change the bug
> title to make it clear)

Gecko has only global proxy settings afaik.
Attachment #8359255 - Attachment is obsolete: true
Attachment #8359256 - Attachment is obsolete: true
Attachment #8366742 - Flags: review?(paul)
Depends on: 965184
Comment on attachment 8366742 [details] [diff] [review]
0001-Settings-API-in-device-actor.patch

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

You need to check if you can set a pref in *each* call.

::: toolkit/devtools/server/actors/device.js
@@ +199,5 @@
> +  }, {
> +    request: {},
> +    response: { value: RetVal("string")}
> +  }),
> +

You want to use a boolean return value.
You might want to rename that to "arePrefsAccessible()".
You later use this function locally.

So you need 2 functions:

_arePrefsAccessible: function(){},
arePrefsAccessible: method(function() {
  return this._arePrefsAccessible();
}, {
  request: {},
  response: {value: RetVal("boolean")}
});

Then later you'll use ._arePrefsAccessible().

@@ +201,5 @@
> +    response: { value: RetVal("string")}
> +  }),
> +
> +  getBoolPref: method(function(name) {
> +    return Services.prefs.getBoolPref(name);

In all these function you need to check first if you can access prefs.

@@ +249,5 @@
> +    response: {}
> +  }),
> +
> +  savePrefFile: method(function() {
> +    if (!this.forbidModifyPrefs()) {

Maybe you want to savePrefFile at each set* calls.
Attachment #8366742 - Flags: review?(paul) → review-
Comment on attachment 8366743 [details] [diff] [review]
0002-UI-for-proxy-settings-in-the-App-Manager.patch

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

I just looked quickly, I'll review that once we got the actor right.

::: browser/devtools/app-manager/content/device.js
@@ +193,5 @@
>                      manifest);
>    },
> +
> +  displaySettingsTab: function(front) {
> +    front.forbidModifyPrefs().then(forbidden => {

This might fail if a 1.2 or 1.3 device. You want to make sure it's backward compatible.

@@ +196,5 @@
> +  displaySettingsTab: function(front) {
> +    front.forbidModifyPrefs().then(forbidden => {
> +      if (!forbidden) {
> +        let settingsTab = document.getElementById("settings-tab");
> +        settingsTab.style.display = "inline"; 

Use the "hidden" attribute.

@@ +238,5 @@
> +      }
> +      shareProxyUiHandler();
> +    });
> +
> +    var proxyProtocolPrefs = ["http", "ssl", "ftp", "socks"];

s/var/let

@@ +239,5 @@
> +      shareProxyUiHandler();
> +    });
> +
> +    var proxyProtocolPrefs = ["http", "ssl", "ftp", "socks"];
> +    for (var i in proxyProtocolPrefs) {

s/in/of
Attachment #8366743 - Flags: review?(paul)
Stéphanie, someone is working on an actor for preferences in bug 943251. You might want to focus on the proxy part in this bug.
Severity: normal → enhancement
OS: Linux → All
Hardware: x86_64 → All
Version: unspecified → Trunk
Assignee: stephouillon → nobody
I think it is unlikely that the DevTools team will work on this going forward.  If someone else would like to do so, feel free to reopen and proceed.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: