Bug 1658904

Summary: undercloud ssh_config is changed completely if customized hiera is used.
Product: Red Hat OpenStack Reporter: Chen <cchen>
Component: openstack-tripleo-puppet-elementsAssignee: RHOS Maint <rhos-maint>
Status: CLOSED NOTABUG QA Contact: nlevinki <nlevinki>
Severity: medium Docs Contact:
Priority: medium    
Version: 13.0 (Queens)CC: aschultz, hbrock, jjoyce, jschluet, jslagle, mburns, slinaber, tvignaud
Target Milestone: ---Keywords: Triaged, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-17 21:25:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Chen 2018-12-13 06:53:48 UTC
Description of problem:

ssh_config is changed completely if customized hiera is used.

Version-Release number of selected component (if applicable):

OSP13

How reproducible:

100%


Steps to Reproduce:
1. openstack undercloud install
2. Check sshd_config
3. in undercloud.conf add hieradata_override = /home/stack/hieradata.yaml
4. In hieradata.yaml specify

tripleo::profile::base::sshd::options:
  PermitRootLogin: 'no'

5. Check sshd_config

Actual results:

# diff -u /etc/ssh/sshd_config /etc/ssh/sshd_config.bak 
--- /etc/ssh/sshd_config	2018-12-13 01:40:10.851877086 -0500
+++ /etc/ssh/sshd_config.bak	2018-12-13 00:32:07.359455937 -0500
@@ -1,13 +1,21 @@
 # File is managed by Puppet
 Port 22
 
-AcceptEnv LANG LC_*
+AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
+AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
+AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
+AcceptEnv XMODIFIERS
+AuthorizedKeysFile .ssh/authorized_keys
 ChallengeResponseAuthentication no
+GSSAPIAuthentication yes
+GSSAPICleanupCredentials no
 HostKey /etc/ssh/ssh_host_rsa_key
 HostKey /etc/ssh/ssh_host_ecdsa_key
 HostKey /etc/ssh/ssh_host_ed25519_key
-PermitRootLogin no
 PrintMotd no
-Subsystem sftp /usr/libexec/openssh/sftp-server
+Subsystem sftp  /usr/libexec/openssh/sftp-server
+SyslogFacility AUTHPRIV
+UseDNS no
 UsePAM yes
+UsePrivilegeSeparation sandbox
 X11Forwarding yes


Expected results:

Only one line (PermitRootLogin) should be different

Additional info:

Comment 1 Alex Schultz 2018-12-17 21:25:02 UTC
Yes the entire set of options must be provided. it is not merged.

If a customer needs to tweak one of the items, they still need to provide the full set.
https://github.com/openstack/instack-undercloud/blob/stable/queens/elements/puppet-stack-config/os-apply-config/etc/puppet/hieradata/RedHat.yaml#L3-L22