Merge lp:~xnox/ubiquity/pam-logind into lp:ubiquity

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 6003
Proposed branch: lp:~xnox/ubiquity/pam-logind
Merge into: lp:ubiquity
Diff against target: 155 lines (+56/-3)
4 files modified
bin/ubiquity-dm (+45/-1)
d-i/update-control (+1/-0)
debian/changelog (+8/-0)
debian/control (+2/-2)
To merge this branch: bzr merge lp:~xnox/ubiquity/pam-logind
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+187496@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

This is fine, with the various small amendments suggested on IRC ("for query, type in query_list:", maybe avoiding hardcoding the VT number). Thanks!

review: Approve
lp:~xnox/ubiquity/pam-logind updated
6004. By Dimitri John Ledkov

Refactor & do not hard-code vt #

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Updated with irc comments & re-tested.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/ubiquity-dm'
--- bin/ubiquity-dm 2013-09-24 13:00:05 +0000
+++ bin/ubiquity-dm 2013-09-25 12:18:48 +0000
@@ -3,6 +3,7 @@
3from __future__ import print_function3from __future__ import print_function
44
5import errno5import errno
6import getpass
6import grp7import grp
7import imp8import imp
8import os9import os
@@ -13,6 +14,7 @@
13import time14import time
1415
15import debconf16import debconf
17import PAM
1618
17sys.path.insert(0, '/usr/lib/ubiquity')19sys.path.insert(0, '/usr/lib/ubiquity')
1820
@@ -23,6 +25,23 @@
23from ubiquity.misc import create_bool, utf825from ubiquity.misc import create_bool, utf8
2426
2527
28def _pam_conv(auth, query_list, userData):
29 resp = []
30 for query, type in query_list:
31 if type == PAM.PAM_PROMPT_ECHO_ON:
32 val = input(query)
33 resp.append((val, 0))
34 elif type == PAM.PAM_PROMPT_ECHO_OFF:
35 val = getpass.getpass(query)
36 resp.append((val, 0))
37 elif type in (PAM.PAM_PROMPT_ERROR_MSG, PAM.PAM_PROMPT_TEXT_INFO):
38 print(query)
39 resp.append(('', 0))
40 else:
41 return None
42 return resp
43
44
26def set_locale():45def set_locale():
27 db = DebconfCommunicator('ubiquity', cloexec=True)46 db = DebconfCommunicator('ubiquity', cloexec=True)
28 locale = ''47 locale = ''
@@ -69,6 +88,7 @@
6988
70class DM:89class DM:
71 def __init__(self, vt, display, default_username):90 def __init__(self, vt, display, default_username):
91 self.auth = PAM.pam()
72 self.vt = vt92 self.vt = vt
73 self.display = display93 self.display = display
74 self.server_started = False94 self.server_started = False
@@ -151,6 +171,28 @@
151 hook, stdout=logfile, stderr=logfile,171 hook, stdout=logfile, stderr=logfile,
152 preexec_fn=self.drop_privileges)172 preexec_fn=self.drop_privileges)
153173
174 def pam_open_session(self):
175 self.auth.start('su')
176 self.auth.set_item(PAM.PAM_USER, self.username)
177 self.auth.set_item(PAM.PAM_CONV, _pam_conv)
178 self.auth.putenv('XDG_SESSION_CLASS=greeter')
179 self.auth.putenv('XDG_SEAT=seat0')
180 # at the time pam_open_session is called self.vt is the
181 # correct vt: either the one originally passed as cmd line
182 # arg or as determined by active_vt()
183 #
184 # self.vt is of the form str("vt10")
185 self.auth.putenv('XDG_VTNR=%s' % self.vt[2:])
186 self.auth.authenticate()
187 self.auth.open_session()
188 os.environ.update(
189 [i.split('=', 1) for i in self.auth.getenvlist()])
190
191 def pam_close_session(self):
192 if self.auth:
193 self.auth.close_session()
194 self.auth = None
195
154 def run(self, *program):196 def run(self, *program):
155 # Extract the program basename to see if we are in oem-config or197 # Extract the program basename to see if we are in oem-config or
156 # ubiquity.198 # ubiquity.
@@ -258,13 +300,14 @@
258300
259 os.environ['DISPLAY'] = self.display301 os.environ['DISPLAY'] = self.display
260 os.environ['HOME'] = self.homedir302 os.environ['HOME'] = self.homedir
261 os.environ['XDG_SESSION_ID'] = 'c1'
262 # Give ubiquity a UID and GID that it can drop privileges to.303 # Give ubiquity a UID and GID that it can drop privileges to.
263 os.environ['PKEXEC_UID'] = str(self.uid)304 os.environ['PKEXEC_UID'] = str(self.uid)
264 os.environ['GVFS_DISABLE_FUSE'] = '1'305 os.environ['GVFS_DISABLE_FUSE'] = '1'
265 # Overlay scrollbars are now a gtk module306 # Overlay scrollbars are now a gtk module
266 os.environ['GTK_MODULES'] = 'overlay-scrollbar'307 os.environ['GTK_MODULES'] = 'overlay-scrollbar'
267308
309 self.pam_open_session()
310
268 # run simple, custom scripts during install time311 # run simple, custom scripts during install time
269 if program_basename == 'ubiquity':312 if program_basename == 'ubiquity':
270 self.run_hooks('/usr/lib/ubiquity/dm-scripts/install')313 self.run_hooks('/usr/lib/ubiquity/dm-scripts/install')
@@ -634,4 +677,5 @@
634ret = dm.run(*sys.argv[4:])677ret = dm.run(*sys.argv[4:])
635if ret == 0:678if ret == 0:
636 set_locale()679 set_locale()
680dm.pam_close_session()
637sys.exit(ret)681sys.exit(ret)
638682
=== modified file 'd-i/update-control'
--- d-i/update-control 2013-09-24 09:57:36 +0000
+++ d-i/update-control 2013-09-25 12:18:48 +0000
@@ -67,6 +67,7 @@
67 'python3-icu (>= 1.0)',67 'python3-icu (>= 1.0)',
68 'python3-mock (>= 0.7.0)',68 'python3-mock (>= 0.7.0)',
69 'python3-oauthlib',69 'python3-oauthlib',
70 'python3-pam',
70 'gir1.2-xkl-1.0',71 'gir1.2-xkl-1.0',
71 'ubuntu-artwork',72 'ubuntu-artwork',
72 'udev',73 'udev',
7374
=== modified file 'debian/changelog'
--- debian/changelog 2013-09-24 13:00:05 +0000
+++ debian/changelog 2013-09-25 12:18:48 +0000
@@ -6,6 +6,14 @@
6 [ Howard Chan ]6 [ Howard Chan ]
7 * Fix the new Ubuntu Studio wallpaper backdrop for ubiquity. (LP: #1229651)7 * Fix the new Ubuntu Studio wallpaper backdrop for ubiquity. (LP: #1229651)
88
9 [ Dmitrijs Ledkovs ]
10 * Add dependencies on python3-pam.
11 * Establish a PAM session with logind "greeter" mode in ubiquity-dm,
12 resolving the following bugs:
13 - WiFi page not working (LP: #1178638) (LP: #1220193)
14 - Sound system / a11y not available (LP: #1229416)
15 - and maybe others.
16
9 -- Colin Watson <cjwatson@ubuntu.com> Tue, 24 Sep 2013 10:57:15 +010017 -- Colin Watson <cjwatson@ubuntu.com> Tue, 24 Sep 2013 10:57:15 +0100
1018
11ubiquity (2.15.19) saucy; urgency=low19ubiquity (2.15.19) saucy; urgency=low
1220
=== modified file 'debian/control'
--- debian/control 2013-09-24 09:57:36 +0000
+++ debian/control 2013-09-25 12:18:48 +0000
@@ -3,7 +3,7 @@
3Priority: optional3Priority: optional
4Maintainer: Ubuntu Installer Team <ubuntu-installer@lists.ubuntu.com>4Maintainer: Ubuntu Installer Team <ubuntu-installer@lists.ubuntu.com>
5Uploaders: Colin Watson <cjwatson@ubuntu.com>, Evan Dandrea <ev@ubuntu.com>5Uploaders: Colin Watson <cjwatson@ubuntu.com>, Evan Dandrea <ev@ubuntu.com>
6Build-Depends: apt, autopoint, bf-utf-source, dctrl-tools, debconf (>= 1.5.43), debconf-utils, debhelper (>= 9), devio, dh-autoreconf, dh-di (>= 3), dpkg-dev (>= 1.15.7), gir1.2-gnomekeyring-1.0, gir1.2-soup-2.4, gir1.2-timezonemap-1.0, gir1.2-webkit-3.0, gir1.2-xkl-1.0, gnome-icon-theme, gobject-introspection, intltool (>= 0.40.0), intltool-debian (>= 0.30+20040212), iso-codes, isoquery, keymapper (>= 0.5.3-7), libbogl-dev, libcairo2-dev, libdebconfclient0-dev (>= 0.68), libdebian-installer4-dev (>= 0.76), libgirepository1.0-dev, libglib2.0-dev, libgtk-3-dev, libido3-0.1-dev, libindicator3-dev, libiw-dev (>= 27+28pre9), liblocale-gettext-perl, libparted-dev, libparted0-dev (>= 2.2), locales, pep8, pkg-config, po-debconf (>= 1.0), pyflakes (>= 0.7.2), python-gi-dev, python-scour, python3-all (>= 3.1), python3-apt (>= 0.7.100.3~), python3-cairo, python3-dbus, python3-gi, python3-gi-cairo, python3-icu (>= 1.0), python3-mock (>= 0.7.0), python3-oauthlib, tzdata, ubuntu-artwork, udev, wget, xkb-data (>= 0.9), xkb-data-i18n, xvfb6Build-Depends: apt, autopoint, bf-utf-source, dctrl-tools, debconf (>= 1.5.43), debconf-utils, debhelper (>= 9), devio, dh-autoreconf, dh-di (>= 3), dpkg-dev (>= 1.15.7), gir1.2-gnomekeyring-1.0, gir1.2-soup-2.4, gir1.2-timezonemap-1.0, gir1.2-webkit-3.0, gir1.2-xkl-1.0, gnome-icon-theme, gobject-introspection, intltool (>= 0.40.0), intltool-debian (>= 0.30+20040212), iso-codes, isoquery, keymapper (>= 0.5.3-7), libbogl-dev, libcairo2-dev, libdebconfclient0-dev (>= 0.68), libdebian-installer4-dev (>= 0.76), libgirepository1.0-dev, libglib2.0-dev, libgtk-3-dev, libido3-0.1-dev, libindicator3-dev, libiw-dev (>= 27+28pre9), liblocale-gettext-perl, libparted-dev, libparted0-dev (>= 2.2), locales, pep8, pkg-config, po-debconf (>= 1.0), pyflakes (>= 0.7.2), python-gi-dev, python-scour, python3-all (>= 3.1), python3-apt (>= 0.7.100.3~), python3-cairo, python3-dbus, python3-gi, python3-gi-cairo, python3-icu (>= 1.0), python3-mock (>= 0.7.0), python3-oauthlib, python3-pam, tzdata, ubuntu-artwork, udev, wget, xkb-data (>= 0.9), xkb-data-i18n, xvfb
7Standards-Version: 3.9.47Standards-Version: 3.9.4
8X-Python3-Version: >= 3.18X-Python3-Version: >= 3.1
9XS-Testsuite: autopkgtest9XS-Testsuite: autopkgtest
@@ -11,7 +11,7 @@
1111
12Package: ubiquity12Package: ubiquity
13Architecture: any13Architecture: any
14Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, debconf (>= 1.5.43), ubiquity-frontend-${mangled-version}, ubiquity-artwork-${mangled-version}, laptop-detect, lsb-release, ubiquity-casper, python3-apt (>= 0.7.100.3~), ${console-setup-depends}, iso-codes, passwd, adduser, os-prober, rdate, ntfs-3g (>= 1:2011.1.15AR.4+2011.4.12-1) [any-alpha any-amd64 any-i386] | ntfsprogs [any-alpha any-amd64 any-i386], ecryptfs-utils, cryptsetup, policykit-1, python3-icu (>= 1.0), language-selector-common (>= 0.4.16), archdetect-deb, dpkg-repack, apt-clone, wget, grub-common [any-amd64 any-i386], dbus-x11, sbsigntool [amd64]14Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, debconf (>= 1.5.43), ubiquity-frontend-${mangled-version}, ubiquity-artwork-${mangled-version}, laptop-detect, lsb-release, ubiquity-casper, python3-apt (>= 0.7.100.3~), ${console-setup-depends}, iso-codes, passwd, adduser, os-prober, rdate, ntfs-3g (>= 1:2011.1.15AR.4+2011.4.12-1) [any-alpha any-amd64 any-i386] | ntfsprogs [any-alpha any-amd64 any-i386], ecryptfs-utils, cryptsetup, policykit-1, python3-icu (>= 1.0), python3-pam, language-selector-common (>= 0.4.16), archdetect-deb, dpkg-repack, apt-clone, wget, grub-common [any-amd64 any-i386], dbus-x11, sbsigntool [amd64]
15Recommends: grub-pc [any-amd64 any-i386] | grub [any-amd64 any-i386] | grub-efi [any-amd64 any-i386], flash-kernel [armel armhf], u-boot-tools [armel armhf], yaboot [powerpc], hfsutils [powerpc], dmraid, btrfs-tools, ubuntu-drivers-common, lvm215Recommends: grub-pc [any-amd64 any-i386] | grub [any-amd64 any-i386] | grub-efi [any-amd64 any-i386], flash-kernel [armel armhf], u-boot-tools [armel armhf], yaboot [powerpc], hfsutils [powerpc], dmraid, btrfs-tools, ubuntu-drivers-common, lvm2
16Conflicts: ubuntu-express, espresso, espresso-utils, espresso-locale, espresso-keyboard-setup, espresso-kbd-chooser, espresso-timezone, user-setup (<< 0.05ubuntu6), partman, espresso-grub, espresso-yaboot16Conflicts: ubuntu-express, espresso, espresso-utils, espresso-locale, espresso-keyboard-setup, espresso-kbd-chooser, espresso-timezone, user-setup (<< 0.05ubuntu6), partman, espresso-grub, espresso-yaboot
17Replaces: ubuntu-express, espresso, espresso-utils, espresso-locale, espresso-keyboard-setup, espresso-kbd-chooser, espresso-timezone, user-setup (<< 0.05ubuntu6), partman, espresso-grub, espresso-yaboot, ubiquity-frontend-gtk (<< 2.3.8)17Replaces: ubuntu-express, espresso, espresso-utils, espresso-locale, espresso-keyboard-setup, espresso-kbd-chooser, espresso-timezone, user-setup (<< 0.05ubuntu6), partman, espresso-grub, espresso-yaboot, ubiquity-frontend-gtk (<< 2.3.8)

Subscribers

People subscribed via source and target branches

to status/vote changes: