-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/server, cmd/linksharing: support specifying uplink client identities
this change allows the gateway and linksharing processes to specify stable uplink client identities. this is important so that different gateway regions can get different choice-of-two load balancing profiles, and other benefits of satellite-trusted uplinks. we intend that all gateways and linksharing services within a single region use the same identity. note that the linksharing process already has an identity called the TierServiceIdentity, where it asks the Satellite for tier services using that identity. If that identity is also different between regions and the same within a region, it is fine to reuse that identity for this as part of the configuration. a future patch set could simplify the configuration so only one is necessary to configure Change-Id: If2942af0907126d1c91578d61af6cad43c13c69b
- Loading branch information
Showing
10 changed files
with
81 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (C) 2024 Storj Labs, Inc. | ||
// See LICENSE for copying information. | ||
|
||
package uplinkutil | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/zeebo/errs" | ||
) | ||
|
||
// IdentityConfig is an intentional copy of identity.Config that has | ||
// empty defaults. | ||
type IdentityConfig struct { | ||
CertPath string `help:"path to the certificate chain for this identity" default:"" user:"true" path:"true"` | ||
KeyPath string `help:"path to the private key for this identity" default:"" user:"true" path:"true"` | ||
} | ||
|
||
// LoadPEMs loads files and returns their byte strings if set. A possible | ||
// return value of this function is nil, nil, nil. | ||
func (c *IdentityConfig) LoadPEMs() (certPEM, keyPEM []byte, err error) { | ||
if c.CertPath == "" && c.KeyPath == "" { | ||
return nil, nil, nil | ||
} | ||
if c.CertPath == "" || c.KeyPath == "" { | ||
return nil, nil, errs.New("only one of key path and cert path are set (%q, %q)", c.KeyPath, c.CertPath) | ||
} | ||
certPEM, err = os.ReadFile(c.CertPath) | ||
if err != nil { | ||
return nil, nil, errs.New("failed reading cert path %q: %+v", c.CertPath, err) | ||
} | ||
keyPEM, err = os.ReadFile(c.KeyPath) | ||
if err != nil { | ||
return nil, nil, errs.New("failed reading key path %q: %+v", c.KeyPath, err) | ||
} | ||
return certPEM, keyPEM, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters