mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-05-09 18:23:21 +08:00
support custom Ciphers value
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
9e205a756f
commit
9c9e7914ce
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module github.com/appleboy/drone-ssh
|
|||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/appleboy/easyssh-proxy v1.3.1
|
github.com/appleboy/easyssh-proxy v1.3.3
|
||||||
github.com/joho/godotenv v1.3.0
|
github.com/joho/godotenv v1.3.0
|
||||||
github.com/stretchr/testify v1.3.0
|
github.com/stretchr/testify v1.3.0
|
||||||
github.com/urfave/cli v1.22.4
|
github.com/urfave/cli v1.22.4
|
||||||
|
4
go.sum
4
go.sum
@ -1,8 +1,8 @@
|
|||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/ScaleFT/sshkeys v0.0.0-20181112160850-82451a803681 h1:JS2rl38kZmHgWa0xINSaSYH0Whtvem64/4+Ef0+Y5pE=
|
github.com/ScaleFT/sshkeys v0.0.0-20181112160850-82451a803681 h1:JS2rl38kZmHgWa0xINSaSYH0Whtvem64/4+Ef0+Y5pE=
|
||||||
github.com/ScaleFT/sshkeys v0.0.0-20181112160850-82451a803681/go.mod h1:WfDateMPQ/55dPbZRp5Zxrux5WiEaHsjk9puUhz0KgY=
|
github.com/ScaleFT/sshkeys v0.0.0-20181112160850-82451a803681/go.mod h1:WfDateMPQ/55dPbZRp5Zxrux5WiEaHsjk9puUhz0KgY=
|
||||||
github.com/appleboy/easyssh-proxy v1.3.1 h1:zj5u800KIRPziMlJouhd2R6jufz6ihGlFSmojzXYSOw=
|
github.com/appleboy/easyssh-proxy v1.3.3 h1:x++oaFLft5hWjAli7IgALQr+OwrzmXzHmLdPrjTRE2w=
|
||||||
github.com/appleboy/easyssh-proxy v1.3.1/go.mod h1:Kk57I3w7OCafOjp5kgZFvxk2fO8Tca5CriBTOsbSbjY=
|
github.com/appleboy/easyssh-proxy v1.3.3/go.mod h1:Kk57I3w7OCafOjp5kgZFvxk2fO8Tca5CriBTOsbSbjY=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
|
9
main.go
9
main.go
@ -19,7 +19,7 @@ func main() {
|
|||||||
if filename, found := os.LookupEnv("PLUGIN_ENV_FILE"); found {
|
if filename, found := os.LookupEnv("PLUGIN_ENV_FILE"); found {
|
||||||
_ = godotenv.Load(filename)
|
_ = godotenv.Load(filename)
|
||||||
}
|
}
|
||||||
|
defaultCiphers := cli.StringSlice{"aes128-ctr", "aes192-ctr", "aes256-ctr", "aes128-gcm@openssh.com", "arcfour256", "arcfour128", "aes128-cbc", "3des-cbc"}
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "Drone SSH"
|
app.Name = "Drone SSH"
|
||||||
app.Usage = "Executing remote ssh commands"
|
app.Usage = "Executing remote ssh commands"
|
||||||
@ -59,6 +59,12 @@ func main() {
|
|||||||
Usage: "user password",
|
Usage: "user password",
|
||||||
EnvVar: "PLUGIN_PASSWORD,SSH_PASSWORD,PASSWORD,INPUT_PASSWORD",
|
EnvVar: "PLUGIN_PASSWORD,SSH_PASSWORD,PASSWORD,INPUT_PASSWORD",
|
||||||
},
|
},
|
||||||
|
cli.StringSliceFlag{
|
||||||
|
Name: "ciphers",
|
||||||
|
Usage: "The allowed cipher algorithms. If unspecified then a sensible",
|
||||||
|
EnvVar: "PLUGIN_CIPHERS,SSH_CIPHERS,CIPHERS,INPUT_CIPHERS",
|
||||||
|
Value: &defaultCiphers,
|
||||||
|
},
|
||||||
cli.StringSliceFlag{
|
cli.StringSliceFlag{
|
||||||
Name: "host,H",
|
Name: "host,H",
|
||||||
Usage: "connect to host",
|
Usage: "connect to host",
|
||||||
@ -216,6 +222,7 @@ func run(c *cli.Context) error {
|
|||||||
Envs: c.StringSlice("envs"),
|
Envs: c.StringSlice("envs"),
|
||||||
Debug: c.Bool("debug"),
|
Debug: c.Bool("debug"),
|
||||||
Sync: c.Bool("sync"),
|
Sync: c.Bool("sync"),
|
||||||
|
Ciphers: c.StringSlice("ciphers"),
|
||||||
Proxy: easyssh.DefaultConfig{
|
Proxy: easyssh.DefaultConfig{
|
||||||
Key: c.String("proxy.ssh-key"),
|
Key: c.String("proxy.ssh-key"),
|
||||||
KeyPath: c.String("proxy.key-path"),
|
KeyPath: c.String("proxy.key-path"),
|
||||||
|
@ -38,6 +38,7 @@ type (
|
|||||||
Proxy easyssh.DefaultConfig
|
Proxy easyssh.DefaultConfig
|
||||||
Debug bool
|
Debug bool
|
||||||
Sync bool
|
Sync bool
|
||||||
|
Ciphers []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin structure
|
// Plugin structure
|
||||||
@ -62,6 +63,7 @@ func (p Plugin) exec(host string, wg *sync.WaitGroup, errChannel chan error) {
|
|||||||
KeyPath: p.Config.KeyPath,
|
KeyPath: p.Config.KeyPath,
|
||||||
Passphrase: p.Config.Passphrase,
|
Passphrase: p.Config.Passphrase,
|
||||||
Timeout: p.Config.Timeout,
|
Timeout: p.Config.Timeout,
|
||||||
|
Ciphers: p.Config.Ciphers,
|
||||||
Proxy: easyssh.DefaultConfig{
|
Proxy: easyssh.DefaultConfig{
|
||||||
Server: p.Config.Proxy.Server,
|
Server: p.Config.Proxy.Server,
|
||||||
User: p.Config.Proxy.User,
|
User: p.Config.Proxy.User,
|
||||||
@ -71,6 +73,7 @@ func (p Plugin) exec(host string, wg *sync.WaitGroup, errChannel chan error) {
|
|||||||
KeyPath: p.Config.Proxy.KeyPath,
|
KeyPath: p.Config.Proxy.KeyPath,
|
||||||
Passphrase: p.Config.Proxy.Passphrase,
|
Passphrase: p.Config.Proxy.Passphrase,
|
||||||
Timeout: p.Config.Proxy.Timeout,
|
Timeout: p.Config.Proxy.Timeout,
|
||||||
|
Ciphers: p.Config.Ciphers,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user