Commit Graph

151 Commits (34088a8b7f89f1eac158fa395c410395d677bb0f)

Author SHA1 Message Date
Jonathan Rosser 0bd3c6cba5 Fix AnsibleUnsafeText when copying files larger than SMALL_FILE_LIMIT
Small files are carried in-band in the communication between
controller and remote, with larger files being copied by falling back
to a more traditional ansible put_file mechanism. This large
file code path was missed in b822f20.
3 months ago
Philippe Kueck ec05e542b4
Fix 'ansible_host_key_checking' and 'ansible_ssh_host_key_checking' for
adding new hosts to the inventory using 'add_hosts'

Co-authored-by: Alex Willmer <alex@moreati.org.uk>
7 months ago
Alex Willmer b822f20007 ansible_mitogen: Handle AnsibleUnsafeText et al in Ansible >= 7
Follwing fixes in Ansible 7-9 for CVE-2023-5764 cating `AnsibleUnsafeBytes` &
`AnsibleUnsafeText` to `bytes()` or `str()` requires special handling. The
handling is Ansible specific, so it shouldn't go in the mitogen package but
rather the ansible_mitogen package.

`ansible_mitogen.utils.unsafe.cast()` is most like `mitogen.utils.cast()`.
During development it began as `ansible_mitogen.utils.unsafe.unwrap_var()`,
closer to an inverse of `ansible.utils.unsafe_procy.wrap_var()`. Future
enhancements may move in this direction.

refs #977, refs #1046

See also
- https://github.com/advisories/GHSA-7j69-qfc3-2fq9
- https://github.com/ansible/ansible/pull/82293
- https://github.com/mitogen-hq/mitogen/wiki/AnsibleUnsafe-notes
8 months ago
Alex Willmer 0af2ce8c30 Remove ansible_mitogen Connection.close() workaround
Refs #925 #969

I'm not 100% confident that merely removing this is the full fix,
without substituting something else. I am sure keeping it would be
the greater of two evils. __del__() should be avoided on general
principal, and it's associated with multiple intermittant CI
failures, plus multiple user reported issues.
2 years ago
Alex Willmer 31b3a4eb4a ansible_mitogen: Standardise __future__ imports to match Ansible
Some modules additionally enable unicode_literals (which Ansible doesn't do).
I've chosen not to change that, for now.
3 years ago
Alex Willmer 109feec6d5 Fix lints found by flake8 3 years ago
Alex Willmer 18c89de5a9 Remove unused module imports 3 years ago
Alex Willmer 96e20a09d6 ansible_mitogen: Add podman connection plugin 3 years ago
Steven Robertson c959ce010b created temp action obj for 'meta: reset_connection' python interpreter discovery 5 years ago
Steven Robertson 5b8c9da769 _execute_meta doesn't have an Action nooooo this breaks 'meta: reset_connection' because interpreter_discovery needs an Action 5 years ago
Steven Robertson 33e7d0804f fixed tests, and removed the action hack code 5 years ago
Steven Robertson 7d6d76e444 trying to get docker rhel8 working on a Mac host 5 years ago
Steven Robertson cf1c3aac1c fix typo 5 years ago
Steven Robertson ba350aa6cf assigned interpreter vars to the wrong class 5 years ago
Steven Robertson 496d96c01a need to convert to str because of unicode_literals 5 years ago
Steven Robertson aa0ad5ce8f accidentally broke discovery 5 years ago
Steven Robertson 160dbd86b4 keeping track of interpreter discovery vars in case of ansible < 2.8 5 years ago
Steven Robertson f10fb7d486 more test cases pass 5 years ago
Steven Robertson 19ba2417c8 now able to get the action object, but recursion error in low_level_exec_command 5 years ago
Steven Robertson 806651e112 working on ansible discovery; need to fix passing ActionModuleMixin reference still 5 years ago
Steven Robertson d64adb15d7 reverted autolinted code 5 years ago
Steven Robertson e8f3154cab Merge branch 'master' into complexAnsiblePythonInterpreterArg 5 years ago
David Wilson d6329f3446 Merge devel/290 @ 79b979ec8544ef5d8620c64068d4a42fabf50415 5 years ago
Steven Robertson 4669c8774f handles templating ansible_python_interpreter values 5 years ago
David Wilson efd82dd35a issue #633: various task_vars fixes
- take host_vars from task_vars too
- make missing task_vars a hard error
- update tests to provide stub task_vars
5 years ago
David Wilson fc09b81949 issue #633: handle meta: reset_connection when become is active
- don't create a new connection during reset if no existing connection
  exists
- strip off last hop in connection stack if PlayContext.become is True.
- log a debug message if reset cannot find an existing connection
5 years ago
David Wilson b6d1df749c issue #633: take inventory_hostname from task_vars
It used to be set by on_action_run() from task_vars, but this doesn't
work for meta: reset_connection. That meant MITOGEN_CPU_COUNT>1 would
pick the wrong mux to reset the connection on.
5 years ago
David Wilson 151b490890 issue #615: fetch_file() might be called with AnsibleUnicode. 5 years ago
David Wilson 5af6c9b26f issue #615: use FileService for target->controll file transfers 5 years ago
David Wilson 33bceb6eb4 issue #602: recover task_vars for synchronize and meta: reset_connection 5 years ago
David Wilson 619f4dee07 [linear2] merge fallout: restore optimization from #491 / 7b129e857 5 years ago
David Wilson 75d179e4b9 remove unused imports flagged by lgtm 5 years ago
David Wilson 108015aa22 ansible: gracefully handle failure to connect to MuxProcess
It's possible to hit an ugly exception during early CTRL+C
5 years ago
David Wilson 136dee1fb4 [linear2] more merge fallout, fix Connection._mitogen_reset(mode=) 5 years ago
David Wilson 9035884c77 ansible: abstract worker process model.
Move all details of broker/router setup out of connection.py, instead
deferring it to a WorkerModel class exported by process.py via
get_worker_model(). The running strategy can override the configured
worker model via _get_worker_model().

ClassicWorkerModel is installed by default, which implements the
extension's existing process model.

Add optional support for the third party setproctitle module, so
children have pretty names in ps output.

Add optional support for per-CPU multiplexers to classic runs.
5 years ago
Jordan Webb 1a02a86331
Add buildah transport 6 years ago
David Wilson 3620fce071 issue #593: expose configurables for SSH keepalive and increase the default 6 years ago
David Wilson f35194fe0f issue #587: mitogen_doas should not become_exe for doas_path
Looks like this has always been wrong - when used as a connection
method, PlayContext.become_method/become_exe may hold totally unrelated
data.
6 years ago
David Wilson f30a4c05c8 issue #581: expose mitogen_mask_remote_name variable. 6 years ago
David Wilson 7743e57ff3 issue #554: track and remove multiple make_tmp_path() calls. 6 years ago
David Wilson 26e6194d0a issue #548: always treat transport=smart as 'ssh' for mitogen_via=.
The idea behind transport=smart is to select between paramiko and
OpenSSH given the availability of connection multiplexing and/or OSX
kernel bugs. We need to make no such choice.
6 years ago
David Wilson 1f77d24bec Update copyright year everywhere. 6 years ago
David Wilson d1cadf8ac8 tests/ansible: Spec.password() test, document interactive pw limitation. 6 years ago
David Wilson 604b418412 ansible: fix a crash on 2.3 when mitogen_via= host is missing. 6 years ago
David Wilson b89e53fd70 ansible: raise error with correct exception type. 6 years ago
David Wilson 7badb4a25b ansible: hacky parser to alow bools to be specified on command line 6 years ago
David Wilson b499fbe29b ansible: add mitogen_ssh_compression variable. 6 years ago
David Wilson 7b129e8576 ansible: use Poller for WorkerProcess; closes #491. 6 years ago
David Wilson a1121c5a84 issue #499: respect C.BECOME_ALLOW_SAME_USER. 6 years ago
David Wilson 38a553d42d issue #490: prevent double close() destroying unrelated Connection. 6 years ago