Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a config option to disable writing keyring to a file #472

Merged
merged 2 commits into from
Jun 14, 2017
Merged
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
3 changes: 2 additions & 1 deletion cmd/serf/command/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ type Config struct {
EncryptKey string `mapstructure:"encrypt_key"`

// KeyringFile is the path to a file containing a serialized keyring.
// The keyring is used to facilitate encryption.
// The keyring is used to facilitate encryption. If left blank, the
// keyring will not be persisted to a file.
KeyringFile string `mapstructure:"keyring_file"`

// LogLevel is the level of the logs to output.
Expand Down
10 changes: 6 additions & 4 deletions serf/internal_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,12 @@ func (s *serfQueries) handleInstallKey(q *Query) {
goto SEND
}

if err := s.serf.writeKeyringFile(); err != nil {
response.Message = err.Error()
s.logger.Printf("[ERR] serf: Failed to write keyring file: %s", err)
goto SEND
if s.serf.config.KeyringFile != "" {
if err := s.serf.writeKeyringFile(); err != nil {
response.Message = err.Error()
s.logger.Printf("[ERR] serf: Failed to write keyring file: %s", err)
goto SEND
}
}

response.Result = true
Expand Down
5 changes: 3 additions & 2 deletions website/source/docs/agent/options.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ The options below are all specified on the command-line.
than one encryption key until all members have received the new key. The
keyring file helps persist changes to the encryption keyring, allowing the
agent to start and rejoin the cluster successfully later on, even if key
rotations had been initiated by other members in the cluster. More information
on the format of the keyring file can be found below in the examples section.
rotations had been initiated by other members in the cluster. If left blank, the
keyring will not be persisted to a file. More information on the format of the
keyring file can be found below in the examples section.

NOTE: this option is not compatible with the `-encrypt` option.

Expand Down