Faidon Liambotis has submitted this change and it was merged.

Change subject: admin: transition to ssh::userkey
......................................................................


admin: transition to ssh::userkey

Bug: T92475
Change-Id: I64b3ec8ec22bbda4b6edae3bf26f04f86513ee21
---
M modules/admin/manifests/user.pp
1 file changed, 10 insertions(+), 34 deletions(-)

Approvals:
  Faidon Liambotis: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/admin/manifests/user.pp b/modules/admin/manifests/user.pp
index 8703072..19362fb 100644
--- a/modules/admin/manifests/user.pp
+++ b/modules/admin/manifests/user.pp
@@ -67,10 +67,9 @@
         allowdupe  => false,
     }
 
-    #This is all absented by the above /home/${user} cleanup
-    #Puppet chokes if we try to absent subfiles to /home/${user}
+    # This is all absented by the above /home/${user} cleanup
+    # Puppet chokes if we try to absent subfiles to /home/${user}
     if $ensure == 'present' {
-
         file { "/home/${name}":
             ensure       => ensure_directory($ensure),
             source       => [
@@ -86,39 +85,16 @@
             tag          => 'user-home',
             require      => User[$name],
         }
+    }
 
-        # XXX: move under /etc/ssh/userkeys
-        # we want to exclusively manage ssh keys in puppet
-        if !is_array($ssh_keys) {
-            fail("${name} is not a valid ssh_keys array: ${ssh_keys}")
-        }
+    if !is_array($ssh_keys) {
+        fail("${name} is not a valid ssh_keys array: ${ssh_keys}")
+    }
 
-        if !empty($ssh_keys) {
-            $ssh_authorized_keys = join($ssh_keys, "\n")
-        } else {
-            $ssh_authorized_keys = ''
-        }
-
-        file { "/home/${name}/.ssh":
-            ensure  => ensure_directory($ensure),
-            owner   => $name,
-            group   => $gid,
-            mode    => '0700',
-            force   => true,
-            tag     => 'user-ssh',
-            require => File["/home/${name}"],
-        }
-
-        file { "/home/${name}/.ssh/authorized_keys":
-            ensure  => $ensure,
-            owner   => $name,
-            group   => $gid,
-            mode    => '0400',
-            content => $ssh_authorized_keys,
-            force   => true,
-            tag     => 'user-ssh',
-            require => File["/home/${name}/.ssh"],
-        }
+    ssh::userkey { $name:
+        ensure  => $ensure,
+        content => join($ssh_keys, "\n"),
+        tag     => 'user-ssh',
     }
 
     if !empty($privileges) {

-- 
To view, visit https://gerrit.wikimedia.org/r/183823
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I64b3ec8ec22bbda4b6edae3bf26f04f86513ee21
Gerrit-PatchSet: 6
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to