After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 727580 - sharing: awareness of network
sharing: awareness of network
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Sharing
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
3.14
Depends on: 731726
Blocks:
 
 
Reported: 2014-04-04 03:32 UTC by Matthias Clasen
Modified: 2014-07-30 16:24 UTC
See Also:
GNOME target: 3.14
GNOME version: ---


Attachments
quick prototype (7.19 KB, text/plain)
2014-04-25 03:18 UTC, Matthias Clasen
  Details
when connecting to an unknown network with sharing (167.32 KB, image/png)
2014-04-25 03:22 UTC, Matthias Clasen
  Details
when connecting to an untrusted network with sharing (162.92 KB, image/png)
2014-04-25 03:23 UTC, Matthias Clasen
  Details
sharing: Add sharing.ui to the DIST (1.15 KB, patch)
2014-06-20 16:03 UTC, Bastien Nocera
rejected Details | Review
sharing: Add per-network sharing (55.07 KB, patch)
2014-06-20 16:03 UTC, Bastien Nocera
none Details | Review
sharing: Add per-network sharing (56.56 KB, patch)
2014-06-23 11:05 UTC, Bastien Nocera
reviewed Details | Review
sharing: Add per-network sharing (57.26 KB, patch)
2014-06-24 09:37 UTC, Bastien Nocera
committed Details | Review

Description Matthias Clasen 2014-04-04 03:32:06 UTC
I'd like to see some awareness of the current network environment in our sharing setup.

1) If there is no network, the panel should probably inform me of that, instead of happily talking about 'the current network' when there is none.

2) If I am connecting to a new wireless network for the first time and sharing is enabled, I would expect to get a notification warning me that I may end up sharing private data with a wider public. The notification should probably offer me to turn off all sharing for this network, and remember this configuration until I explicitly turn on sharing while on this network.

The second point has a strong overlap with privacy - maybe there should be a cross-reference to 'Sharing' in the privacy panel ?

The second point also has some similarity with firewall 'zone' configuration - if a firewall is present, we could additionally set the network zone to 'Home' or 'Public' when making this sharing change upon first-time connection to the network. Doing so has the advantage that the firewall may also cover third-party software that does not pay attention to the GNOME sharing settings.
Comment 1 Matthias Clasen 2014-04-18 21:26:53 UTC
I think it could be pretty elegant to piggy-back this on the 'zone' property that nm already has on its connections.

no zone -> first-time connection, ask
zone == home -> sharing is safe
zone != home -> turn off sharing, possibly with a notification
Comment 2 Bastien Nocera 2014-04-18 21:33:44 UTC
We can't implement that at the GNOME level. The sharing is usually implemented by various components (rygel, gnome-user-share with its Apache httpd, vino, etc.) and we need to be able to block them until the question has been answered. I don't know how to do that. We couldd run them in a container, and temporarily block their outside network access in the meanwhile, but we still need to figure out how to do that.
Comment 3 Matthias Clasen 2014-04-21 22:22:17 UTC
Don't these services react to the off switch in the sharing panel ? I would expect that we simply turn things off temporarily doing whatever that switch does.

For uncooperative or third-party services, we'll have to rely on the firewall to indeed block their network access.
Comment 4 Michael Catanzaro 2014-04-22 00:45:24 UTC
I'm confused: a new connection will use the default zone until GNOME changes it to home, and firewalld blocks pretty much everything in the default zone.

What am I missing: why do we need to block network access and what problem would containers solve?
Comment 5 Bastien Nocera 2014-04-22 06:18:16 UTC
(In reply to comment #4)
> I'm confused: a new connection will use the default zone until GNOME changes it
> to home, and firewalld blocks pretty much everything in the default zone.
> 
> What am I missing: why do we need to block network access and what problem
> would containers solve?

Not using firewalld, which doesn't work/isn't used on anything but Fedora.
Comment 6 Matthias Clasen 2014-04-25 03:18:07 UTC
Created attachment 275094 [details]
quick prototype

Here is a quick prototype. It only looks at the vino settings currently. To make the notifications show up, you'll have to put a desktop file in ~/.local/share/applications/org.gnome.fwmon.desktop:

[Desktop Entry]
Type=Application
Name=fwmon
Icon=preferences-system-sharing
Exec=/home/mclasen/fwmon/fwmon
Comment 7 Matthias Clasen 2014-04-25 03:22:19 UTC
Created attachment 275095 [details]
when connecting to an unknown network with sharing
Comment 8 Matthias Clasen 2014-04-25 03:23:03 UTC
Created attachment 275096 [details]
when connecting to an untrusted network with sharing
Comment 9 Matthias Clasen 2014-04-25 03:24:14 UTC
unfortunately, we run into some issues with the nm api: updating the zone configuration seems to mess up the security settings.
Comment 10 Allan Day 2014-04-25 10:29:05 UTC
(In reply to comment #0)
> I'd like to see some awareness of the current network environment in our
> sharing setup.
> 
> 1) If there is no network, the panel should probably inform me of that, instead
> of happily talking about 'the current network' when there is none.

Right. I can provide mockups for this if you want.

> 2) If I am connecting to a new wireless network for the first time and sharing
> is enabled, I would expect to get a notification warning me that I may end up
> sharing private data with a wider public.

The designs, and the current UI, are based on the idea that you explicitly allow sharing on the current network. The "Share Media on This Network" switch is an example of this.

I think we can execute this better, but the idea of manually whitelisting the networks where you want to share makes sense to me. You only typically have one or two networks where you want to share, and we don't want to share irrespective of the network.

I don't think that the notification idea is a really good one - most of the time you will not want to share on a new network, and we want to avoid bothering people about this type of thing as much as possible.

...
> The second point has a strong overlap with privacy - maybe there should be a
> cross-reference to 'Sharing' in the privacy panel ?
...

Interesting question - not sure about how you would present this.

> The second point also has some similarity with firewall 'zone' configuration -
> if a firewall is present, we could additionally set the network zone to 'Home'
> or 'Public' when making this sharing change upon first-time connection to the
> network. Doing so has the advantage that the firewall may also cover
> third-party software that does not pay attention to the GNOME sharing settings.

The difficulty I can see here is the case where someone has disabled sharing at some point in the past, then installs an app that needs to use one of the ports that have been closed: here the app doesn't work, and they don't know why.
Comment 11 Matthias Clasen 2014-04-25 11:35:08 UTC
(In reply to comment #10)
> (In reply to comment #0)
> > I'd like to see some awareness of the current network environment in our
> > sharing setup.
> > 
> > 1) If there is no network, the panel should probably inform me of that, instead
> > of happily talking about 'the current network' when there is none.
> 
> Right. I can provide mockups for this if you want.

That would be nice.
Comment 12 Allan Day 2014-04-27 12:00:56 UTC
Initial mockups: https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/sharing/sharing.png

I'm a bit uncertain about some aspects of this, but I thought it would be useful to share an initial iteration. Notable changes from the existing design:

 * Indicate offline state in the panel.
 * Elaborate the various status strings for each sharing service: "Active" for online and enabled, "Enabled" for enabled but offline, etc. The exact strings and their mapping to the actual states will need a bit more work.
 * Give each dialog window a status subheading.
 * Dialog windows include switches. When offline, these indicate position == on, state == off.
 * Media sharing - show which networks have been approved for media sharing, and allow recently used networks to be selected.
Comment 13 Bastien Nocera 2014-04-27 12:34:16 UTC
(In reply to comment #12)
> Initial mockups:
> https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/sharing/sharing.png
> 
> I'm a bit uncertain about some aspects of this, but I thought it would be
> useful to share an initial iteration. Notable changes from the existing design:
> 
>  * Indicate offline state in the panel.

Can you do another pass while also taking Bluetooth sharing into account? (I guess you don't have gnome-user-share installed because Personal File Sharing is missing too).
Comment 14 Matthias Clasen 2014-04-27 17:36:11 UTC
Great start, Allan.

It seems your mockups use 'Offline' where according to your explanation they should say 'Enabled' ? And the screen sharing mockup says 'Enabled' where it should say 'Active' (judging by the blue color of the switch) ?


Do these tables capture the intention:

subtitle
                online           offline

sharing on       Active         Enabled

sharing off      Off            Offline


switch
               online             offline

sharing on     "on"+blue          "on"+gray

sharing off    "off"+gray         "off"+gray



a slight complication for this is that multiple network connections can be online at the same time, e.g. home wifi + work vpn.

You say 'select networks' and 'select folders' - will there be a selection mode, or is this just click to toggle selected status of each row ? why is there an explicit 'x' only for the 'custom' row ?
Comment 15 Hedayat Vatankhah 2014-05-03 09:58:03 UTC
I would like to add something, which is more general than the topic of this bug but it is related. 
IMHO, there is a concept of network profiles, which includes network related settings such as firewall settings, proxy settings and also sharing settings (probably other things too). So I think Gnome should have this concept to manage network related settings. 
More related to this topic, please don't assume that we have 'a single wired connection' and several wireless connections. We also can have multiple wired connections with different settings. NM currently can have separate settings for wired connections by name, so at least other settings such as sharing should also recognize that (use the connection name rather than 'wired network').

(However (I should probably propose it to NM), some wired networks are also identifiable using the domain name the DHCP server sends, so they should be also recognized automatically just like the way wireless SSID is used to select the connection. sorry for being somewhat off topic)
Comment 16 Bastien Nocera 2014-06-20 16:03:31 UTC
Created attachment 278846 [details] [review]
sharing: Add sharing.ui to the DIST
Comment 17 Bastien Nocera 2014-06-20 16:03:38 UTC
Created attachment 278847 [details] [review]
sharing: Add per-network sharing

Using the new D-Bus service from gnome-settings-daemon.
Comment 19 Bastien Nocera 2014-06-20 16:13:06 UTC
You can add networks to be listed in the tool by changing the gnome-settings-daemon configuration (will require a restart from gnome-settings-daemon, as the only entry point is supposed to be the D-Bus API):
gsettings set org.gnome.settings-daemon.plugins.sharing.service:/org/gnome/settings-daemon/plugins/sharing/gnome-user-share-webdav/ enabled-connections '["Wired connection 2", "Invalid value", "igalia2 - automática"]'

Change the network names by any value listed in the NAME column of "nmcli c". You can change "gnome-user-share-webdav" with "rygel" or "vino-server" for the media sharing or the screen sharing configuration.
Comment 20 Bastien Nocera 2014-06-23 11:05:45 UTC
Created attachment 278988 [details] [review]
sharing: Add per-network sharing

Using the new D-Bus service from gnome-settings-daemon.
Comment 21 Rui Matos 2014-06-23 14:19:22 UTC
Review of attachment 278846 [details] [review]:

glib-compile-resources --generate-dependencies already takes care of this
Comment 22 Rui Matos 2014-06-23 17:41:21 UTC
Review of attachment 278988 [details] [review]:

Looks mostly good.

The master switches in the dialog headerbars (like priv->media_sharing_switch) should be set insensitive when sharing isn't allowed in the current network, otherwise we get a switch that seems like it should work but doesn't.

::: panels/sharing/cc-sharing-networks.c
@@ +129,3 @@
+  if (!gsd_sharing_call_list_networks_sync (self->priv->proxy, self->priv->service_name, &networks, NULL, &error)) {
+    g_warning ("couldn't list networks: %s", error->message);
+    g_dbus_proxy_set_cached_property (G_DBUS_PROXY (self->priv->proxy),

I don't understand this

::: panels/sharing/cc-sharing-panel.c
@@ +1306,3 @@
                     G_CALLBACK (cc_sharing_panel_master_switch_notify), self);
 
+  self->priv->sharing_proxy = G_DBUS_PROXY (gsd_sharing_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,

This should be cleared in _dispose()

::: panels/sharing/sharing.ui
@@ +506,3 @@
     </child>
+    <child type="titlebar">
+      <object class="GtkHeaderBar" id="headerbar3">

It would be nice if these headerbars had meaningful Ids. personal-file-sharing-headerbar ?

@@ +850,3 @@
     </child>
+    <child type="titlebar">
+      <object class="GtkHeaderBar" id="headerbar2">

idem
Comment 23 Bastien Nocera 2014-06-24 09:36:05 UTC
(In reply to comment #22)
> Review of attachment 278988 [details] [review]:
> 
> Looks mostly good.
> 
> The master switches in the dialog headerbars (like priv->media_sharing_switch)
> should be set insensitive when sharing isn't allowed in the current network,
> otherwise we get a switch that seems like it should work but doesn't.

Yep, fixed.

> ::: panels/sharing/cc-sharing-networks.c
> @@ +129,3 @@
> +  if (!gsd_sharing_call_list_networks_sync (self->priv->proxy,
> self->priv->service_name, &networks, NULL, &error)) {
> +    g_warning ("couldn't list networks: %s", error->message);
> +    g_dbus_proxy_set_cached_property (G_DBUS_PROXY (self->priv->proxy),
> 
> I don't understand this

When we fail to get the list of networks from gnome-settings-daemon (such as the proxy not existing), we fake the network being offline, so the UI still looks useful. I fixed that code to use the right type for the SharingStatus.

> ::: panels/sharing/cc-sharing-panel.c
> @@ +1306,3 @@
>                      G_CALLBACK (cc_sharing_panel_master_switch_notify), self);
> 
> +  self->priv->sharing_proxy = G_DBUS_PROXY (gsd_sharing_proxy_new_for_bus_sync
> (G_BUS_TYPE_SESSION,
> 
> This should be cleared in _dispose()

Fixed.

> ::: panels/sharing/sharing.ui
> @@ +506,3 @@
>      </child>
> +    <child type="titlebar">
> +      <object class="GtkHeaderBar" id="headerbar3">
> 
> It would be nice if these headerbars had meaningful Ids.
> personal-file-sharing-headerbar ?
> 
> @@ +850,3 @@
>      </child>
> +    <child type="titlebar">
> +      <object class="GtkHeaderBar" id="headerbar2">
> 
> idem

Yes, wouldn't it be nice ;)

Done.
Comment 24 Bastien Nocera 2014-06-24 09:37:24 UTC
Created attachment 279091 [details] [review]
sharing: Add per-network sharing

Using the new D-Bus service from gnome-settings-daemon.
Comment 25 Bastien Nocera 2014-06-24 09:44:14 UTC
Attachment 279091 [details] pushed as cbeba7c - sharing: Add per-network sharing