Skip to content

Commit cc35c73

Browse files
committed
feat: expand proxy configuration with new flags and env support
- Add multiple new proxy-related flags, including protocol, username, password, SSH key, key path, SSH passphrase, connection timeout, ciphers, use of insecure ciphers, and fingerprint - Enable proxy configuration using environment variables for each new flag - Set default values for several proxy options (e.g., protocol defaults to tcp, username defaults to root) Signed-off-by: appleboy <[email protected]>
1 parent e8f6afd commit cc35c73

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

main.go

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,58 @@ func main() {
147147
EnvVars: []string{"PLUGIN_PROXY_PORT", "PROXY_SSH_PORT", "INPUT_PROXY_PORT"},
148148
Value: "22",
149149
},
150-
// ... rest of proxy settings remain unchanged ...
150+
&cli.StringFlag{
151+
Name: "proxy.protocol",
152+
Usage: "The IP protocol to use for the proxy. Valid values are \"tcp\". \"tcp4\" or \"tcp6\". Default to tcp.",
153+
EnvVars: []string{"PLUGIN_PROXY_PROTOCOL", "SSH_PROXY_PROTOCOL", "INPUT_PROXY_PROTOCOL"},
154+
Value: "tcp",
155+
},
156+
&cli.StringFlag{
157+
Name: "proxy.username",
158+
Usage: "connect as user of proxy",
159+
EnvVars: []string{"PLUGIN_PROXY_USERNAME", "PLUGIN_PROXY_USER", "PROXY_SSH_USERNAME", "INPUT_PROXY_USERNAME"},
160+
Value: "root",
161+
},
162+
&cli.StringFlag{
163+
Name: "proxy.password",
164+
Usage: "user password of proxy",
165+
EnvVars: []string{"PLUGIN_PROXY_PASSWORD", "PROXY_SSH_PASSWORD", "INPUT_PROXY_PASSWORD"},
166+
},
167+
&cli.StringFlag{
168+
Name: "proxy.ssh-key",
169+
Usage: "private ssh key of proxy",
170+
EnvVars: []string{"PLUGIN_PROXY_SSH_KEY", "PLUGIN_PROXY_KEY", "PROXY_SSH_KEY", "INPUT_PROXY_KEY"},
171+
},
172+
&cli.StringFlag{
173+
Name: "proxy.ssh-passphrase",
174+
Usage: "The purpose of the passphrase is usually to encrypt the private key.",
175+
EnvVars: []string{"PLUGIN_PROXY_SSH_PASSPHRASE", "PLUGIN_PROXY_PASSPHRASE", "PROXY_SSH_PASSPHRASE", "INPUT_PROXY_PASSPHRASE"},
176+
},
177+
&cli.StringFlag{
178+
Name: "proxy.key-path",
179+
Usage: "ssh private key path of proxy",
180+
EnvVars: []string{"PLUGIN_PROXY_KEY_PATH", "PROXY_SSH_KEY_PATH", "INPUT_PROXY_KEY_PATH"},
181+
},
182+
&cli.DurationFlag{
183+
Name: "proxy.timeout",
184+
Usage: "proxy connection timeout",
185+
EnvVars: []string{"PLUGIN_PROXY_TIMEOUT", "PROXY_SSH_TIMEOUT", "INPUT_PROXY_TIMEOUT"},
186+
},
187+
&cli.StringSliceFlag{
188+
Name: "proxy.ciphers",
189+
Usage: "The allowed cipher algorithms. If unspecified then a sensible",
190+
EnvVars: []string{"PLUGIN_PROXY_CIPHERS", "PROXY_SSH_CIPHERS", "INPUT_PROXY_CIPHERS"},
191+
},
192+
&cli.BoolFlag{
193+
Name: "proxy.useInsecureCipher",
194+
Usage: "include more ciphers with use_insecure_cipher",
195+
EnvVars: []string{"PLUGIN_PROXY_USE_INSECURE_CIPHER", "PROXY_SSH_USE_INSECURE_CIPHER", "INPUT_PROXY_USE_INSECURE_CIPHER"},
196+
},
197+
&cli.StringFlag{
198+
Name: "proxy.fingerprint",
199+
Usage: "fingerprint SHA256 of the host public key, default is to skip verification",
200+
EnvVars: []string{"PLUGIN_PROXY_FINGERPRINT", "PROXY_SSH_FINGERPRINT", "PROXY_FINGERPRINT", "INPUT_PROXY_FINGERPRINT"},
201+
},
151202
&cli.IntFlag{
152203
Name: "strip.components",
153204
Usage: "Strip N leading components from file paths",

0 commit comments

Comments
 (0)