Skip to content

Commit

Permalink
pkg/atlas: Add ATLAS_API0_SERVERLIST_EXPERIMENTAL_DETERMINISTIC_SERVE…
Browse files Browse the repository at this point in the history
…R_ID_SECRET option
  • Loading branch information
pg9182 committed Oct 22, 2022
1 parent 909794b commit c8462ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/atlas/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ type Config struct {
// it can't be added again without re-verifying).
API0_ServerList_GhostTime time.Duration `env:"ATLAS_API0_SERVERLIST_GHOST_TIME=2m"`

// Experimental option to use deterministic server ID generation based on
// the provided secret and the server info. The secret is used to prevent
// brute-forcing server IDs from the ID and known server info.
API0_ServerList_ExperimentalDeterministicServerIDSecret string `env:"ATLAS_API0_SERVERLIST_EXPERIMENTAL_DETERMINISTIC_SERVER_ID_SECRET"`

// The storage to use for accounts:
// - memory
// - sqlite3:/path/to/atlas.db
Expand Down
4 changes: 3 additions & 1 deletion pkg/atlas/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ func NewServer(c *Config) (*Server, error) {
m.Add(hlog.RequestIDHandler("rid", ""))

s.API0 = &api0.Handler{
ServerList: api0.NewServerList(c.API0_ServerList_DeadTime, c.API0_ServerList_GhostTime, c.API0_ServerList_VerifyTime),
ServerList: api0.NewServerList(c.API0_ServerList_DeadTime, c.API0_ServerList_GhostTime, c.API0_ServerList_VerifyTime, api0.ServerListConfig{
ExperimentalDeterministicServerIDSecret: c.API0_ServerList_ExperimentalDeterministicServerIDSecret,
}),
OriginAuthMgr: configureOrigin(c, s.Logger.With().Str("component", "origin").Logger()),
MaxServers: c.API0_MaxServers,
MaxServersPerIP: c.API0_MaxServersPerIP,
Expand Down

0 comments on commit c8462ef

Please sign in to comment.