Commit 246519aa authored by James T. Lee's avatar James T. Lee
Browse files

ssh: Install on cygwin

parent 4cc6fe80
...@@ -3,6 +3,7 @@ class nest::profile::base { ...@@ -3,6 +3,7 @@ class nest::profile::base {
contain '::nest::profile::base::git' contain '::nest::profile::base::git'
contain '::nest::profile::base::packages' contain '::nest::profile::base::packages'
contain '::nest::profile::base::qemu' contain '::nest::profile::base::qemu'
contain '::nest::profile::base::ssh'
contain '::nest::profile::base::users' contain '::nest::profile::base::users'
# Git should be installed before managing any Vcsrepos # Git should be installed before managing any Vcsrepos
...@@ -22,7 +23,6 @@ class nest::profile::base { ...@@ -22,7 +23,6 @@ class nest::profile::base {
contain '::nest::profile::base::network' contain '::nest::profile::base::network'
contain '::nest::profile::base::openvpn' contain '::nest::profile::base::openvpn'
contain '::nest::profile::base::portage' contain '::nest::profile::base::portage'
contain '::nest::profile::base::ssh'
contain '::nest::profile::base::sudo' contain '::nest::profile::base::sudo'
contain '::nest::profile::base::systemd' contain '::nest::profile::base::systemd'
contain '::nest::profile::base::zfs' contain '::nest::profile::base::zfs'
......
class nest::profile::base::ssh { class nest::profile::base::ssh {
nest::portage::package_use { 'net-misc/openssh': case $facts['osfamily'] {
use => 'kerberos', 'Gentoo': {
} nest::portage::package_use { 'net-misc/openssh':
use => 'kerberos',
}
package { 'net-misc/openssh': package { 'net-misc/openssh':
ensure => installed, ensure => installed,
} }
file_line { file_line {
default: default:
path => '/etc/ssh/sshd_config', path => '/etc/ssh/sshd_config',
require => Package['net-misc/openssh'], require => Package['net-misc/openssh'],
notify => Service['sshd']; notify => Service['sshd'];
'sshd_config-ChallengeResponseAuthentication': 'sshd_config-ChallengeResponseAuthentication':
line => 'ChallengeResponseAuthentication no', line => 'ChallengeResponseAuthentication no',
match => '^#?ChallengeResponseAuthentication '; match => '^#?ChallengeResponseAuthentication ';
'sshd_config-X11Forwarding': 'sshd_config-X11Forwarding':
line => 'X11Forwarding yes', line => 'X11Forwarding yes',
match => '^#?X11Forwarding '; match => '^#?X11Forwarding ';
} }
service { 'sshd': service { 'sshd':
enable => true, enable => true,
} }
file { '/etc/systemd/user/ssh-agent.service': file { '/etc/systemd/user/ssh-agent.service':
mode => '0644', mode => '0644',
owner => 'root', owner => 'root',
group => 'root', group => 'root',
source => 'puppet:///modules/nest/ssh/ssh-agent.service', source => 'puppet:///modules/nest/ssh/ssh-agent.service',
notify => Exec['ssh-systemd-daemon-reload'], notify => Exec['ssh-systemd-daemon-reload'],
} }
exec { 'ssh-systemd-daemon-reload': exec { 'ssh-systemd-daemon-reload':
command => '/bin/systemctl daemon-reload', command => '/bin/systemctl daemon-reload',
refreshonly => true, refreshonly => true,
} }
exec { 'ssh-agent-enable-systemd-user-service': exec { 'ssh-agent-enable-systemd-user-service':
command => '/bin/systemctl --user --global enable ssh-agent.service', command => '/bin/systemctl --user --global enable ssh-agent.service',
creates => '/etc/systemd/user/default.target.wants/ssh-agent.service', creates => '/etc/systemd/user/default.target.wants/ssh-agent.service',
require => File['/etc/systemd/user/ssh-agent.service'], require => File['/etc/systemd/user/ssh-agent.service'],
} }
# XXX: Remove this after 20170719
file_line { 'pam_env.conf-SSH_AUTH_SOCK':
ensure => absent,
path => '/etc/security/pam_env.conf',
line => 'SSH_AUTH_SOCK DEFAULT="${XDG_RUNTIME_DIR}/ssh-agent.socket"',
}
}
# XXX: Remove this after 20170719 'windows': {
file_line { 'pam_env.conf-SSH_AUTH_SOCK': package { 'openssh':
ensure => absent, ensure => installed,
path => '/etc/security/pam_env.conf', }
line => 'SSH_AUTH_SOCK DEFAULT="${XDG_RUNTIME_DIR}/ssh-agent.socket"', }
} }
} }
...@@ -209,7 +209,10 @@ class nest::profile::base::users { ...@@ -209,7 +209,10 @@ class nest::profile::base::users {
::nest::cygwin_home_perms { 'post-refresh': ::nest::cygwin_home_perms { 'post-refresh':
user => $user, user => $user,
require => Exec["refresh-${user}-dotfiles"], require => [
Exec["refresh-${user}-dotfiles"],
File["${vcsrepo_dir}/.ssh/id_rsa"],
],
} }
} else { } else {
exec { "${dir}/.refresh": exec { "${dir}/.refresh":
...@@ -218,14 +221,14 @@ class nest::profile::base::users { ...@@ -218,14 +221,14 @@ class nest::profile::base::users {
refreshonly => true, refreshonly => true,
subscribe => Vcsrepo[$vcsrepo_dir], subscribe => Vcsrepo[$vcsrepo_dir],
} }
}
file { "${dir}/.ssh/id_rsa": file { "${vcsrepo_dir}/.ssh/id_rsa":
mode => '0600', mode => '0600',
owner => $user, owner => $user,
content => $::nest::ssh_private_key, content => $::nest::ssh_private_key,
show_diff => false, show_diff => false,
require => Vcsrepo[$vcsrepo_dir], require => Vcsrepo[$vcsrepo_dir],
}
} }
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment