cloudfoundry / socks5-proxy

This is a go library for starting a socks5 proxy server via SSH
https://cloudfoundry.org
Apache License 2.0
52 stars 21 forks source link

let user pass in ssh.authMethod #14

Closed isaaguilar closed 3 years ago

isaaguilar commented 5 years ago

This would allow the user to define their own mechanism to get the authMethod of their choice. Passing in a key string felt a little strange. Instead, the user can pass in a private key method, a password, etc.

I understand will break implementations of the module.

cfdreddbot commented 5 years ago

:x: Hey isaaguilar!

All pull request submitters and commit authors must have a Contributor License Agreement (CLA). Click here for details on the CLA process.

The following github user @isaaguilar is not covered by a CLA.

After the CLA process is complete, this pull request will need to be closed & reopened. DreddBot will then validate the CLA(s).

cfdreddbot commented 5 years ago

:white_check_mark: Hey isaaguilar! The commit authors and yourself have already signed the CLA.

chinhtrandn commented 5 years ago

This would allow the user to define their own mechanism to get the authMethod of their choice. Passing in a key string felt a little strange. Instead, the user can pass in a private key method, a password, etc.

I understand will break implementations of the module.

I need document to use this project. Can you help me? thank

isaaguilar commented 5 years ago

@chinhtrandn Here's what I'm doing with this project right now.

I'm using it to set an httpClient up like the following:

// socks5 "github.com/isaaguilar/socks5-proxy"
// "github.com/elliotchance/sshtunnel"

// proxyUser := "root"
// proxyServer := "1.2.3.4"
// sshKeyFile := "~/.ssh/id_rsa"

// Set up the authMethod (I'm uing elliots's sshtunnel)
auth := sshtunnel.PrivateKeyFile(sshKeyFile)

// Next I set up the socks5-proxy configs
err = socks5Proxy.Start(proxyUser, proxyServer, auth)
if err != nil {
    log.Fatal(err)
}
time.Sleep(100 * time.Millisecond)

socks5Addr, err := socks5Proxy.Addr()
if err != nil {
    log.Fatal(err)
}

// Get the dialer and get an httpClient to use
dialer, err := proxy.SOCKS5("tcp", socks5Addr, nil, proxy.Direct)
if err != nil {
    log.Fatal(err)
}
httpTransport := &http.Transport{Dial: dialer.Dial}
httpClient := &http.Client{Transport: httpTransport}
rowanjacobs commented 5 years ago

Can I ask some questions about the purpose of this PR? Are you using this repo as a library in your own code, or are you hoping to modify the behavior of one or both CLIs (BOSH CLI and CredHub CLI) that rely on it?

For reference, this library was developed for inclusion into the BOSH CLI as part of the bosh-bootloader (bbl) workflow, which deploys a jumpbox VM with a public IP address and a separate BOSH director VM with no public IP. In order to access the BOSH director with the BOSH CLI, bbl used to open a socks5 proxy through the jumpbox. This was agreed to be the responsibility of the BOSH CLI instead, and so now the BOSH CLI uses this library to open the socks5 proxy. The bbl-deployed jumpbox only uses private key authentication, using a key that is randomly generated at deploy time. As a result, the BOSH and CredHub CLIs currently have no need of other authentication methods in order to reach a bbl-deployed VM. However, if someone such as yourself wants to use this repo outside of the bbl workflow (e.g. proxying through a manually deployed VM) or outside of BOSH itself, I understand that this can be quite limiting.

isaaguilar commented 5 years ago

@rowanjacobs socks5-proxy fit a personal project I'm working on. In my project, the auth method could be a password, a key, or really any AuthMethod that works. This PR is just to share some changes that I thought would be improvements I made to suit my needs.

rowanjacobs commented 5 years ago

Thanks for the clarification! As one of the original authors, I'm glad you're getting use out of this repository and working to improve it. Unfortunately, it's practically unmaintained now, and it would probably be extra work for the teams that rely on it to specify the auth method. So I think it's unlikely that this will be merged :/

bosh-admin-bot commented 3 years ago

This pull request was marked as Stale because it has been open for 21 days without any activity. If no activity takes place in the coming 7 days it will automatically be close. To prevent this from happening remove the Stale label or comment below.

bosh-admin-bot commented 3 years ago

This pull request was closed because it has been labeled Stale for 7 days without subsequent activity. Feel free to re-open this pull request at any time by commenting below.