Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cmd/sanssh/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func init() {
// to run a sansssh command.
type RunState struct {
// Proxy is an optional proxy server to route requests.
Proxy string
Proxy string
ProxyAuthorityOverride string
// Targets is a list of remote targets to use when a proxy
// is in use. For non proxy must be 1 entry.
Targets []string
Expand Down Expand Up @@ -285,6 +286,10 @@ func Run(ctx context.Context, rs RunState) {
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(16 * 1024 * 1024)),
}

if rs.Proxy != "" && rs.ProxyAuthorityOverride != "" {
ops = append(ops, grpc.WithAuthority(rs.ProxyAuthorityOverride))
}

if rs.PerRPCCredentials != nil {
ops = append(ops, grpc.WithPerRPCCredentials(rs.PerRPCCredentials))
}
Expand Down
24 changes: 13 additions & 11 deletions cmd/sanssh/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ var (
%s in the environment can also be set instead of setting this flag. The flag will take precedence.
If blank a direct connection to the first entry in --targets will be made.
If port is blank the default of %d will be used`, proxyEnv, defaultProxyPort))
proxyAuthorityOverride = flag.String("proxy-authority-override", "", "Authority override to use when dialing the proxy (passed to grpc.WithAuthority when set)")
// Deprecated: --timeout flag is deprecated. Use --idle-timeout or --dial-timeout instead
_ = flag.Duration("timeout", defaultDialTimeout, "DEPRECATED. Please use --idle-timeout or --dial-timeout instead")
dialTimeout = flag.Duration("dial-timeout", defaultDialTimeout, "How long to wait for the connection to be accepted. Timeout specified in --targets or --proxy will take precedence")
Expand Down Expand Up @@ -209,17 +210,18 @@ func main() {
}

rs := client.RunState{
Proxy: *proxyAddr,
Targets: *targetsFlag.Target,
Outputs: *outputsFlag.Target,
AuthzDryRun: *authzDryRun,
OutputsDir: *outputsDir,
CredSource: *credSource,
IdleTimeout: *idleTimeout,
ClientAuthzPolicy: clientPolicy,
PrefixOutput: *prefixHeader,
BatchSize: *batchSize,
EnableMPA: *mpa,
Proxy: *proxyAddr,
ProxyAuthorityOverride: *proxyAuthorityOverride,
Targets: *targetsFlag.Target,
Outputs: *outputsFlag.Target,
AuthzDryRun: *authzDryRun,
OutputsDir: *outputsDir,
CredSource: *credSource,
IdleTimeout: *idleTimeout,
ClientAuthzPolicy: clientPolicy,
PrefixOutput: *prefixHeader,
BatchSize: *batchSize,
EnableMPA: *mpa,
}

if *justification != "" {
Expand Down
Loading