Page MenuHomeFreeBSD

D60087.diff
No OneTemporary

D60087.diff

Index: sysutils/ansible-sshjail/Makefile
===================================================================
--- sysutils/ansible-sshjail/Makefile
+++ sysutils/ansible-sshjail/Makefile
@@ -2,7 +2,7 @@
DISTVERSIONPREFIX= v
DISTVERSION= 1.1.0-48
DISTVERSIONSUFFIX= -ga7b0076
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
MAINTAINER= madpilot@FreeBSD.org
Index: sysutils/ansible-sshjail/files/patch-sshjail.py
===================================================================
--- sysutils/ansible-sshjail/files/patch-sshjail.py
+++ sysutils/ansible-sshjail/files/patch-sshjail.py
@@ -6,15 +6,29 @@
Fix errors with ansible 2.19
should fix #45
----
- sshjail.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 50 insertions(+), 2 deletions(-)
-
-diff --git a/sshjail.py b/sshjail.py
-index 3938a5c..b16a9cc 100644
---- sshjail.py
+--- sshjail.py.orig 2025-01-20 16:31:12 UTC
+++ sshjail.py
-@@ -54,6 +54,21 @@
+@@ -8,7 +8,7 @@ from ansible.plugins.connection.ssh import Connection
+ from ansible import __version__ as ansible_version
+ from ansible.errors import AnsibleError
+ from ansible.plugins.connection.ssh import Connection as SSHConnection
+-from ansible.module_utils._text import to_text
++from ansible.module_utils.common.text.converters import to_text
+ from ansible.plugins.loader import get_shell_plugin
+ from contextlib import contextmanager
+
+@@ -16,6 +16,10 @@ MIN_ANSIBLE_VERSION = '2.11.3'
+
+ MIN_ANSIBLE_VERSION = '2.11.3'
+
++# become commands that must be stripped before running inside the jail,
++# as the jail itself usually has neither installed
++BECOME_EXES = ('sudo', 'doas')
++
+ DOCUMENTATION = '''
+ connection: sshjail
+ short_description: connect via ssh client binary to jail
+@@ -54,6 +58,21 @@ DOCUMENTATION = '''
vars:
- name: ansible_password
- name: ansible_ssh_pass
@@ -36,7 +50,7 @@
sshpass_prompt:
description: Password prompt that sshpass should search for. Supported by sshpass 1.06 and up
default: ''
-@@ -225,7 +240,30 @@
+@@ -225,7 +244,30 @@ DOCUMENTATION = '''
vars:
- name: ansible_private_key_file
- name: ansible_ssh_private_key_file
@@ -68,7 +82,7 @@
control_path:
description:
- This is the location to save ssh's ControlPath sockets, it uses ssh's variable substitution.
-@@ -302,7 +340,6 @@
+@@ -302,7 +344,6 @@ DOCUMENTATION = '''
default: ''
description:
- PKCS11 SmartCard provider such as opensc, example: /usr/local/lib/opensc-pkcs11.so
@@ -76,7 +90,7 @@
env: [{name: ANSIBLE_PKCS11_PROVIDER}]
ini:
- {key: pkcs11_provider, section: ssh_connection}
-@@ -329,6 +366,17 @@
+@@ -329,6 +370,17 @@ DOCUMENTATION = '''
cli:
- name: timeout
type: integer
@@ -94,3 +108,21 @@
'''
try:
+@@ -422,7 +474,7 @@ class Connection(ConnectionBase):
+
+ # to do this, we peel back successive command invocations
+ words = shlex.split(cmd)
+- while words[0] == executable or words[0] == 'sudo':
++ while words[0] == executable or words[0] in BECOME_EXES:
+ cmd = words[-1]
+ words = shlex.split(cmd)
+
+@@ -454,7 +506,7 @@ class Connection(ConnectionBase):
+ slpcmd = True
+ cmd = self._strip_sleep(cmd)
+
+- if 'sudo' in cmd:
++ if any(exe in cmd for exe in BECOME_EXES):
+ cmd = self._strip_sudo(executable, cmd)
+
+ self.set_option('host', self.host)

File Metadata

Mime Type
text/plain
Expires
Wed, Sep 30, 6:11 AM (9 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39899354
Default Alt Text
D60087.diff (3 KB)

Event Timeline