Lock the root account, except on live-iso

If we leave the root account w/o a password people will use it that way,
leading to insecure images. Also if we use a default password. So lock
the root account in the templates.

Users will need to do one of these things:
 1. Use [[customizations.user]] in their blueprint to configure root or
    another user.
 2. Use [[customizations.sshkey]] to set a key for root
 2. Install a package that configures a user at install time
 3. Install a package that sets up a user at boot time (eg. cloud-init)

This also drops the auth line from the kickstart templates, allowing it
to use the default password algoritm instead of md5.

Resolves: rhbz#1626120
This commit is contained in:
Brian C. Lane 2018-08-08 15:46:16 -07:00
parent 2876211b14
commit f113766f22
6 changed files with 15 additions and 46 deletions

View File

@ -25,6 +25,11 @@ Important Things To Note
for information on how to enable it. Otherwise you will see image creation fail to for information on how to enable it. Otherwise you will see image creation fail to
depsolve even if the blueprint itself is correct. depsolve even if the blueprint itself is correct.
* All image types lock the root account, except for live-iso. You will need to either
use one of the `Customizations`_ methods for setting a ssh key/password, install a
package that creates a user, or use something like `cloud-init` to setup access at
boot time.
Installation Installation
------------ ------------

View File

@ -1,16 +1,11 @@
# Lorax Composer filesystem output kickstart template # Lorax Composer filesystem output kickstart template
#
sshpw --username=root --plaintext randOmStrinGhERE
# Firewall configuration # Firewall configuration
firewall --enabled firewall --enabled
# Root password # NOTE: The root account is locked by default
rootpw --plaintext removethispw
# Network information # Network information
network --bootproto=dhcp --onboot=on --activate network --bootproto=dhcp --onboot=on --activate
# System authorization information
auth --useshadow --enablemd5
# System keyboard # System keyboard
keyboard --xlayouts=us --vckeymap=us keyboard --xlayouts=us --vckeymap=us
# System language # System language
@ -27,13 +22,10 @@ timezone US/Eastern
bootloader --location=none bootloader --location=none
%post %post
# Remove root password
passwd -d root > /dev/null
# Remove random-seed # Remove random-seed
rm /var/lib/systemd/random-seed rm /var/lib/systemd/random-seed
%end %end
%packages --nobase %packages --nobase
# NOTE lorax-composer will add the recipe packages below here, including the final %end # NOTE lorax-composer will add the blueprint packages below here, including the final %end

View File

@ -1,18 +1,14 @@
# Lorax Composer Live ISO output kickstart template # Lorax Composer Live ISO output kickstart template
#
sshpw --username=root --plaintext randOmStrinGhERE
# Firewall configuration # Firewall configuration
firewall --enabled --service=mdns firewall --enabled --service=mdns
# X Window System configuration information # X Window System configuration information
xconfig --startxonboot xconfig --startxonboot
# Root password # Root password is removed for live-iso
rootpw --plaintext removethispw rootpw --plaintext removethispw
# Network information # Network information
network --bootproto=dhcp --onboot=on --activate network --bootproto=dhcp --onboot=on --activate
# System authorization information
auth --useshadow --enablemd5
# System keyboard # System keyboard
keyboard --xlayouts=us --vckeymap=us keyboard --xlayouts=us --vckeymap=us
# System language # System language
@ -362,4 +358,4 @@ grub2-efi-ia32
efibootmgr efibootmgr
# NOTE lorax-composer will add the recipe packages below here, including the final %end%packages # NOTE lorax-composer will add the blueprint packages below here, including the final %end%packages

View File

@ -1,16 +1,11 @@
# Lorax Composer partitioned disk output kickstart template # Lorax Composer partitioned disk output kickstart template
#
sshpw --username=root --plaintext randOmStrinGhERE
# Firewall configuration # Firewall configuration
firewall --enabled firewall --enabled
# Root password # NOTE: The root account is locked by default
rootpw --plaintext removethispw
# Network information # Network information
network --bootproto=dhcp --onboot=on --activate network --bootproto=dhcp --onboot=on --activate
# System authorization information
auth --useshadow --enablemd5
# System keyboard # System keyboard
keyboard --xlayouts=us --vckeymap=us keyboard --xlayouts=us --vckeymap=us
# System language # System language
@ -29,9 +24,6 @@ bootloader --location=mbr
zerombr zerombr
%post %post
# Remove root password
passwd -d root > /dev/null
# Remove random-seed # Remove random-seed
rm /var/lib/systemd/random-seed rm /var/lib/systemd/random-seed
%end %end
@ -42,4 +34,4 @@ kernel
grub2 grub2
# NOTE lorax-composer will add the recipe packages below here, including the final %end # NOTE lorax-composer will add the blueprint packages below here, including the final %end

View File

@ -1,16 +1,11 @@
# Lorax Composer qcow2 output kickstart template # Lorax Composer qcow2 output kickstart template
#
sshpw --username=root --plaintext randOmStrinGhERE
# Firewall configuration # Firewall configuration
firewall --enabled firewall --enabled
# Root password # NOTE: The root account is locked by default
rootpw --plaintext removethispw
# Network information # Network information
network --bootproto=dhcp --onboot=on --activate network --bootproto=dhcp --onboot=on --activate
# System authorization information
auth --useshadow --enablemd5
# System keyboard # System keyboard
keyboard --xlayouts=us --vckeymap=us keyboard --xlayouts=us --vckeymap=us
# System language # System language
@ -29,9 +24,6 @@ bootloader --location=mbr
zerombr zerombr
%post %post
# Remove root password
passwd -d root > /dev/null
# Remove random-seed # Remove random-seed
rm /var/lib/systemd/random-seed rm /var/lib/systemd/random-seed
%end %end
@ -41,4 +33,4 @@ kernel
-dracut-config-rescue -dracut-config-rescue
grub2 grub2
# NOTE lorax-composer will add the recipe packages below here, including the final %end # NOTE lorax-composer will add the blueprint packages below here, including the final %end

View File

@ -1,16 +1,11 @@
# Lorax Composer tar output kickstart template # Lorax Composer tar output kickstart template
#
sshpw --username=root --plaintext randOmStrinGhERE
# Firewall configuration # Firewall configuration
firewall --enabled firewall --enabled
# Root password # NOTE: The root account is locked by default
rootpw --plaintext removethispw
# Network information # Network information
network --bootproto=dhcp --onboot=on --activate network --bootproto=dhcp --onboot=on --activate
# System authorization information
auth --useshadow --enablemd5
# System keyboard # System keyboard
keyboard --xlayouts=us --vckeymap=us keyboard --xlayouts=us --vckeymap=us
# System language # System language
@ -27,9 +22,6 @@ timezone US/Eastern
bootloader --location=none bootloader --location=none
%post %post
# Remove root password
passwd -d root > /dev/null
# Remove random-seed # Remove random-seed
rm /var/lib/systemd/random-seed rm /var/lib/systemd/random-seed
%end %end
@ -39,4 +31,4 @@ rm /var/lib/systemd/random-seed
# Packages requires to support this output format go here # Packages requires to support this output format go here
# NOTE lorax-composer will add the recipe packages below here, including the final %end # NOTE lorax-composer will add the blueprint packages below here, including the final %end