Commit Graph

8064 Commits (c404bd75ffa66a672b1fbf85fb46a5b3efbf326e)

Author SHA1 Message Date
Rick Elrod eb1114a1b1
[tests] pin docker to <4.3.0 (#71193)
Change:
- New python docker lib wants a newer docker than we have in CI.

Test Plan:
- CI

Signed-off-by: Rick Elrod <rick@elrod.me>
5 years ago
David Shrewsbury f35e825440
[2.8] Sanitize URI module keys with no_log values (#70762) (#70822)
* Sanitize URI module keys with no_log values (#70762)

* Add sanitize_keys() to module_utils.

* More robust tests

* Revert 69653 change

* Allow list or dict

* fix pep8

* Sanitize lists within dict values

* words

* First pass at uri module

* Fix insane sanity tests

* fix integration tests

* Add changelog

* Remove unit test introduced in 69653

* Add ignore_keys param

* Sanitize all-the-things

* Ignore '_ansible*' keys

* cleanup

* Use module.no_log_values

* Avoid deep recursion issues by using deferred removal structure.

* Nit cleanups

* Add doc blurb

* spelling

* ci_complete

(cherry picked from commit bf98f031f3)

* update changelog for security_fixes

* Update 70762-sanitize-uri-keys.yml

Co-authored-by: Rick Elrod <rick@elrod.me>
5 years ago
Rick Elrod d73793fac7
Update integration tests to support rpmfluff-0.6 (#71155) (#71161)
Co-authored-by: Matt Martz <matt@sivel.net>
5 years ago
Sloane Hertel 291f94934c
copy - redact 'content' from invocation in check mode (#71033) (#71069)
* sanitize copy module invocation secrets in check mode

(cherry picked from commit 991714b9d1)
5 years ago
Sam Doran 11738aed97
[stable-2.8] Change default file permissions so they are not world readable (#70221) (#70827)
* [stable-2.8] Change default file permissions so they are not world readable (#70221)

* Change default file permissions so they are not world readable

CVE-2020-1736

Set the default permissions for files we create with atomic_move() to 0o0660. Track
which files we create that did not exist and warn if the module supports 'mode'
and it was not specified and the module did not call set_mode_if_different(). This allows the user to take action and specify a mode rather than using the defaults.

A code audit is needed to find all instances of modules that call atomic_move()
but do not call set_mode_if_different(). The findings need to be documented in
a changelog since we are not warning. Warning in those instances would be frustrating
to the user since they have no way to change the module code.

- use a set for storing list of created files
- just check the argument spac and params rather than using another property
- improve the warning message to include the default permissions.
(cherry picked from commit 5260527c4a)

Co-authored-by: Sam Doran <sdoran@redhat.com>

* Fix service test

* Fix lamdba_policy test

* Fix aws_lamdba test

* Fix warning for new default permissions when mode is not specified (#70976)

Follow up to #70221
Related to #67794
CVE-2020-1736

When set_mode_if_different() is called with mode of 'None', ensure we issue
a warning about the change in default permissions.

Add integration tests to ensure the warning works properly.

* Fix tests
- actually use custom module 🤦‍♂️
- verify file permission on created files
- use remote_tmp_dir so we're ready for split controller
- improve test module so we can skip the call to set_fs_attributes_if_different()
- fix tests for CentOS 6

(cherry picked from commit dc79528cc6)

* Use new category in changelog fragments
5 years ago
Sam Doran b95e520602
[stable-2.8] Drop "rhui-" prefix from RHEL repositories in AMI (#71130) (#71133)
The repository names seem to have changed and no longer have the "rhui-" prefix.
(cherry picked from commit 6ac4439a6a)

Co-authored-by: Sam Doran <sdoran@redhat.com>
5 years ago
Matt Clay 9c5663699f [stable-2.8] Cap pytest version to avoid relative import issue.
(cherry picked from commit 3a8ac62596)

Co-authored-by: Matt Clay <matt@mystile.com>
6 years ago
Sam Doran eb7597c5cb
[stable-2.8] Pin psutil version in pids test (#70716) 6 years ago
Sam Doran 9d7594c627
[stable-2.8] ansible_runner test - Add constraints (#70667) (#70671)
A recent updated to psutil, which is a dependency of ansible-runner, fails
to install on older versions of pip.

Commit with the breaking change:

  135628639b
(cherry picked from commit 9d27d7c8b1)

Co-authored-by: Sam Doran <sdoran@redhat.com>
6 years ago
Matt Clay 0f96e7e4cf [stable-2.8] Default ansible-test provisioning to us-east-1.
Previously windows instances on Shippable would be automatically directed to us-east-2.
(cherry picked from commit 1cf26896c5)

Co-authored-by: Matt Clay <matt@mystile.com>
6 years ago
Matt Clay 9fa105f183 Remove Azure module tests from CI. 6 years ago
Rick Elrod 0923e156c1 pip tests, use py2 compat sampleproject fork
Change:
- sampleproject has gone py3 only. Use a py2 compatible fork.

Test Plan:
- CI

Signed-off-by: Rick Elrod <rick@elrod.me>
6 years ago
Sam Doran b354b66c4b [stable-2.8] Pin version of netaddr and jmespath in filters test 6 years ago
Rick Elrod 14bcd3b7a3
yum - fix bug where enablerepo is not honored when disablerepo all (#66557) (#70085)
Fixes #66549

The inefficiency improvement
https://github.com/ansible/ansible/pull/63713 introduced a bug where
`enablerepo` was not being honored if combined with
`disablerepo="*"`. This fixes that issue.

Signed-off-by: Adam Miller <admiller@redhat.com>

Co-authored-by: Adam Miller <admiller@redhat.com>
6 years ago
Sam Doran 47256e921c
[stable-2.8] Pin Docker version at 19.03.1 (#69635) (#69646)
* [stable-2.8] Pin Docker version at 19.03.1
(cherry picked from commit fe941a4045)

Co-authored-by: Sam Doran <sdoran@redhat.com>

* [stable-2.8] Pin docker-ce-cli version in tests (#69620)

Installing docker-ce has a dependency of docker-ce-cli. If the version of docker-ci-cli is not specified, it installs the latest version.

(cherry picked from commit 889da811d7)
6 years ago
Matt Clay 4cdbcc4ed9 Disable failing azure_rm_dnszone test.
The module requires updates to work with the current Azure API.
6 years ago
Jordan Borean 85dfb1f49a Fix win_psmodule and win_psrepository tests 6 years ago
Rick Elrod e022b0d578 Add RHEL 8.2 to CI
Change:
RHEL 8.2 GA was released this week, test it in CI instead of 8.1.

Test Plan:
CI

Signed-off-by: Rick Elrod <rick@elrod.me>
6 years ago
Rick Elrod 94751ef971 Enable dnf integration tests on CentOS 8
Change:
We were only testing dnf on RHEL previously.
Test on CentOS 8 as well.

Test Plan:
Ran locally in docker.

Signed-off-by: Rick Elrod <rick@elrod.me>
6 years ago
Rick Elrod 75c5c543cb [dnf] Make behavior/errors compatible for new DNF
Change:
Extend the logic for custom error handling in the dnf module, so that on
newer DNF (such as DNF that ships with modern Fedora 31 container
images, and ships with RHEL 8.2) we report errors consistently with
older DNF.

Test Plan:
Ran dnf integration tests against an old Fedora 31 container image and a
brand new Fedora 32 container image; tess passed on both.

Signed-off-by: Rick Elrod <rick@elrod.me>
6 years ago
Rick Elrod d9d236ff56 [stable-2.8] pip - Fix check_mode for prerelease packages (#68690)
* pip - Fix check_mode for prerelease packages

Fixes #68592.

Signed-off-by: Rick Elrod <rick@elrod.me>
Co-authored-by: Matt Martz <matt@sivel.net>
(cherry picked from commit 82c60db49b)

Co-authored-by: Rick Elrod <rick@elrod.me>
6 years ago
Brian Coca 6f75aa2664 fixed fetch traversal from slurp (#68720)
* fixed fetch traversal from slurp

  * ignore slurp result for dest
  * fixed naming when source is relative
  * added tests with fake slurp
  * moved existing role tests into runme.sh
  * normalized on action excepts
  * moved dest transform down to when needed
  * added is_subpath check

fixes #67793

CVE-2019-3828

(cherry picked from commit ba87c225cd)
6 years ago
Sloane Hertel e6199d768c
[2.8] CVE-2020-1746 - Remove the params module option from ldap_attr and ldap_entry (#68715)
* Remove the params module option from ldap_attr and ldap_entry

Module options that circumvent Ansible's option handling were disallowed
in:
https://meetbot.fedoraproject.org/ansible-meeting/2017-09-28/ansible_dev_meeting.2017-09-28-15.00.log.html

Additionally, this particular usage can be insecure if bind_pw is set
this way as the password could end up in a logfile or displayed on
stdout.

Fixes CVE-2020-1746

(cherry picked from commit 0ff609f1bc)

* Fix formatting for option names

Co-Authored-By: Felix Fontein <felix@fontein.de>

* Fix fail_json

* update sanity

* fix indentation error

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
6 years ago
Brian Coca 5eabf7bb93
prevent ansible_facts injection (#68431) (#68445)
* prevent ansible_facts injection (#68431)

- also only replace when needed
 - switched from replace to index
 - added test to verify bogus_facts are not accepted

CVE-2020-10684

(cherry picked from commit a9d2ceafe4)

* added to ignore
6 years ago
Brian Coca e1273b6faf fix vault temp file handling (#68433)
* fix vault tmpe file handling

 * use local temp dir instead of system temp
 * ensure each worker clears dataloader temp files
 * added test for dangling temp files
 * added notes to data loader

CVE-2020-10685

(cherry picked from commit 6452a82452)
6 years ago
Sloane Hertel 6c74a29870 subversion module - provide password securely when possible or warn (#67829)
* subversion module - provide password securely with svn command line option --password-from-stdin when possible, and provide a warning otherwise.
* Update lib/ansible/modules/source_control/subversion.py.
* Add a test.

Co-authored-by: Sam Doran <sdoran@redhat.com>
(cherry picked from commit d91658ec0c)
6 years ago
Roman 0e433f3d8f
[backport/2.8/63280] acl: fix module failure if there're spaces in a path (#63280) (#63809)
* acl: fix module failure if there're spaces in a path (#63280)

* Make acl module to work with whitespaces in path

* Added a changelog fragment

* Add quotes to changelog fragment

(cherry picked from commit 504d76e956)

* Fix tests
6 years ago
Sam Doran a46a9b8fac win_unzip - normalize and compare paths to prevent path traversal (#67799)
* Actually inspect the paths and prevent escape
* Add integration tests
* Generate zip files for use in integration test
* Adjust error message

(cherry picked from commit d30c57ab22)
6 years ago
Matt Clay 0a8d8b5c98 Disable failing azure_rm_cosmosdbaccount test. 6 years ago
Matt Clay 191a17a67f [stable-2.8] Update tests to use RHEL 7.8. (#68787)
* Update tests to use RHEL 7.8.

Keeping support for RHEL 7.6 since collections are still using it.

* Fix tests for RHEL 7.7+ due to extras repo name change..
(cherry picked from commit 04edd77c42)

Co-authored-by: Matt Clay <mclay@redhat.com>
6 years ago
Rick Elrod 0e2e863f5c Fix win_psrepository tests
Backport of a5414cb0e4

Signed-off-by: Rick Elrod <rick@elrod.me>
6 years ago
Rick Elrod 66cc931f0d
OpenSUSE15.1 container image + necessary test changes (2.8 edition) (#68794)
* add changelog fragment

Signed-off-by: Rick Elrod <rick@elrod.me>

* Update changelogs/fragments/ansible-test-opensuse-15.1.yml

Co-Authored-By: Matt Clay <matt@mystile.com>

* handle installing mysql on suse

Signed-off-by: Rick Elrod <rick@elrod.me>

* attempt to get tests passing again

Signed-off-by: Rick Elrod <rick@elrod.me>

* Update docker.txt to use the OpenSUSE 15.1 container image

Signed-off-by: Rick Elrod <rick@elrod.me>

Co-authored-by: Matt Clay <matt@mystile.com>
6 years ago
Jordan Borean 25e30573f4 win_unzip - LiteralPath fix (#66972)
* win_unzip - LiteralPath fix

* Fix up Python sanity issues

(cherry picked from commit 2a9ec8975f)
6 years ago
Jordan Borean 22dd4e113d win_uri: fix up tests (#67064)
(cherry picked from commit 3ada0b2f65)
6 years ago
René Moser 8fd095377a [stable-2.8] tests: ipify_facts: retry on fail (#66897)
(cherry picked from commit 91063f40d6)

Co-authored-by: Rene Moser <mail@renemoser.net>
6 years ago
Matt Clay 76fff030a8
[stable-2.8] Remove Tower module tests from CI. (#67368) (#67372)
* [stable-2.8] Remove Tower module tests from CI. (#67368)

* Remove Tower module tests from CI.

The required AMIs are no longer available.

* Mark Tower tests as unsupported..
(cherry picked from commit b041d96762)

Co-authored-by: Matt Clay <mclay@redhat.com>

* Mark tower_common unsupported.
6 years ago
Sam Doran 5e411807e7 [stable-2.8] ansible-test - add constraint for virtualenv (#67289)
* ansible-test - add constraint for virtualenv

* Limit virtualenv only on macOS.

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 8f296a6533)

Co-authored-by: Sam Doran <sdoran@redhat.com>
6 years ago
Matt Clay 6f5c94ffea [stable-2.8] Add constraints for Jinja2 on Python 2.6. (#66826)
* Add constraint for Jinja2 on Python 2.6.

* Fix constraint in inventory_aws_conformance test.

* Add constrraints for template_jinja2_latest test.
(cherry picked from commit 965854fbd2)

Co-authored-by: Matt Clay <matt@mystile.com>
6 years ago
Matt Clay 2d2c841ded [stable-2.8] Ignore warnings in ansible-test environment check.
(cherry picked from commit 3db1ac4f56)

Co-authored-by: Matt Clay <matt@mystile.com>
6 years ago
Matt Clay 6af5aad3cf [stable-2.8] Add test constraint for setuptools. (#66426)
* Add test constraint for setuptools.

* Update pip test to work on centos6 container.
(cherry picked from commit 51e5b714e0)

Co-authored-by: Matt Clay <matt@mystile.com>
6 years ago
Adam Miller 3edff5d42a Backport/2.8/63713 yum single yum base instantiation 53286 non existent repos (#65575)
* yum - only instantiate YumBase once (#63713)

* yum - only instantiate YumBase once

Previously, this code was re-instantiating the `YumBase` object
many times which is unnecessary and slow. However, we must do it
twice in the `state: absent` case because the `yumSack` and
`rpmSack` data of the previously instantiated object becomes
invalid and is no longer useful post transaction when we verify
that the package removal did in fact take place. Also, this patch
removes the repetitive re-processing of enable/disable of repos in
various places.

Here's a display of the speed increase against a RHEL7 host:

```yaml
- hosts: rhel7
  remote_user: root
  tasks:
  - name: Install generic packages
    yum:
      state: present
      name:
        - iptraf-ng
        - screen
        - erlang
  - name: Remove generic packages
    yum:
      state: absent
      name:
        - iptraf-ng
        - screen
        - erlang
```

Before this patch:
```
real    0m52.728s
user    0m5.645s
sys     0m0.482s
```

After this patch:
```
real    0m17.139s
user    0m3.238s
sys     0m0.277s
```

Fixes #63588
Fixes #63551

Signed-off-by: Adam Miller <admiller@redhat.com>

* add changelog

Signed-off-by: Adam Miller <admiller@redhat.com>

* YUM - handle enable of non-existent repo (#53286)
6 years ago
Kiyo Nagamine 41bddb61b8 Ensure `allow_duplicates: true` enables to run single role multiple times (#64902) (#65063)
* Ensure `allow_duplicates: true` enables to run single role multiple times(#64902)

* Changed return value in `_load_roles` . Fixes #64902

* Add changelog fragment

* Add an integration test for the issue

* Fix changelog generation error and integration test.

* Fix yaml syntax error in changelog fragment

* Fix typo in a changelog fragment of #64902

(cherry picked from commit daecbb9bf0)
(cherry picked from commit 33094e6c8e)
6 years ago
Matt Clay bbbde15562 [stable-2.8] Add ansible-test constraint to avoid coverage 5.0+
(cherry picked from commit 9ea5b539b6)

Co-authored-by: Matt Clay <matt@mystile.com>
6 years ago
Felix Fontein 519846a1be docker_network: fix multiple subnet (of same IP version) idempotence (#65839)
* Fix multiple subnet (of same IP version) idempotence for docker_network.

* Add changelog.

* Unit tests no longer make sense, since the part of the code they test has been removed.

* Re-add CIDR validation. Move it to better position (module setup instead of idempotence check).

* Update changelog.

* Only run new tests on VM test images.

* Actually do what is documented. Especially since an empty object is a valid value for aux_addresses.

(cherry picked from commit 17ef253ad1)
6 years ago
Sam Doran 15a53276aa [stable-2.8] user - honor update_password parameter on BusyBox hosts (#65977)
The check for this parameter was missing from BusyBox.modify_user(), resulting in unexpected password changes to existing user accounts.
(cherry picked from commit 18130e1419)

Co-authored-by: Sam Doran <sdoran@redhat.com>
6 years ago
Hannes Ljungberg 7a55bc1902 docker_swarm_service: Fix parsing of Healthcheck.StartPeriod (#66151)
* Parse Healthcheck.StartPeriod properly

* Add changelog fragment

* Use proper markup in changelog

Co-Authored-By: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f31b8e08b2)
6 years ago
Matt Clay b3a0ccc485 [stable-2.8] Simplify docker_setup on Fedora.
This avoids installing dnf-plugins-core, which breaks the yum and dnf modules
when uninstalling packages using a wildcard after they have already been removed.

This should resolve issues with the yum integration tests failing after docker tests run.
(cherry picked from commit a5c36eedd8)

Co-authored-by: Matt Clay <matt@mystile.com>
6 years ago
Matt Clay 77ce11b21d [stable-2.8] Disable failing azure_rm_storageaccount test.
(cherry picked from commit 342b9953bc)

Co-authored-by: Matt Clay <matt@mystile.com>
6 years ago
Justin Ossevoort d9368e195d [stable-2.8] Fix 'Assert CNAME failure' assertion (#65875)
(cherry picked from commit 14ebceec25)

Co-authored-by: Justin Ossevoort <github@internetionals.nl>
6 years ago
Lukas Kämmerling b1121828c0 [stable-2.8] Fix and reenable hcloud tests.
(cherry picked from commit 5ad61ed7c1)

Co-authored-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
6 years ago