|
33 | 33 | if conf['ssh_key'].nil? |
34 | 34 | # Ensure to generate ssh credentials if none is given. |
35 | 35 | execute "generating ssh key-pair for #{conf['user']}" do |
36 | | - command "ssh-keygen -f #{conf['home']}/.ssh/id_rsa -b #{conf['ssh_key_bits']} -P ''" |
| 36 | + command "ssh-keygen -f #{conf['home']}/.ssh/stanley_rsa -b #{conf['ssh_key_bits']} -P ''" |
37 | 37 | user conf['user'] |
38 | 38 | group conf['group'] |
39 | | - not_if { ::File.exist? "#{conf['home']}/.ssh/id_rsa" } |
| 39 | + not_if { ::File.exist? "#{conf['home']}/.ssh/stanley_rsa" } |
40 | 40 | only_if { conf['ssh_key'].nil? } |
41 | 41 | action :run |
42 | 42 | end |
43 | 43 | else |
44 | 44 | # Write supplied credentials |
45 | | - file "creating #{conf['home']}/.ssh/id_rsa key #{conf['user']}" do |
46 | | - path "#{conf['home']}/.ssh/id_rsa" |
| 45 | + file "creating #{conf['home']}/.ssh/stanley_rsa key #{conf['user']}" do |
| 46 | + path "#{conf['home']}/.ssh/stanley_rsa" |
47 | 47 | mode 0640 |
48 | 48 | user conf['user'] |
49 | 49 | group conf['group'] |
50 | 50 | content(conf['ssh_key']) |
51 | 51 | action :create |
52 | 52 | end |
53 | 53 |
|
54 | | - file "creating #{conf['home']}/.ssh/id_rsa public key for #{conf['user']}" do |
55 | | - path "#{conf['home']}/.ssh/id_rsa.pub" |
| 54 | + file "creating #{conf['home']}/.ssh/stanley_rsa public key for #{conf['user']}" do |
| 55 | + path "#{conf['home']}/.ssh/stanley_rsa.pub" |
56 | 56 | user conf['user'] |
57 | 57 | group conf['group'] |
58 | 58 | content(conf['ssh_pub']) |
|
70 | 70 | content lazy { |
71 | 71 | # We make it lazy, because we want self ssh login. |
72 | 72 | # For example. It's usefull if we deloy a chef node and the clone it :) |
73 | | - mypub = ::IO.read("#{conf['home']}/.ssh/id_rsa.pub") |
| 73 | + mypub = ::IO.read("#{conf['home']}/.ssh/stanley_rsa.pub") |
74 | 74 | pubkeys = conf['authorized_keys'].dup |
75 | 75 | pubkeys.unshift(mypub) unless pubkeys.include?(mypub) |
76 | 76 | "# Generated by Chef. Don't edit!\n" << pubkeys.join("\n") |
|
83 | 83 | user conf['user'] |
84 | 84 | nopasswd true |
85 | 85 | only_if { conf['enable_sudo'] } |
| 86 | + action :create |
86 | 87 | end |
0 commit comments