-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#17) Add TLS option for bootstrapping
Previously, the TLS configuration was set to allow both TLS 1.1 and TLS 1.2. With this change, users can explicitly set the TLS versions they want to allow during bootstrapping. The default settings are to allow TLS 1.2 and 1.3, according to the TLS versions available on the client. Also added some tests to verify the new behaviour.
- Loading branch information
Showing
9 changed files
with
97 additions
and
15 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
1 change: 0 additions & 1 deletion
1
chocolatey/tests/integration/targets/setup_win_chocolatey/defaults/main.yml
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
4 changes: 4 additions & 0 deletions
4
chocolatey/tests/integration/targets/win_chocolatey/defaults/main.yml
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,4 @@ | ||
--- | ||
test_choco_bootstrap_script: '{{ win_output_dir }}/test-bootstrap.ps1' | ||
test_choco_backup: '{{ win_output_dir }}/backup/' | ||
choco_install_dir: 'C:/ProgramData/chocolatey/' |
File renamed without changes.
54 changes: 54 additions & 0 deletions
54
chocolatey/tests/integration/targets/win_chocolatey/tasks/bootstrap_tests.yml
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,54 @@ | ||
--- | ||
- name: copy test bootstrap script | ||
win_copy: | ||
src: files/bootstrap.ps1 | ||
dest: '{{ test_choco_bootstrap_script }}' | ||
|
||
- name: backup Chocolatey installation | ||
win_copy: | ||
src: '{{ choco_install_dir }}' | ||
dest: '{{ test_choco_backup }}' | ||
remote_src: yes | ||
|
||
- name: ensure Chocolatey is not installed | ||
win_file: | ||
path: '{{ choco_install_dir }}' | ||
state: absent | ||
|
||
- name: install Chocolatey using the test bootstrap script | ||
win_chocolatey: | ||
name: chocolatey | ||
state: present | ||
bootstrap_script: "{{ test_choco_bootstrap_script }}" | ||
|
||
- name: checking if the bootstrap file has been created | ||
win_shell: Get-Content -Path "C:/temp/confirm-bootstrap.txt" -Raw | ||
register: bootstrap_file_check | ||
|
||
- name: assert bootstrap file has been created | ||
assert: | ||
that: | ||
- (bootstrap_file_check.stdout|from_json).bootstrap | ||
|
||
- name: ensure Chocolatey is not installed | ||
win_file: | ||
path: '{{ choco_install_dir }}' | ||
state: absent | ||
|
||
- name: installing Chocolatey from Community Repository with TLS 1.1 only should fail | ||
win_chocolatey: | ||
name: chocolatey | ||
bootstrap_tls_version: [ tls11 ] | ||
register: test_tls_version | ||
failed_when: not test_tls_version.failed | ||
|
||
- name: ensure no leftover files from failed install | ||
win_file: | ||
path: '{{ choco_install_dir }}' | ||
state: absent | ||
|
||
- name: restore Chocolatey installation from backup | ||
win_copy: | ||
src: '{{ test_choco_backup }}' | ||
dest: '{{ choco_install_dir }}' | ||
remote_src: yes |
3 changes: 3 additions & 0 deletions
3
chocolatey/tests/integration/targets/win_chocolatey/tasks/main.yml
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