podman/vendor/github.com/pkg/sftp
Charlie Doern 280f5d8cb0 podman ssh work, using new c/common interface
implement new ssh interface into podman

this completely redesigns the entire functionality of podman image scp,
podman system connection add, and podman --remote. All references to golang.org/x/crypto/ssh
have been moved to common as have native ssh/scp execs and the new usage of the sftp package.

this PR adds a global flag, --ssh to podman which has two valid inputs `golang` and `native` where golang is the default.
Users should not notice any difference in their everyday workflows if they continue using the golang option. UNLESS they have been using an improperly verified ssh key, this will now fail. This is because podman was incorrectly using the
ssh callback method to IGNORE the ssh known hosts file which is very insecure and golang tells you not yo use this in production.

The native paths allows for immense flexibility, with a new containers.conf field `SSH_CONFIG` that specifies a specific ssh config file to be used in all operations. Else the users ~/.ssh/config file will be used.
podman --remote currently only uses the golang path, given its deep interconnection with dialing multiple clients and urls.

My goal after this PR is to go back and abstract the idea of podman --remote from golang's dialed clients, as it should not be so intrinsically connected. Overall, this is a v1 of a long process of offering native ssh, and one that covers some good ground with podman system connection add and podman image scp.

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-08-09 14:00:58 -04:00
..
internal/encoding/ssh/filexfer podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
.gitignore podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
CONTRIBUTORS podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
LICENSE podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
Makefile podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
README.md podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
allocator.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
attrs.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
attrs_stubs.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
attrs_unix.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
client.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
conn.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
debug.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
fuzz.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
go.mod podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
go.sum podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
ls_formatting.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
ls_plan9.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
ls_stub.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
ls_unix.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
match.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
packet-manager.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
packet-typing.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
packet.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
pool.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
release.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
request-attrs.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
request-errors.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
request-example.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
request-interfaces.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
request-plan9.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
request-readme.md podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
request-server.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
request-unix.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
request.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
request_windows.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
server.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
server_statvfs_darwin.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
server_statvfs_impl.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
server_statvfs_linux.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
server_statvfs_plan9.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
server_statvfs_stubs.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
sftp.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
stat_plan9.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
stat_posix.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
syscall_fixed.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00
syscall_good.go podman ssh work, using new c/common interface 2022-08-09 14:00:58 -04:00

README.md

sftp

The sftp package provides support for file system operations on remote ssh servers using the SFTP subsystem. It also implements an SFTP server for serving files from the filesystem.

CI Status Go Reference

usage and examples

See https://pkg.go.dev/github.com/pkg/sftp for examples and usage.

The basic operation of the package mirrors the facilities of the os package.

The Walker interface for directory traversal is heavily inspired by Keith Rarick's fs package.

roadmap

  • There is way too much duplication in the Client methods. If there was an unmarshal(interface{}) method this would reduce a heap of the duplication.

contributing

We welcome pull requests, bug fixes and issue reports.

Before proposing a large change, first please discuss your change by raising an issue.

For API/code bugs, please include a small, self contained code example to reproduce the issue. For pull requests, remember test coverage.

We try to handle issues and pull requests with a 0 open philosophy. That means we will try to address the submission as soon as possible and will work toward a resolution. If progress can no longer be made (eg. unreproducible bug) or stops (eg. unresponsive submitter), we will close the bug.

Thanks.