Merge lp:~xnox/ubiquity/pam-logind into lp:ubiquity
- pam-logind
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
lp:~xnox/ubiquity/pam-logind
updated
- 6004. By Dimitri John Ledkov
-
Refactor & do not hard-code vt #
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
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
1 | === modified file 'bin/ubiquity-dm' | |||
2 | --- bin/ubiquity-dm 2013-09-24 13:00:05 +0000 | |||
3 | +++ bin/ubiquity-dm 2013-09-25 12:18:48 +0000 | |||
4 | @@ -3,6 +3,7 @@ | |||
5 | 3 | from __future__ import print_function | 3 | from __future__ import print_function |
6 | 4 | 4 | ||
7 | 5 | import errno | 5 | import errno |
8 | 6 | import getpass | ||
9 | 6 | import grp | 7 | import grp |
10 | 7 | import imp | 8 | import imp |
11 | 8 | import os | 9 | import os |
12 | @@ -13,6 +14,7 @@ | |||
13 | 13 | import time | 14 | import time |
14 | 14 | 15 | ||
15 | 15 | import debconf | 16 | import debconf |
16 | 17 | import PAM | ||
17 | 16 | 18 | ||
18 | 17 | sys.path.insert(0, '/usr/lib/ubiquity') | 19 | sys.path.insert(0, '/usr/lib/ubiquity') |
19 | 18 | 20 | ||
20 | @@ -23,6 +25,23 @@ | |||
21 | 23 | from ubiquity.misc import create_bool, utf8 | 25 | from ubiquity.misc import create_bool, utf8 |
22 | 24 | 26 | ||
23 | 25 | 27 | ||
24 | 28 | def _pam_conv(auth, query_list, userData): | ||
25 | 29 | resp = [] | ||
26 | 30 | for query, type in query_list: | ||
27 | 31 | if type == PAM.PAM_PROMPT_ECHO_ON: | ||
28 | 32 | val = input(query) | ||
29 | 33 | resp.append((val, 0)) | ||
30 | 34 | elif type == PAM.PAM_PROMPT_ECHO_OFF: | ||
31 | 35 | val = getpass.getpass(query) | ||
32 | 36 | resp.append((val, 0)) | ||
33 | 37 | elif type in (PAM.PAM_PROMPT_ERROR_MSG, PAM.PAM_PROMPT_TEXT_INFO): | ||
34 | 38 | print(query) | ||
35 | 39 | resp.append(('', 0)) | ||
36 | 40 | else: | ||
37 | 41 | return None | ||
38 | 42 | return resp | ||
39 | 43 | |||
40 | 44 | |||
41 | 26 | def set_locale(): | 45 | def set_locale(): |
42 | 27 | db = DebconfCommunicator('ubiquity', cloexec=True) | 46 | db = DebconfCommunicator('ubiquity', cloexec=True) |
43 | 28 | locale = '' | 47 | locale = '' |
44 | @@ -69,6 +88,7 @@ | |||
45 | 69 | 88 | ||
46 | 70 | class DM: | 89 | class DM: |
47 | 71 | def __init__(self, vt, display, default_username): | 90 | def __init__(self, vt, display, default_username): |
48 | 91 | self.auth = PAM.pam() | ||
49 | 72 | self.vt = vt | 92 | self.vt = vt |
50 | 73 | self.display = display | 93 | self.display = display |
51 | 74 | self.server_started = False | 94 | self.server_started = False |
52 | @@ -151,6 +171,28 @@ | |||
53 | 151 | hook, stdout=logfile, stderr=logfile, | 171 | hook, stdout=logfile, stderr=logfile, |
54 | 152 | preexec_fn=self.drop_privileges) | 172 | preexec_fn=self.drop_privileges) |
55 | 153 | 173 | ||
56 | 174 | def pam_open_session(self): | ||
57 | 175 | self.auth.start('su') | ||
58 | 176 | self.auth.set_item(PAM.PAM_USER, self.username) | ||
59 | 177 | self.auth.set_item(PAM.PAM_CONV, _pam_conv) | ||
60 | 178 | self.auth.putenv('XDG_SESSION_CLASS=greeter') | ||
61 | 179 | self.auth.putenv('XDG_SEAT=seat0') | ||
62 | 180 | # at the time pam_open_session is called self.vt is the | ||
63 | 181 | # correct vt: either the one originally passed as cmd line | ||
64 | 182 | # arg or as determined by active_vt() | ||
65 | 183 | # | ||
66 | 184 | # self.vt is of the form str("vt10") | ||
67 | 185 | self.auth.putenv('XDG_VTNR=%s' % self.vt[2:]) | ||
68 | 186 | self.auth.authenticate() | ||
69 | 187 | self.auth.open_session() | ||
70 | 188 | os.environ.update( | ||
71 | 189 | [i.split('=', 1) for i in self.auth.getenvlist()]) | ||
72 | 190 | |||
73 | 191 | def pam_close_session(self): | ||
74 | 192 | if self.auth: | ||
75 | 193 | self.auth.close_session() | ||
76 | 194 | self.auth = None | ||
77 | 195 | |||
78 | 154 | def run(self, *program): | 196 | def run(self, *program): |
79 | 155 | # Extract the program basename to see if we are in oem-config or | 197 | # Extract the program basename to see if we are in oem-config or |
80 | 156 | # ubiquity. | 198 | # ubiquity. |
81 | @@ -258,13 +300,14 @@ | |||
82 | 258 | 300 | ||
83 | 259 | os.environ['DISPLAY'] = self.display | 301 | os.environ['DISPLAY'] = self.display |
84 | 260 | os.environ['HOME'] = self.homedir | 302 | os.environ['HOME'] = self.homedir |
85 | 261 | os.environ['XDG_SESSION_ID'] = 'c1' | ||
86 | 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. |
87 | 263 | os.environ['PKEXEC_UID'] = str(self.uid) | 304 | os.environ['PKEXEC_UID'] = str(self.uid) |
88 | 264 | os.environ['GVFS_DISABLE_FUSE'] = '1' | 305 | os.environ['GVFS_DISABLE_FUSE'] = '1' |
89 | 265 | # Overlay scrollbars are now a gtk module | 306 | # Overlay scrollbars are now a gtk module |
90 | 266 | os.environ['GTK_MODULES'] = 'overlay-scrollbar' | 307 | os.environ['GTK_MODULES'] = 'overlay-scrollbar' |
91 | 267 | 308 | ||
92 | 309 | self.pam_open_session() | ||
93 | 310 | |||
94 | 268 | # run simple, custom scripts during install time | 311 | # run simple, custom scripts during install time |
95 | 269 | if program_basename == 'ubiquity': | 312 | if program_basename == 'ubiquity': |
96 | 270 | self.run_hooks('/usr/lib/ubiquity/dm-scripts/install') | 313 | self.run_hooks('/usr/lib/ubiquity/dm-scripts/install') |
97 | @@ -634,4 +677,5 @@ | |||
98 | 634 | ret = dm.run(*sys.argv[4:]) | 677 | ret = dm.run(*sys.argv[4:]) |
99 | 635 | if ret == 0: | 678 | if ret == 0: |
100 | 636 | set_locale() | 679 | set_locale() |
101 | 680 | dm.pam_close_session() | ||
102 | 637 | sys.exit(ret) | 681 | sys.exit(ret) |
103 | 638 | 682 | ||
104 | === modified file 'd-i/update-control' | |||
105 | --- d-i/update-control 2013-09-24 09:57:36 +0000 | |||
106 | +++ d-i/update-control 2013-09-25 12:18:48 +0000 | |||
107 | @@ -67,6 +67,7 @@ | |||
108 | 67 | 'python3-icu (>= 1.0)', | 67 | 'python3-icu (>= 1.0)', |
109 | 68 | 'python3-mock (>= 0.7.0)', | 68 | 'python3-mock (>= 0.7.0)', |
110 | 69 | 'python3-oauthlib', | 69 | 'python3-oauthlib', |
111 | 70 | 'python3-pam', | ||
112 | 70 | 'gir1.2-xkl-1.0', | 71 | 'gir1.2-xkl-1.0', |
113 | 71 | 'ubuntu-artwork', | 72 | 'ubuntu-artwork', |
114 | 72 | 'udev', | 73 | 'udev', |
115 | 73 | 74 | ||
116 | === modified file 'debian/changelog' | |||
117 | --- debian/changelog 2013-09-24 13:00:05 +0000 | |||
118 | +++ debian/changelog 2013-09-25 12:18:48 +0000 | |||
119 | @@ -6,6 +6,14 @@ | |||
120 | 6 | [ Howard Chan ] | 6 | [ Howard Chan ] |
121 | 7 | * Fix the new Ubuntu Studio wallpaper backdrop for ubiquity. (LP: #1229651) | 7 | * Fix the new Ubuntu Studio wallpaper backdrop for ubiquity. (LP: #1229651) |
122 | 8 | 8 | ||
123 | 9 | [ Dmitrijs Ledkovs ] | ||
124 | 10 | * Add dependencies on python3-pam. | ||
125 | 11 | * Establish a PAM session with logind "greeter" mode in ubiquity-dm, | ||
126 | 12 | resolving the following bugs: | ||
127 | 13 | - WiFi page not working (LP: #1178638) (LP: #1220193) | ||
128 | 14 | - Sound system / a11y not available (LP: #1229416) | ||
129 | 15 | - and maybe others. | ||
130 | 16 | |||
131 | 9 | -- Colin Watson <cjwatson@ubuntu.com> Tue, 24 Sep 2013 10:57:15 +0100 | 17 | -- Colin Watson <cjwatson@ubuntu.com> Tue, 24 Sep 2013 10:57:15 +0100 |
132 | 10 | 18 | ||
133 | 11 | ubiquity (2.15.19) saucy; urgency=low | 19 | ubiquity (2.15.19) saucy; urgency=low |
134 | 12 | 20 | ||
135 | === modified file 'debian/control' | |||
136 | --- debian/control 2013-09-24 09:57:36 +0000 | |||
137 | +++ debian/control 2013-09-25 12:18:48 +0000 | |||
138 | @@ -3,7 +3,7 @@ | |||
139 | 3 | Priority: optional | 3 | Priority: optional |
140 | 4 | Maintainer: Ubuntu Installer Team <ubuntu-installer@lists.ubuntu.com> | 4 | Maintainer: Ubuntu Installer Team <ubuntu-installer@lists.ubuntu.com> |
141 | 5 | Uploaders: Colin Watson <cjwatson@ubuntu.com>, Evan Dandrea <ev@ubuntu.com> | 5 | Uploaders: Colin Watson <cjwatson@ubuntu.com>, Evan Dandrea <ev@ubuntu.com> |
143 | 6 | Build-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, xvfb | 6 | Build-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 |
144 | 7 | Standards-Version: 3.9.4 | 7 | Standards-Version: 3.9.4 |
145 | 8 | X-Python3-Version: >= 3.1 | 8 | X-Python3-Version: >= 3.1 |
146 | 9 | XS-Testsuite: autopkgtest | 9 | XS-Testsuite: autopkgtest |
147 | @@ -11,7 +11,7 @@ | |||
148 | 11 | 11 | ||
149 | 12 | Package: ubiquity | 12 | Package: ubiquity |
150 | 13 | Architecture: any | 13 | Architecture: any |
152 | 14 | Depends: ${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] | 14 | Depends: ${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] |
153 | 15 | Recommends: 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 | 15 | Recommends: 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 |
154 | 16 | Conflicts: ubuntu-express, espresso, espresso-utils, espresso-locale, espresso-keyboard-setup, espresso-kbd-chooser, espresso-timezone, user-setup (<< 0.05ubuntu6), partman, espresso-grub, espresso-yaboot | 16 | Conflicts: ubuntu-express, espresso, espresso-utils, espresso-locale, espresso-keyboard-setup, espresso-kbd-chooser, espresso-timezone, user-setup (<< 0.05ubuntu6), partman, espresso-grub, espresso-yaboot |
155 | 17 | Replaces: 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) | 17 | Replaces: 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) |
This is fine, with the various small amendments suggested on IRC ("for query, type in query_list:", maybe avoiding hardcoding the VT number). Thanks!