Commit graph

59 commits

Author SHA1 Message Date
Josh Bleecher Snyder
85d1e1a5fc
e2e: make e2e tests runnable on !linux (#651) 2025-08-30 09:59:29 -07:00
Josh Bleecher Snyder
89ab72bee0
all: run gofumpt (#652)
* all: run gofumpt

https://github.com/mvdan/gofumpt

The main appeal for me here is that my (and many other peoples')
editors run this on save, so doing a single diff here
keeps other diffs minimal.

* .github/workflows: add gofumpt checker
2025-08-29 20:04:31 -07:00
Boshi Lian
afd80aa590
fix(docker): enable API version negotiation for Docker client (#607) 2025-06-02 10:24:29 -07:00
Boshi Lian
706a36b40e
feat: Enhance PipeSpec and FromSpec with AuthorizedKeysSecret (#581)
* feat: Enhance PipeSpec and FromSpec with AuthorizedKeysSecret

- Added AuthorizedKeysSecret field to FromSpec for referencing Kubernetes secrets.
- Updated deepcopy functions to handle new AuthorizedKeysSecret field.
- Modified CRD definition to include the new private_key_secret field.
- Refactored fake client and lister implementations to support new fields.
- Introduced shared informers and listers for Pipe resources.
- Updated code generation scripts to reflect changes in API structure.

* refactor: Rename private_key_secret to authorized_keys_secret in CRD schema

* feat: Add support for authorized_keys from secret in skel and update k8sworkload.yaml

* feat: Enhance authorized keys handling to include secret name check

* Update plugin/kubernetes/skel.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-25 03:48:17 -07:00
Boshi Lian
ca311e15cd
refactor: Revise Dockerfile - Remove entrypoint.sh (#598)
* chore: Formatting

* chore: Formatting (fix indent)

* refactor: Remove entrypoint

* chore: Remove `entrypoint.sh` from `.goreleaser.yaml`

* tests: Replace `entrypoint.sh` script usage in `e2eentry.sh`

* Set default plugin argument from environment variable in main function and update Dockerfile to remove CMD instruction

* Add user and group setup for testing in Dockerfile and update e2e entry script

* Update cmd/sshpiperd/main.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update cmd/sshpiperd/main.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Remove test user and group creation from Dockerfile and move it to e2e entry script; update plugin argument handling in main function

* Update Dockerfile

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Skip empty plugin directory entries in main function

---------

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-25 02:11:04 -07:00
Boshi Lian
e6d3bb694b
Add upstream banner mode and refactor banner callbacks (#594)
* feat: add upstream banner mode and refactor banner callbacks

* chore: update crypto submodule to latest commit

* fix: improve usage description for upstream banner mode flag

* Update cmd/sshpiperd/daemon.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-19 12:31:04 -07:00
Boshi Lian
2c2d378f86
Fix linting issues (#595)
* fix lint

* Bump golangci-lint action to v8 and update linting args

* fix lint errors

* fix: correct loop condition in main function to process remaining arguments
2025-05-18 00:59:18 -07:00
Boshi Lian
8ea9eb3f4f
feat: add proxy-read-header-timeout flag for PROXY protocol support (#586)
fix: update go-proxyproto and golang.org/x/net dependencies
2025-05-11 02:20:16 -07:00
Boshi Lian
2603cdfa8b
support handle ping@openssh packet (#582)
* chore: Update dependencies in go.mod and go.sum

* chore: Update submodule commit for crypto

* refactor: Update hook functions to return ssh.PipePackageHookMethod for better integration

* fix: Increase sleep duration in TestFixed to ensure proper execution

* fix: Increase sleep duration in TestFixed to ensure proper file flush

* fix: Update docker-compose service images and modify test to use host-password-old

* refactor: Simplify hook functions to return error instead of PipePackageHookMethod for better error handling

* feat: Add reply-ping flag to enable ping response for compatibility with older sshd

* fix: Update subproject commit reference in crypto
2025-05-08 11:53:40 -07:00
eesaanatluri
95642617d3
fix the username for group routing test case (#558) 2025-04-08 09:12:07 -07:00
eesaanatluri
4fce1dcb45
feat: Decide upstream based on user's unix group membership (#536)
* feat: Decide upstream based on user's unix group membership

If a username is not defined, groupname is parsed. Check if the
user is part of that group and route them to the associated host
defined in the config file for the yaml plugin

* style: fix formatting with gofmt

* feat: Look up user groups only when groupname defined in yaml config

* fix: inefficient assignment because of unused var

* feat: fallback to next rule on group lookup failure

Instead of failing on group lookup errors, the matcher now skips the
groupname rule and proceeds to the next, eventually failing through to
the catchall rule.

* feat: test cases for group based routing in yaml plugin

* Revert "feat: fallback to next rule on group lookup failure"

This reverts commit 622ee9f1eb3157d04f57c068179bb74de8db3a1f.

Handles the error returned by getUserGroups instead of ignoring it,
to prevent potential runtime issues when user lookup fail

* feat: Check if a user is known to the system before group lookup

This will let the rule matching logic skip to the next pipe in the yaml
config when a user is not found on the system.
Note the variable name change from user to username to avoid ambiguity
dur to name collision with os/user package.

* feat: Avoid redundant user lookup

* feat: Improve error handling for user and group lookup failures

* feat: Use appropriate test user name for group routing
2025-04-07 23:53:16 -07:00
Boshi Lian
3757d80348
support proxy banner from upstream (#548)
* remove unused logs

* add banner to server password

* add updated crypto lib

* add test

* refactor: clean up whitespace in banner test

* fix: update test case name to use underscores for consistency
2025-03-20 00:55:03 -07:00
diedpigs
9ff3550786
Feat: fail2ban whitelist (#546)
* feat: support whitelist in failtoban plugin

* test: add e2e test for failtoban ignore ip

* refactor: use netipx for easy contains check
2025-03-15 04:23:09 -07:00
Boshi Lian
b8db060584
fix e2e (#540)
* Update docker-compose.yml

* Update docker-compose.yml and Dockerfile: simplify kind load command and upgrade kind version to v0.27.0

* Comment out Docker installation steps in Dockerfile

* Revert "Comment out Docker installation steps in Dockerfile"

This reverts commit 242e5c638958cb4227d99c85d2cae13214b74513.
2025-03-12 00:54:49 -07:00
Boshi Lian
e96e3f6a3a
Customize sshd with sshd config.d (#525)
* Update OpenSSH server image version and add no penalties configuration

* Refactor SSH configuration paths and update test scripts for public key handling

* Update Docker Compose volumes to remove read-only flag for shared directory

* Remove end-to-end test files and related Docker configuration for CA public cert authentication
2025-02-16 23:19:41 -08:00
Boshi Lian
77e9b2181a
Update Dockerfile to use pre-built OpenSSH binary and fix test reference to SSH binary (#522)
* Update Dockerfile to use pre-built OpenSSH binary and fix test reference to SSH binary

* Add support for multiple SSH binary versions in tests
2025-02-06 01:48:49 -08:00
Boshi Lian
44068f3cea
Update OpenSSH server image to version 9.7_p1-r4-ls184 in docker-compose.yml (#517) 2025-02-04 23:25:34 -08:00
Boshi Lian
085ba59c58
support cross auth type mapping (#483)
* add testcase

* add fix

* Refactor skelpipe wrappers to separate password and private key handling
2024-11-10 03:01:52 -08:00
Boshi Lian
0e6168a6b8
Refactor plugin.proto and pluginbase.go to add support for metadata in connection context (#475)
* Refactor plugin.proto and pluginbase.go to add support for metadata in connection context

* go fmt

* move test plugin out

* Refactor Dockerfile to build test plugin in e2e/testplugin directory

* mv testplugin -> testgrpcplugin

* add test for connection metadata

* enable logging to stdout

* Refactor Dockerfile to build test plugin in e2e/testplugin directory
2024-10-27 23:57:21 -07:00
Boshi Lian
ed19d555b5
add support for ssh ca auth (#467) 2024-10-23 02:41:25 -07:00
Boshi Lian
4db98899f4
YAML Plugin add regex match group (#464)
* add support for match group replace

* update doc
2024-10-20 02:15:46 -07:00
Boshi Lian
39f5eef98b
Refactor YAML schema to support multiple authorized keys and known hosts (#463)
* add coverage for go proxy

* Refactor CLI flag name for allowed proxy addresses

* Refactor YAML schema to support multiple authorized keys and known hosts

* add testcases

* Refactor YAML schema to support multiple authorized keys and known hosts

* go fmt

* go fmt
2024-10-20 00:20:40 -07:00
Boshi Lian
4ad8e77e3f
add test coverage for go proxy (#460)
* add coverage for go proxy

* Refactor CLI flag name for allowed proxy addresses
2024-10-18 13:28:18 -07:00
Daniel Wiegert
538481c33c
update to ssh V9.8.P1 to fix CVE-2024-6387 (#412)
* update to ssh V9.8.P1 to fix CVE-2024-6387

* update to ssh V9.8.P1 to fix CVE-2024-6387
2024-07-11 14:32:38 -07:00
Boshi Lian
305e8164d6
feat: Add test case for publickey_simple_withmultiple_keyfile (#396)
This commit adds a new test case to cover the scenario where multiple key files are used for authentication with the publickey_simple user. It generates a temporary key file and attempts to SSH to the piper server using both the correct and incorrect key files. The test verifies that the correct key file allows the connection and writes a random text to a shared file.
2024-05-30 11:25:35 -07:00
Boshi Lian
6fe67e3f5c
revert partial succ support (#395)
* chore: Update Dockerfile to use golang 1.22-bookworm and install additional dependencies

* revert crypto

* testcase to cover re-mapping to fail
2024-05-30 00:18:35 -07:00
Boshi Lian
fb8eba9f91
fix ping@openssh being passed to unsupported sshd (#326)
* add testcase

* Fix formatting in e2e/fixed_test.go

* disable ping until we have a solution
2024-02-14 22:24:21 -08:00
Boshi Lian
82ac6a5fff
add remote signer api and e2e test of it (#320) 2024-02-11 01:54:55 -08:00
Boshi Lian
9fee039d93
Add PipeCreateErrorCallback to handle pipe creation errors (#290)
* Add PipeCreateErrorCallback to handle pipe creation errors

* Add test for FailtobanPipeCreateFail

* Fix missing newline at end of file in pluginbase.go
2023-12-24 03:54:49 -08:00
Boshi Lian
5a724c6dd3
fix docker plugin encoding (#278) 2023-12-12 11:54:33 -08:00
Boshi Lian
0a0666689c
better compatibility for all version of (#253)
docker and docker-compose
2023-10-25 00:51:59 -07:00
Boshi Lian
b97171bd7b
use ssh-publickey-cert for better naming (#223) 2023-09-10 01:14:18 -07:00
Boshi Lian
65b6b5868d
fix priority (#217)
* fix priority

* fix build
2023-09-03 04:36:40 -07:00
Boshi Lian
694d09affd
support password match/ca publickey for kubernetes (#211)
* add testcase

* refine testcases

* fix tab

* happy ql

* inline timeout

* add ca support for k8s
2023-08-26 18:07:36 -07:00
Matthew Atkinson
13fcc8c0a8
Add support for using CA certs for upstream ssh connection (#210) 2023-08-25 17:32:49 -07:00
Boshi Lian
e13f8e2a40
fix flaky fail to ban (#180) 2023-08-01 16:45:13 -07:00
Boshi Lian
2067fcb003
non return plugin callback now will be triggered together (#162)
* add failtoban plugin

* fmt

* bump ver

* add failtoban e2e

* add readme

* update readme
2023-07-11 01:32:05 -07:00
Boshi Lian
bffa03dde0
update crypto upstream (#161)
* update dep

* go mod tidy

* fix test

* fix flaky test
2023-07-06 23:05:26 -07:00
Boshi Lian
1cd6cd86d9
add callback for pipe start and pipe err (#145)
* add onstart onerr cb

* cover by e2e

* add missing plugin

* happy lint
2023-03-11 03:30:42 -08:00
Boshi Lian
f0e9accbd0 add base64 host key param 2023-03-04 10:20:43 +00:00
Boshi Lian
31738b95b6
add support network hints (#138)
* add support network hints

* add test for multiple network
2023-02-11 01:27:51 -08:00
Boshi Lian
81db4de71f
support kubernetes.io/ssh-auth (#128) 2023-01-07 05:58:44 -08:00
Boshi Lian
740e31dffc
default to ed25519 (#111)
* s/rsa/ed25519/g

* s/rsakey/ed25519key/g

* ed25519 server key
2022-12-09 06:10:49 -08:00
Boshi Lian
01e5a009e0
add banner opt back (#106)
* add banner opt back

* happy lint
2022-11-28 05:56:12 -08:00
Boshi Lian
a3b3caaf6d add custom secret field support 2022-11-05 05:57:07 +00:00
Boshi Lian
61fce7bcd9 fix flaky e2e 2022-10-26 06:08:48 +00:00
Boshi Lian
27b1babbc0 smaller image by keeping k8s and dir plug only 2022-10-25 00:35:45 +00:00
Boshi Lian
cc962457f9 add k8s to e2e 2022-10-24 23:37:38 +00:00
Boshi Lian
319824e564 align log level across plugins
happy lint

happy lint
2022-08-05 23:08:01 +00:00
Boshi Lian
56844d0295 add missing docker e2e test 2022-07-13 23:24:05 +00:00