This repository was archived by the owner on Dec 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 198
Macs kex ciphers #139
Merged
Merged
Macs kex ciphers #139
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,62 @@ | ||
| --- | ||
| - name: wrapper playbook for kitchen testing "ansible-ssh-hardening" with custom settings | ||
| hosts: localhost | ||
| pre_tasks: | ||
| - package: name="{{item}}" state=installed | ||
| with_items: | ||
| - "openssh-clients" | ||
| - "openssh-server" | ||
| ignore_errors: true | ||
| - apt: name="{{item}}" state=installed update_cache=true | ||
| with_items: | ||
| - "openssh-client" | ||
| - "openssh-server" | ||
| ignore_errors: true | ||
| - file: path="/var/run/sshd" state=directory | ||
| - name: create ssh host keys | ||
| command: "ssh-keygen -A" | ||
| when: not ((ansible_os_family in ['Oracle Linux', 'RedHat']) and ansible_distribution_major_version < '7') | ||
|
|
||
| roles: | ||
| - ansible-ssh-hardening | ||
| vars: | ||
| network_ipv6_enable: true | ||
| ssh_allow_root_with_key: true | ||
| ssh_allow_tcp_forwarding: true | ||
| ssh_gateway_ports: true | ||
| ssh_allow_agent_forwarding: true | ||
| ssh_server_permit_environment_vars: ['PWD','HTTP_PROXY'] | ||
| ssh_client_alive_interval: 100 | ||
| ssh_client_alive_count: 10 | ||
| ssh_client_password_login: true | ||
| ssh_client_cbc_required: true | ||
| ssh_client_weak_kex: true | ||
| ssh_challengeresponseauthentication: true | ||
| ssh_compression: true | ||
| ssh_allow_users: 'root kitchen vagrant' | ||
| ssh_allow_groups: 'root kitchen vagrant' | ||
| ssh_deny_users: 'foo bar' | ||
| ssh_deny_groups: 'foo bar' | ||
| ssh_authorized_keys_file: '/etc/ssh/authorized_keys/%u' | ||
| ssh_max_auth_retries: 10 | ||
| ssh_permit_tunnel: true | ||
| ssh_print_motd: true | ||
| ssh_print_last_log: true | ||
| ssh_banner: true | ||
| ssh_server_password_login: true | ||
| ssh_server_weak_hmac: true | ||
| sftp_enabled: true | ||
| ssh_server_enabled: false | ||
| ssh_server_match_group: | ||
| - group: 'root' | ||
| rules: 'AllowTcpForwarding yes' | ||
| ssh_server_match_user: | ||
| - user: 'root' | ||
| rules: 'AllowTcpForwarding yes' | ||
| ssh_remote_hosts: | ||
| - names: ['example.com', 'example2.com'] | ||
| options: ['Port 2222', 'ForwardAgent yes'] | ||
| - names: ['example3.com'] | ||
| options: ['StrictHostKeyChecking no'] | ||
| ssh_use_dns: true | ||
| ssh_use_pam: true | ||
This file contains hidden or 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 hidden or 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,98 @@ | ||
| --- | ||
|
|
||
| - name: set hostkeys according to openssh-version | ||
| set_fact: | ||
| ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key', '/etc/ssh/ssh_host_ed25519_key'] | ||
| when: sshd_version.stdout >= '6.3' and not ssh_host_key_files | ||
|
|
||
| - name: set hostkeys according to openssh-version | ||
| set_fact: | ||
| ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key', '/etc/ssh/ssh_host_ecdsa_key'] | ||
| when: sshd_version.stdout >= '6.0' and not ssh_host_key_files | ||
|
|
||
| - name: set hostkeys according to openssh-version | ||
| set_fact: | ||
| ssh_host_key_files: ['/etc/ssh/ssh_host_rsa_key'] | ||
| when: sshd_version.stdout >= '5.3' and not ssh_host_key_files | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would do that using one ssh_host_key_files: '{{ ['/etc/ssh/ssh_host_rsa_key'] if sshd_version.stdout >= '6.0' else ... }}'This way, the whole file can be reduced to Jinja2 templating in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried and did not find a proper solution with the correct syntax. |
||
|
|
||
| ### | ||
|
|
||
| - name: set weak macs according to openssh-version if openssh >= 7.6 | ||
| set_fact: | ||
| ssh_macs: "{{ssh_macs_76_default}}" | ||
| when: sshd_version.stdout >= '7.6' and not ssh_macs | ||
|
|
||
| - name: set weak macs according to openssh-version if openssh >= 6.6 | ||
| set_fact: | ||
| ssh_macs: "{{ssh_macs_66_weak}}" | ||
| when: sshd_version.stdout >= '6.6' and ssh_server_weak_hmac and not ssh_macs | ||
|
|
||
| - name: set macs according to openssh-version if openssh >= 6.6 | ||
| set_fact: | ||
| ssh_macs: "{{ssh_macs_66_default}}" | ||
| when: sshd_version.stdout >= '6.6' and not ssh_macs | ||
|
|
||
| - name: set weak macs according to openssh-version | ||
| set_fact: | ||
| ssh_macs: "{{ssh_macs_59_weak}}" | ||
| when: sshd_version.stdout >= '5.9' and ssh_server_weak_hmac and not ssh_macs | ||
|
|
||
| - name: set macs according to openssh-version | ||
| set_fact: | ||
| ssh_macs: "{{ssh_macs_59_default}}" | ||
| when: sshd_version.stdout >= '5.9' and not ssh_macs | ||
|
|
||
| - name: set macs according to openssh-version | ||
| set_fact: | ||
| ssh_macs: "{{ssh_macs_53_default}}" | ||
| when: sshd_version.stdout >= '5.3' and not ssh_macs | ||
|
|
||
| - name: set macs according to openssh-version | ||
| set_fact: | ||
| ssh_macs: "{{ssh_macs_53_default}}" | ||
| when: sshd_version.stdout >= '5.3' and not ssh_macs | ||
|
|
||
| ### | ||
|
|
||
| - name: set weak ciphers according to openssh-version if openssh >= 6.6 | ||
| set_fact: | ||
| ssh_ciphers: "{{ssh_ciphers_66_weak}}" | ||
| when: sshd_version.stdout >= '6.6' and ssh_server_cbc_required and not ssh_ciphers | ||
|
|
||
| - name: set ciphers according to openssh-version if openssh >= 6.6 | ||
| set_fact: | ||
| ssh_ciphers: "{{ssh_ciphers_66_default}}" | ||
| when: sshd_version.stdout >= '6.6' and not ssh_ciphers | ||
|
|
||
| - name: set weak ciphers according to openssh-version | ||
| set_fact: | ||
| ssh_ciphers: "{{ssh_ciphers_53_weak}}" | ||
| when: sshd_version.stdout >= '5.3' and ssh_server_cbc_required and not ssh_ciphers | ||
|
|
||
| - name: set ciphers according to openssh-version | ||
| set_fact: | ||
| ssh_ciphers: "{{ssh_ciphers_53_default}}" | ||
| when: sshd_version.stdout >= '5.3' and not ssh_ciphers | ||
|
|
||
| ### | ||
|
|
||
| - name: set weak kex according to openssh-version if openssh >= 6.6 | ||
| set_fact: | ||
| ssh_kex: "{{ssh_kex_66_weak}}" | ||
| when: sshd_version.stdout >= '6.6' and ssh_server_weak_hmac and not ssh_kex | ||
|
|
||
| - name: set kex according to openssh-version if openssh >= 6.6 | ||
| set_fact: | ||
| ssh_kex: "{{ssh_kex_66_default}}" | ||
| when: sshd_version.stdout >= '6.6' and not ssh_kex | ||
|
|
||
| - name: set weak kex according to openssh-version | ||
| set_fact: | ||
| ssh_kex: "{{ssh_kex_59_weak}}" | ||
| when: sshd_version.stdout >= '5.9' and ssh_server_weak_hmac and not ssh_kex | ||
|
|
||
| - name: set kex according to openssh-version | ||
| set_fact: | ||
| ssh_kex: "{{ssh_kex_59_default}}" | ||
| when: sshd_version.stdout >= '5.9' and not ssh_kex | ||
|
|
||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please always use YAML syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix this in a separate PR where I'll change it everywhere.