-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path100-puppet_ssh_config.pp
More file actions
executable file
·40 lines (35 loc) · 1.32 KB
/
Copy path100-puppet_ssh_config.pp
File metadata and controls
executable file
·40 lines (35 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Making changes to the default ssh config file using puppet
# so that one can connect to a server without entering password keyphrase
include stdlib
file_line { 'SSH Private Key':
path => '/etc/ssh/ssh_config',
line => ' IdentityFile ~/.ssh/school',
match => '^[#]+[\s]*(?i)IdentityFile[\s]+~/.ssh/id_rsa$',
replace => true,
append_on_no_match => true
}
# Regex match explanation
#
# ^ beginning of the line
# [#]* atleast one hash character
# [\s]* zero or more white space characters
# (?i)IdentityFile case insensitive "IdentityFile"
# [\s]+ at least one whitespace character
# ~/.ssh/id_rsa The ssh private key file path we want to replace
# $ end of the line
file_line { 'Deny Password Auth':
path => '/etc/ssh/ssh_config',
line => ' PasswordAuthentication no',
match => '^[#]+[\s]*(?i)PasswordAuthentication[\s]+(yes|no)$',
replace => true,
append_on_no_match => true
}
# Regex match explanation
#
# ^ beginning of the line
# [#]* atleast one hash character
# [\s]* zero or more white space characters
# (?i)PasswordAuthentication case insensitive "PasswordAuthentication"
# [\s]+ at least one whitespace character
# (yes|no) with the value "yes" or the value "no"
# $ end of the line