Ubuntu

Bug #221363 reported by volksman on 2008-04-24

Policy Kit Unlock Buttons Greyed Out when using NX

Affects Status Importance Assigned to Milestone
  FreeNX Server
Medium
Unassigned
  PolicyKit
Unknown
  policykit (Ubuntu)
Undecided
Unassigned
Nominated for Hardy by gozotto

Bug Description

I installed 8.04 LTS server on a system. Then installed ubuntu-desktop using apt. Installed Nomachine's NX server and connected to it.

The unlock buttons on Users and Groups or Network are greyed out and un-accessible. Tried running from a term 'sudo users-admin' with the same results.

Works fine with VNC and NX "Shadow" session however this is not really acceptable as it means a session has to be running on console first.

I have tried to enable every option in Authorizations to allow the remote session to have privileges to no avail.

output of dpkg relevant packages:

ii gnome-system-t 2.22.0-0ubuntu Cross-platform configuration utilities for G
ii liboobs-1-4 2.22.0-0ubuntu GObject based interface to system-tools-back
ii policykit 0.7-2ubuntu7 framework for managing administrative polici
ii system-tools-b 2.6.0-0ubuntu7 System Tools to manage computer configuratio

== Workaround ==
From https://bugs.launchpad.net/ubuntu/+source/policykit/+bug/238799/comments/16 (the packages from comment 24 are broken links now):

For system configuration, change all implicit authorizations under org -> freedesktop -> systemtoolsbackends -> Manage System Configuration (org.freedesktop.systemtoolsbackends.set) to "Admin Authentication."

For user management, change all implicit authorizations under org -> freedesktop -> systemtoolsbackends -> self -> Change User Configuration (org.freedesktop.systemtoolsbackends.self.set) to "Authentication."

Reset gdm by rebooting or running "sudo /etc/init.d/gdm restart" from a terminal window, and you should be able to unlock the user settings control panel and other similarly useful things through your tunneled VNC session.

Tags: nx policykit
volksman wrote on 2008-04-24: #1

Sorry...Forgot to mention I had a similar issue with another system built the same way. Server install first and added xorg and gnome (not the ubuntu-desktop meta package) after the fact and it wouldn't let me unlock any admin apps.

volksman wrote on 2008-04-24: #2

Please close. n00b error. I was connected remotely via NX.

Craig Younkins wrote on 2008-04-26: #3

Why is this a "n00b error"?

There are a whole people here ( http://ubuntuforums.org/showthread.php?p=4801691 ) having the same problem with NX server. What can we do to get policykit to work for NX users?

volksman on 2008-04-30
description: updated
volksman wrote on 2008-04-30: #4

Please disregard first two comments. I had originally filed this bug as a bug with policykit not working at all before I realized that NX could be interfering.

This has been confirmed by a number of people in the forums: http://ubuntuforums.org/showthread.php?t=712006

Guenter wrote on 2008-05-04: #5

Please let me note that I'm interested in a solution for this problem, too.

paulsdavies wrote on 2008-06-09: #6

I am having this problem too.

gozotto wrote on 2008-06-09: #7

Please let me know if a fix is available.

houstonbofh wrote on 2008-06-25: #8

This problem also occurs when you use 'ssh -X' and try and run 'users-admin' for example. There is no way to admin a Hardy system via ssh using the GUI tools.

Marcelo Boveto Shima wrote on 2008-06-25: #9

I just made a way to make it work.
The problem is that PolicyKit verify if you are on a valid/local/active ConsoleKit session.
To correct the problem follow this steps:
 - Copy nx-session-launcher and nx-session-launcher-suid to /usr/bin
 - Execute $ chown nx /usr/bin/nx-session-launcher-suid
 - Execute $ chmod 4755 /usr/bin/nx-session-launcher-suid
 - Copy ConsoleKit-NX.conf to /etc/dbus-1/system.d/
 - Edit /etc/nxserver/node.conf and change '#COMMAND_START_GNOME=gnome-session'
     to 'COMMAND_START_GNOME=/usr/bin/nx-session-launcher-suid gnome-session'

If anyone uses my ppa I just uploaded to intrepid to test (intrepid package should work fine on hardy).
I will copy to hardy in a day or 2.

Marcelo Boveto Shima wrote on 2008-06-25: #10
Marcelo Boveto Shima wrote on 2008-06-25: #11
Marcelo Boveto Shima wrote on 2008-06-25: #12

Forgot to mention that the dbus daemon need to reload the configs by executing:
$ /etc/init.d/dbus reload

volksman wrote on 2008-06-25: #13

@Marcelo: I don't have a /etc/nxserver/node.conf. Did a search and node.conf is not found on my system at all.

Any ideas?

volksman wrote on 2008-06-25: #14

@Marcelo: Just realized you fixed FreeNX. Not nomachines NX. Wonder if I should switch. I tried to change Nomachines nxnode config to use your nx-session-launcher but it doesn't work, just crashes.

Are you confirming this is a problem with NX though and not policy kit or is this a band-aid until policy kit is fixed? I'm not sure anyone has opened a bug with Nomachine yet for this issue.

Marcelo Boveto Shima wrote on 2008-06-25: #15

Do you use any package or is built from scrap?
Try to change this line on the file /usr/bin/nxloadconfig

Marcelo Boveto Shima wrote on 2008-06-25: #16

Try to chance the session configuration on nxclient to unix-custom instead of unix-gnome.
In application put /usr/bin/nx-session-launcher-suid on 'run the following command' and 'New virtual desktop' on options

Or maybe there is a configuration file on /usr/NX/etc

volksman wrote on 2008-06-25: #17

Tried with both:

edit /usr/NX/etc/node.cfg and add /usr/bin/nx-session-launcher to the COMMAND directive. NX crashes on connect.

changed my client profile to custom and added /usr/bin/nx-session-launcher-suid as the launched application and NX doesn't crash but no desktop is drawn. Just the NX window.

volksman wrote:
> @Marcelo: Just realized you fixed FreeNX. Not nomachines NX. Wonder
> if I should switch. I tried to change Nomachines nxnode config to use
> your nx-session-launcher but it doesn't work, just crashes.
>
> Are you confirming this is a problem with NX though and not policy kit
> or is this a band-aid until policy kit is fixed? I'm not sure anyone
> has opened a bug with Nomachine yet for this issue.

The point of my post was that this problem occurs when there is no NX at
all, but in SSH as well. So the problem appears to be that when you are
not directly at the console, policykit totally locks down.

volksman wrote on 2008-06-25: #19

True enough. So the problem is really with PolicyKit and Marcelo's fix is a band-aid for FreeNX.

Marcelo Boveto Shima wrote on 2008-06-25: #20

The problem with PolicyKit is that it don't alow a remote session to have privileges.
I already filled a bug while hacking the solution at https://bugs.freedesktop.org/show_bug.cgi?id=16510.

SSH creates a remote session. NX don't creates a session (my solution creates a
session on ConsoleKit, set active and set local).

To PolicyKit work you must have to be in a valid ConsoleKit session. ConsoleKit uses
the environment variable XDG_SESSION_COOKIE like:

$ echo $XDG_SESSION_COOKIE
f493e0b30e554108c3114c0046ffd1d0-1214412029.846197-1968504223

You can see ConsoleKit sessions executing:

$ ck-list-sessions
Session1:
 uid = '1000'
 realname = 'Marcelo,,,'
 seat = 'Seat1'
 session-type = ''
 active = TRUE
 x11-display = ':0'
 x11-display-device = '/dev/tty7'
 display-device = ''
 remote-host-name = ''
 is-local = TRUE
 on-since = '2008-06-25T16:40:29Z'

So if you don't set a active=TRUE and is-local=TRUE session on ConsoleKit
PolicyKit won't work.

Marcelo Boveto Shima wrote on 2008-06-25: #21

A proof of concept, you can try it on a NX session:

convidado@laptop:~$ ck-list-sessions
Session1:
 uid = '1000'
 realname = 'Marcelo Boveto Shima,,,'
 seat = 'Seat1'
 session-type = ''
 active = TRUE
 x11-display = ':0'
 x11-display-device = '/dev/tty7'
 display-device = ''
 remote-host-name = ''
 is-local = TRUE
 on-since = '2008-06-25T16:40:29Z'

convidado@laptop:~$ nx-session-launcher-suid ck-list-sessions
Session1:
 uid = '1000'
 realname = 'Marcelo,,,'
 seat = 'Seat1'
 session-type = ''
 active = TRUE
 x11-display = ':0'
 x11-display-device = '/dev/tty7'
 display-device = ''
 remote-host-name = ''
 is-local = TRUE
 on-since = '2008-06-25T16:40:29Z'
Session3:
 uid = '1001'
 realname = 'Convidado,,,,'
 seat = 'Seat3'
 session-type = 'nx'
 active = TRUE
 x11-display = ':1000.0'
 x11-display-device = ''
 display-device = ''
 remote-host-name = ''
 is-local = TRUE
 on-since = '2008-06-25T17:07:12Z'

convidado@laptop:~$ nx-session-launcher-suid users-admin

How it works?
 - $ ck-list-sessions
        shows my X session
 - $ nx-session-launcher-suid ck-list-sessions
        nx-session-launcher-suid creates a session, then executes ck-list-sessions and the session ends
 - $ nx-session-launcher-suid users-admin
        nx-session-launcher-suid creates a session, then executes users-admin and the session ends
        The PolicyKit button is not grayed

Marcelo Boveto Shima wrote on 2008-06-25: #22

I forgot to tell that ck-session launcher is compiled for i386.

Marcelo Boveto Shima wrote on 2008-06-25: #23

I've created a package to be used with NX Free edition.

But you have to edit /usr/NX/etc/node.cfg and change:
 - CommandStartGnome="/usr/bin/dbus-launch --exit-with-session gnome-session"
to
 - CommandStartGnome="nx-session-launcher-suid gnome-session"

The package is in the building queue, once it finish I will post the DemoUrl here.

volksman wrote on 2008-06-26: #25

After installing the above package and making the change to /usr/NX/etc/node.cfg I am able to use PolicyKit remotely.

Nicely done Marcelo!

Zdeněk Dlauhý wrote on 2008-06-27: #26

I think that must be repaired in the PolicyKit, not in the NX/FreeNX/SSH....

Zdeněk Dlauhý wrote on 2008-06-27: #27

But i will try it...:)

Marcelo Boveto Shima wrote on 2008-06-27: #28

Indeed, PolicyKit should be repaired to allow a remote sessions permission to do something.
But FreeNX/NX must be fixed to create a valid session.

My solution corrects FreeNX/NX but just workaround PolicyKit problem.

But I must say that in some cases this solution has a SECURITY IMPLICATION.
Like I've showed in the proof of concept, the solution can act like a "sudo" and
sudo my itself is an workaround.
The problem is that a remote session should have the permission to gain admin
right only if it is explicitly allow to do so.

This happens only if you have admin rights but don't have "sudo" permission.
Don't apply to Ubuntu, since the admin group has sudo permission by default.
But I think Fedora/Red Hat don't uses "sudo" by default.

Everybody that uses this fix must be aware of this problem.

eye.zak wrote on 2008-07-26: #29

Check how Authorizations uses policy kit, you should be able to authenticate with NX. (Authorizations came from policykit). Maybe users-admin and network-admin need to do things differently.

Marcelo Boveto Shima on 2008-07-26
Changed in freenx:
importance: Undecided → Medium
status: New → Triaged
Marcelo Boveto Shima wrote on 2008-07-26: #30

On Sat, Jul 26, 2008 at 4:57 PM, eye.zak <email address hidden> wrote:

> Check how Authorizations uses policy kit, you should be able to
> authenticate with NX. (Authorizations came from policykit). Maybe
> users-admin and network-admin need to do things differently.
>

This error has already has been triaged and an workaround is available.

If you are using NX from NOMACHINE:
 - Install package from #24
 - Follow instruction from #23

if you are using FreeNX:
 - Install package from #24
 - Edit /etc/nxserver/node.conf and change
'#COMMAND_START_GNOME=gnome-session'
     to 'COMMAND_START_GNOME=/usr/bin/nx-session-launcher-suid
gnome-session'

Thanks

Bug Watch Updater on 2008-07-27
Changed in policykit:
status: Unknown → Confirmed
Jean-Baptiste Lallement wrote on 2008-08-01: #31

closing Ubuntu task

Jean-Baptiste Lallement on 2008-08-01
description: updated
James Westby wrote on 2008-08-05: #32

Hi,

Please don't close the Ubuntu task, this is still a problem with
Ubuntu.

Thanks,

James

Marcelo Boveto Shima on 2008-08-09
description: updated
Marcelo Boveto Shima on 2008-08-09
description: updated
houstonbofh wrote on 2008-08-09: #33

Marcelo Boveto Shima wrote:
> ** Description changed:
>
> I installed 8.04 LTS server on a system. Then installed ubuntu-desktop
> using apt. Installed Nomachine's NX server and connected to it.
>
> The unlock buttons on Users and Groups or Network are greyed out and un-
> accessible. Tried running from a term 'sudo users-admin' with the same
> results.
>
> Works fine with VNC and NX "Shadow" session however this is not really
> acceptable as it means a session has to be running on console first.

I would love to change the description removing NX entirly. This also
happens when using 'ssh -X' to access a system. There is not way to
remotely admin a system using GUI tools without having an open console.
(Which may have an unprivileged user sitting at it...) This bug is a
show stopper for me, and one reason I am holding at Gutsy.

Marcelo Boveto Shima wrote on 2008-09-03: #34

Closing the FreeNX task, it is fixed in FreeNX 0.7.3

Changed in freenx-server:
status: Triaged → Fix Released
NTolerance wrote on 2008-11-03: #35

Was using Marcelo's workaround until I upgraded the system in question to Intrepid. I could not create a new session after upgrading. The nomachine client would display a black screen and then immediately exit after logging in. I have reverted back to the old node.cfg until an Intrepid-compatible workaround can be found.

Marcelo Boveto Shima wrote on 2008-11-04: #36

I supposing you are using NoMachine NX Free edition.
So add the repository:
deb http://ppa.launchpad.net/freenx-team/ubuntu intrepid main

And use the freenx-session-launcher from this repository.

On Mon, Nov 3, 2008 at 8:34 PM, NTolerance <email address hidden> wrote:

> Was using Marcelo's workaround until I upgraded the system in question
> to Intrepid. I could not create a new session after upgrading. The
> nomachine client would display a black screen and then immediately exit
> after logging in. I have reverted back to the old node.cfg until an
> Intrepid-compatible workaround can be found.
>
>

schnollk wrote on 2008-11-08: #37

For SSH sessions I'd like to add that the error still persists here. Nastyly it's happening for me on a laptop with broken display that I use as a "server" (no graphical login). So I'm -- among others -- not able to add users or change time.

While reading here I couldn't find a solution that would let me use users-admin without a display, i.e. graphilcal login?

Just now I noticed this message while fireing up users-admin sudoed:

** (users-admin:26835): CRITICAL **: Unable to lookup session information for process '26835'

Cheers!

foodbag wrote on 2009-01-02: #38

I'm using the NX Free Edition Server on Intrepid, and when I try to install the latest freenx-session-launcher from the repository, it errors out. The older deb package installs, but I get the black screen when trying to create a new session.

Cyber Source wrote on 2009-02-03: #39

Nice fix Marcelo, worked great for me!

sudopod wrote on 2009-04-29: #40

https://bugs.launchpad.net/ubuntu/+source/policykit/+bug/238799/comments/16

Note: This should work, but be cautious as it does change the security policy from the default. Use only if you have trustworthy remote users.

Jakob Unterwurzacher on 2009-09-27
description: updated
Bug Watch Updater on 2009-10-22
Changed in policykit:
status: Confirmed → Invalid
To post a comment you must log in.

Remote bug watches

Bug watches keep track of this bug in other bug trackers.