Merge lp:~tribaal/livecd-rootfs/add-vagrant-user into lp:livecd-rootfs
| Status: | Merged |
|---|---|
| Merged at revision: | 1504 |
| Proposed branch: | lp:~tribaal/livecd-rootfs/add-vagrant-user |
| Merge into: | lp:livecd-rootfs |
| Diff against target: |
65 lines (+23/-11) 1 file modified
live-build/ubuntu-cpc/hooks/042-vagrant.binary (+23/-11) |
| To merge this branch: | bzr merge lp:~tribaal/livecd-rootfs/add-vagrant-user |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Adam Conrad | 2017-08-25 | Approve on 2017-09-01 | |
| Francis Ginther (community) | Approve on 2017-08-29 | ||
| Philip Roche (community) | 2017-08-25 | Approve on 2017-08-28 | |
|
Review via email:
|
|||
Description of the Change
This branch changes the behavior for default users on the vagrant image, according to much of https:/
Specifically, this adds a new "vagrant" user with a know password on top of the already existing ubuntu user.
This conforms to the expectations of the Vagrant community, despite some security concerns. Vagrant images are not used for production systems but for development environments, and the absence of the "standard" vagrant user has been hurting ubuntu adoption on that platform.
| Chris Glass (tribaal) wrote : | # |
| Chris Glass (tribaal) wrote : | # |
New image with the latest changes (not requiring password entry on "vagrant ssh"): https:/
| Philip Roche (philroche) wrote : | # |
Works as expected. +1
-------
(scratch) philroche@
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'cpc-ubuntu-
box: Unpacking necessary files from: file://
==> box: Successfully added box 'cpc-ubuntu-
(scratch) philroche@
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'cpc-ubuntu-
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vagrant-
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Connection reset. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /vagrant => /home/philroche
(scratch) philroche@
Welcome to Ubuntu Artful Aardvark (development branch) (GNU/Linux 4.12.0-11-generic x86_64)
* Documentation: https:/
* Management: https:/
* Support: https:/
Get cloud support with Ubuntu Advantage Cloud Guest:
http://
0 packages can be updated.
0 updates are security updates.
vagrant@
| Francis Ginther (fginther) wrote : | # |
What restricts this change to artful? My understanding is that we're only introducing the vagrant:vagrant setup for artful and newer releases.
There is a comment on line 105 of this file:
# Vagrant needs a base user. We either inject the well-known SSH key
# or use password authentication. Both are ugly. So we'll use a password
# and make it random. This obviously is insecure...but at least its
# better than the alternatives.
This is no longer true now that we are adding the well-known SSH key.
| Chris Glass (tribaal) wrote : | # |
> What restricts this change to artful? My understanding is that we're only
> introducing the vagrant:vagrant setup for artful and newer releases.
Nothing in code - landing this in trunk only means that it will be part of the artful branch and the next ones as well.
> There is a comment on line 105 of this file:
> # Vagrant needs a base user. We either inject the well-known SSH key
> # or use password authentication. Both are ugly. So we'll use a password
> # and make it random. This obviously is insecure...but at least its
> # better than the alternatives.
>
> This is no longer true now that we are adding the well-known SSH key.
Good point! Fixed.
- 1502. By Chris Glass on 2017-08-29
-
Remove ubuntu user customisations.
Let's just do the absolute minimum here, the default is what people expect.
| Chris Glass (tribaal) wrote : | # |
Updated the code again. I removed the build-time generation of a password for the ubuntu user altogether, along with password ssh connections.
Vagrant replaces the found insecure key with a per-instance key at "up" time, allowing vagrant users to login securely, while users of this image as a "local cloud image" will have a working use-case as well.
| Chris Glass (tribaal) wrote : | # |
(a box generated with the latest version of the code can be found here: https:/
| Chris Glass (tribaal) wrote : | # |
Francis,
I removed the setting of a hard-coded ubuntu password from this entirely, leaving using/setting the ubuntu user as an excercise for the end-user's cloud-init (or other provisionning method).
Vagrant users on the other hand can login automagically with "vagrant ssh".
| Francis Ginther (fginther) wrote : | # |
Thanks for solving the 'how does this restricted to artful' question over IRC. While testing, I found one file ownership problem, otherwise, this looks good.
- 1503. By Chris Glass on 2017-08-29
-
Fix file permission problem - the authorized_keys file was still owned by root since the chown call came before its creation.
| Chris Glass (tribaal) wrote : | # |
All comments should be fixed.
Thanks for the catch!
- 1504. By Chris Glass on 2017-09-01
-
Fixed review comments by Adam.
- use adduser instead of useradd.
- 1505. By Chris Glass on 2017-09-01
-
Make sure the .ssh directory has the right permissions.
| Adam Conrad (adconrad) wrote : | # |
LGTM after the live review this morning. Will merge shortly. Please remember to follow-up with the discussed MOTD snippet.

A vagrant image with this patch applied can be found here:
https:/ /launchpad. net/~cloudware/ +livefs/ ubuntu/ artful/ cpc-development /+build/ 107944/ +files/ livecd. ubuntu- cpc.vagrant. box