Browse Source

Add variables for file owner and mode

master
Adam Mendlik 7 years ago
parent
commit
613bea2cac
4 changed files with 27 additions and 5 deletions
  1. +3
    -1
      .kitchen.yml
  2. +6
    -4
      openssh/config.sls
  3. +6
    -0
      openssh/defaults.yaml
  4. +12
    -0
      test/integration/default/serverspec/openssl_server_spec.rb

+ 3
- 1
.kitchen.yml View File

'*': '*':
- openssl - openssl
openssl.sls: openssl.sls:
sshd_enable: true
openssh:
sshd_config_mode: '600'
ssh_config_mode: '600'


suites: suites:
- name: default - name: default

+ 6
- 4
openssh/config.sls View File

- name: {{ openssh.sshd_config }} - name: {{ openssh.sshd_config }}
- source: {{ openssh.sshd_config_src }} - source: {{ openssh.sshd_config_src }}
- template: jinja - template: jinja
- user: root
- mode: 644
- user: {{ openssh.sshd_config_user }}
- group: {{ openssh.sshd_config_group }}
- mode: {{ openssh.sshd_config_mode }}
- watch_in: - watch_in:
- service: openssh - service: openssh


- name: {{ openssh.ssh_config }} - name: {{ openssh.ssh_config }}
- source: {{ openssh.ssh_config_src }} - source: {{ openssh.ssh_config_src }}
- template: jinja - template: jinja
- user: root
- mode: 644
- user: {{ openssh.ssh_config_user }}
- group: {{ openssh.ssh_config_group }}
- mode: {{ openssh.ssh_config_mode }}


{% for keyType in ['ecdsa', 'dsa', 'rsa', 'ed25519'] %} {% for keyType in ['ecdsa', 'dsa', 'rsa', 'ed25519'] %}
{% if salt['pillar.get']('openssh:generate_' ~ keyType ~ '_keys', False) %} {% if salt['pillar.get']('openssh:generate_' ~ keyType ~ '_keys', False) %}

+ 6
- 0
openssh/defaults.yaml View File

sshd_enable: True sshd_enable: True
sshd_config: /etc/ssh/sshd_config sshd_config: /etc/ssh/sshd_config
sshd_config_src: salt://openssh/files/sshd_config sshd_config_src: salt://openssh/files/sshd_config
sshd_config_user: root
sshd_config_group: root
sshd_config_mode: '644'
ssh_config: /etc/ssh/ssh_config ssh_config: /etc/ssh/ssh_config
ssh_config_src: salt://openssh/files/ssh_config ssh_config_src: salt://openssh/files/ssh_config
ssh_config_user: root
ssh_config_group: root
ssh_config_mode: '644'
banner: /etc/ssh/banner banner: /etc/ssh/banner
banner_src: salt://openssh/files/banner banner_src: salt://openssh/files/banner
ssh_known_hosts: /etc/ssh/ssh_known_hosts ssh_known_hosts: /etc/ssh/ssh_known_hosts

+ 12
- 0
test/integration/default/serverspec/openssl_server_spec.rb View File

it { should be_running } it { should be_running }
end end


describe file('/etc/ssh/sshd_config') do
it { should be_mode 600 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
end

describe file('/etc/ssh/ssh_config') do
it { should be_mode 600 }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
end

end end

Loading…
Cancel
Save