-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from arillso/support/windows
add Windows support
- Loading branch information
Showing
20 changed files
with
186 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
--- | ||
# handlers file for arillso.sshd | ||
|
||
- name: restart sshd | ||
- name: restart linux sshd | ||
become: true | ||
service: | ||
name: "{{ sshd_service_name }}" | ||
name: '{{ sshd_service_name }}' | ||
state: restarted | ||
|
||
- name: restart windows sshd | ||
win_service: | ||
name: '{{ sshd_service_name }}' | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,3 @@ galaxy_info: | |
versions: | ||
- 6 | ||
- 7 | ||
- 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
# tasks file for arillso.sshd | ||
|
||
- name: 'Linux : get openssh-version' | ||
shell: set -o pipefail && ssh -V 2>&1 | sed -r 's/.*_([0-9]*\.[0-9]).*/\1/g' | ||
args: | ||
executable: /bin/bash | ||
changed_when: false | ||
register: sshd_version | ||
check_mode: false | ||
|
||
- name: 'Linux : include tasks to create crypo-vars' | ||
include_tasks: subtasks/crypto.yml | ||
|
||
- name: 'LInux : create revoked_keys and set permissions to root/600' | ||
become: true | ||
template: | ||
src: 'revoked_keys.j2' | ||
dest: '/etc/ssh/revoked_keys' | ||
mode: '0600' | ||
owner: '{{ ssh_owner }}' | ||
group: '{{ ssh_group }}' | ||
notify: restart linux sshd | ||
when: ssh_server_hardening | bool | ||
|
||
- name: 'Linux : create sshd_config and set permissions to root/600' | ||
become: true | ||
template: | ||
src: 'opensshd.conf.j2' | ||
dest: '/etc/ssh/sshd_config' | ||
mode: '0600' | ||
owner: '{{ ssh_owner }}' | ||
group: '{{ ssh_group }}' | ||
validate: '/usr/sbin/sshd -T -C user=root -C host=localhost -C addr=localhost -f %s' | ||
notify: restart linux sshd | ||
when: ssh_server_hardening | bool | ||
|
||
- name: 'Linux : create ssh_config and set permissions to root/644' | ||
become: true | ||
template: | ||
src: 'openssh.conf.j2' | ||
dest: '/etc/ssh/ssh_config' | ||
mode: '0644' | ||
owner: '{{ ssh_owner }}' | ||
group: '{{ ssh_group }}' | ||
when: ssh_client_hardening | bool | ||
|
||
- name: 'Linux : Check if {{ sshd_moduli_file }} contains weak DH parameters' | ||
shell: awk '$5 < {{ sshd_moduli_minimum }}' {{ sshd_moduli_file }} | ||
register: sshd_register_moduli | ||
changed_when: false | ||
check_mode: false | ||
|
||
- name: 'Linux : Remove all small primes' | ||
shell: | ||
awk '$5 >= {{ sshd_moduli_minimum }}' {{ sshd_moduli_file }} > {{ sshd_moduli_file }}.new ; | ||
[ -r {{ sshd_moduli_file }}.new -a -s {{ sshd_moduli_file }}.new ] && mv {{ sshd_moduli_file }}.new {{ sshd_moduli_file }} || true | ||
notify: restart linux sshd | ||
when: sshd_register_moduli.stdout | ||
|
||
- name: 'Linux : Include tasks to setup ca keys and principals' | ||
include_tasks: subtasks/ca_keys_and_principals.yml | ||
when: ssh_trusted_user_ca_keys_file | length > 0 | ||
|
||
- name: 'Linux : include tasks to setup 2FA' | ||
include_tasks: subtasks/2fa.yml | ||
when: | ||
- ssh_use_pam | bool | ||
- ssh_challengeresponseauthentication | bool | ||
- ssh_google_auth | bool | ||
|
||
- name: 'Linux : include selinux specific tasks' | ||
include_tasks: subtasks/selinux.yml | ||
when: ansible_selinux and ansible_selinux.status == "enabled" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
# tasks file for arillso.sshd | ||
|
||
- name: 'Windows : Install OpenSSH' | ||
become_method: runas | ||
become_user: System | ||
become: yes | ||
sbaerlocher.windows.win_capability: | ||
name: 'OpenSSH.Server~~~~0.0.1.0' | ||
|
||
- name: 'Windows : Get openssh-version' | ||
win_shell: ssh -V | ||
changed_when: false | ||
register: sshd_verstion_string | ||
check_mode: false | ||
|
||
- name: 'Windows : Set openssh-version' | ||
set_fact: | ||
sshd_version: | ||
stdout: '{{ sshd_verstion_string.stderr | regex_search("(\d{1,2}\.\d{1,2})(?!\.)") }}' | ||
|
||
- name: 'Windows : Include tasks to create crypo-vars' | ||
include_tasks: subtasks/crypto.yml | ||
|
||
- name: 'Windows : Set the default shell to PowerShell' | ||
win_regedit: | ||
path: HKLM:\SOFTWARE\OpenSSH | ||
name: DefaultShell | ||
data: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe | ||
type: string | ||
state: present | ||
|
||
- name: 'Windows : Create sshd_config' | ||
win_template: | ||
src: 'opensshd.conf.j2' | ||
dest: 'C:\ProgramData\ssh\sshd_config' | ||
notify: restart windows sshd | ||
|
||
- name: 'Windows : Create revoked_keys and set permissions to root/600' | ||
become: true | ||
template: | ||
src: 'revoked_keys.j2' | ||
dest: 'C:\ProgramData\ssh\revoked_keys' | ||
notify: restart windows sshd |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.