Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 96cc764

Browse files
authored
Harden SCP/SFTP handling and enhance end-to-end tests with Docker and Ansible
* Add SSH end-to-end testing setup with Ansible and Docker * Add test case for command exit code when file does not exist over SSH * Add ssh test for sudo_commands * Add support for executing relative executable commands over SSH + added tests * Add tests for SFTP and SCP scenarios * Add SSH end-to-end testing job with Docker and Ansible to workflow * Remove pull request branch restriction for workflow triggers * Enhance SCP/SFTP support and tests * Harden SCP/SFTP handling and enhance end-to-end tests with Docker and Ansible * Add more tests * Bump version to 0.11.0rc2
1 parent 4a8912e commit 96cc764

21 files changed

Lines changed: 891 additions & 43 deletions

.github/workflows/pytest.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
push:
88
branches: [ "master" ]
99
pull_request:
10-
branches: [ "master" ]
1110

1211
permissions:
1312
contents: read
@@ -41,3 +40,19 @@ jobs:
4140
- name: Test with pytest
4241
run: |
4342
pytest
43+
44+
ssh-e2e:
45+
name: SSH E2E (Docker + Ansible)
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Run SSH end-to-end tests
52+
run: |
53+
docker compose -f docker-compose.e2e.yml up --build --abort-on-container-exit --exit-code-from ansible-runner ansible-runner
54+
55+
- name: Cleanup SSH E2E stack
56+
if: always()
57+
run: |
58+
docker compose -f docker-compose.e2e.yml down -v --remove-orphans

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Contact: [[email protected]](mailto:[email protected])
88
- Fixed `sudo` handling inside `lshell`.
99
- Added support for configuring session `umask` via `lshell.conf` or CLI, with octal validation.
1010
- Improved `allowed_file_extensions` checks to validate file-like arguments (including option values such as `--include=...`) and reject disallowed or extensionless file operands.
11-
- Included additional bug fixes and test updates.
11+
- Hardened handling for SCP/SFTP while preserving command return codes. Added Docker + Ansible SSH end-to-end tests (SSH/SCP/SFTP/WinSCP paths and policy checks).
1212

1313
### v0.10.10 25/11/2024
1414
- Added path-only completion with completion from allowed paths.

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,18 @@ docker compose up ubuntu_tests debian_tests fedora_tests
235235

236236
This runs `pytest`, `pylint`, and `flake8` in the configured test services.
237237

238+
Run full local validation (including real SSH end-to-end scenarios configured with Ansible):
239+
240+
```bash
241+
just test-all
242+
```
243+
244+
Run only real SSH end-to-end checks:
245+
246+
```bash
247+
just ssh-e2e
248+
```
249+
238250
## Documentation
239251

240252
- `man lshell` (installed)

ansible/inventory.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[lshell_target]
2+
lshell-ssh-target ansible_host=lshell-ssh-target ansible_port=22 ansible_user=root ansible_password=rootpass ansible_connection=ssh ansible_ssh_common_args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'

0 commit comments

Comments
 (0)