aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh/client_test.go
AgeCommit message (Collapse)Author
2026-01-15all: convert license and copyright to use SPDX identifiersShulhan
With help of spdxconv tool [1], we able to bulk update all files license and copyright format to comply with SPDX formats. [1] https://kilabit.info/project/spdxconv/
2024-03-09lib: move package "ssh/config" to "lib/sshconfig"Shulhan
Previously the "ssh/config" is used by the parent package "ssh" and "ssh/sftp" which is break the rule of package layer (the top package should be imported by sub package, not the other way around).
2024-03-02all: move the repository to "git.sr.ht/~shulhan/pakakeh.go"Shulhan
There are several reasons that why we move from github.com. First, related to the name of package. We accidentally name the package with "share" a common word in English that does not reflect the content of repository. By moving to other repository, we can rename it to better and unique name, in this "pakakeh.go". Pakakeh is Minang word for tools, and ".go" suffix indicate that the repository related to Go programming language. Second, supporting open source. The new repository is hosted under sourcehut.org, the founder is known to support open source, and all their services are licensed under AGPL, unlike GitHub that are closed sources. Third, regarding GitHub CoPilot. The GitHub Terms of Service [1], allow any public content that are hosted there granted them to parse the content. On one side, GitHub helps and flourish the open source, but on another side have an issues regarding scraping the copyleft license [2]. [1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us [2]: https://githubcopilotinvestigation.com
2023-12-25ssh/config: add parameter Config to NewSectionShulhan
This changes how the Section and parser initialized. Previously, the Config depends on the parser to set the workDir and homeDir and Section depends on Config only on Get; now its the other way around, from top to bottom. Config initialized first, then parser initialized using Config instance, and then Section initialized also using Config instance.
2023-09-26go.mod: remove replace directive for golang.org/x/cryptoShulhan
Using replace directive does not works well if we install binary using "go install". One of the case that we found is when user installing awwan [1] that use "share" module [2] with replace directive, the binary is not build with git.sr.ht/~shulhan/go-x-crypto. /Users/xxx/go/bin/awwan: go1.21.0 path git.sr.ht/~shulhan/awwan/cmd/awwan mod git.sr.ht/~shulhan/awwan v0.7.1-0.20230925173020-40b9fe9b854c h1:629djcSfqM8ITX+CtgGyrybPnKQPpwJ/EceN967bKps= dep git.sr.ht/~shulhan/asciidoctor-go v0.5.0 h1:TfcAjv+7EwBZ83ef8OhX9vfQ4vRFcaJh0P1XXgbsJv0= dep git.sr.ht/~shulhan/ciigo v0.10.0 h1:s1SJ3/NzBcbOLmEZ4z1Cx9Vf7ZdDIvm45b7KMCZKzEY= dep github.com/evanw/esbuild v0.19.3 h1:foPr0xwQM3lBWKBtscauTN9FrmJzRDVI2+EGOs82H/I= dep github.com/shuLhan/share v0.49.2-0.20230923081600-77c41ce992e6 h1:REQDC2UKLaWT1WGd/Iw/rfKLkXb7vtKtyObkeZeHZRk= dep github.com/yuin/goldmark v1.5.6 h1:COmQAWTCcGetChm3Ig7G/t8AFAN00t+o8Mt4cf7JpwA= dep github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= dep golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= dep golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= dep golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= dep golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= dep gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= build -buildmode=exe build -compiler=gc build DefaultGODEBUG=panicnil=1 build CGO_ENABLED=1 build CGO_CFLAGS= build CGO_CPPFLAGS= build CGO_CXXFLAGS= build CGO_LDFLAGS= build GOARCH=arm64 build GOOS=darwin This changes require use to modify lib/cryto and lib/ssh that depends on our patches. [1] https://git.sr.ht/~shulhan/awwan [2] https://github.com/shuLhan/share/commit/77c41ce992e6
2023-08-29lib/ssh: use UserKnownHostFile from configuration in NewClientInteractiveShulhan
Previously, the ssh Client always use InsecureIgnoreHostKey in HostKeyCallback. This may post security issue, like man-in-the-middle attack, since we did not check the server host key with one of key that known by client from UserKnownHostFile (for example ~/.ssh/known_hosts). This changes use the SSH section UserKnownHostFile from configuration (default to ~/.ssh/known_hosts) to check if the server host key is valid. The NewClientInteractive will return an error, "key is unknown", if host key not exist in UserKnownHostFile or "key is mismatch" if host key not match with one registered in UserKnownHostFile. This changes depends on patch of golang.org/x/crypto [1] that has not reviewed yet, so we need to replace it with one that contains the patch. [1] https://go-review.googlesource.com/c/crypto/+/523555