-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Enable serf encryption #1791
Enable serf encryption #1791
Conversation
203b1bb
to
2c115a2
Compare
a3b34ea
to
b269804
Compare
5e854c7
to
8514abe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Left small comments + tests failures should be fixed
@@ -68,6 +68,7 @@ server { | |||
retry_max = 3 | |||
retry_interval = "15s" | |||
rejoin_after_leave = true | |||
encrypt = "abc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation
// KeyringResponse is a unified key response and can be used for install, | ||
// remove, use, as well as listing key queries. | ||
type KeyringResponse struct { | ||
Messages map[string]string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment on these?
helpText := ` | ||
Usage: nomad keyring [options] | ||
|
||
Manages encryption keys used for gossip messages between nomad servers. Gossip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nomad should be capital
} | ||
var resp KeyringResponse | ||
_, err := a.client.write("/v1/agent/keyring/install", &args, &resp, nil) | ||
return &resp, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above you do the extra if err != nil { return nil, err }
check, so maybe keep all of these methods consistent in what they return?
} | ||
|
||
// KeyringRequest is request objects for serf key operations. | ||
type KeyringRequest struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused? Looks like you use structs.KeyringRequest instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using them now.
@@ -68,6 +68,7 @@ server { | |||
retry_max = 3 | |||
retry_interval = "15s" | |||
rejoin_after_leave = true | |||
encrypt = "abc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace
} | ||
defer fh.Close() | ||
|
||
if _, err := fh.Write(keyringBytes); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just use ioutil.WriteFile instead of OpenFile+Write, but you'd still need the Remove on error.
@@ -16,6 +18,19 @@ type Agent struct { | |||
region string | |||
} | |||
|
|||
// KeyringResponse is a unified key response and can be used for install, | |||
// remove, use, as well as listing key queries. | |||
type KeyringResponse struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just use the struct package's KeyringResponse instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schmichael The API package mimics the structs package largely but gives a separation between internal and external structs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that explains it! Thanks. (Wish I could mark comments as addressed in this new PR mode without full on deleting them...)
@@ -391,6 +391,16 @@ configured on client nodes. | |||
join any nodes when it starts up. Addresses can be given as an IP, a domain | |||
name, or an IP:Port pair. If the port isn't specified the default Serf port, | |||
4648, is used. DNS names may also be used. | |||
* <a id="encrypt">`encrypt`</a> Specifies the secret key to use for encryption | |||
of Nomad server's gossip network traffic. This key must be 16-bytes that are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or 24 or 32? Or do we not even want to bother mentioning the aes 192 & 256 support?
# Command: `keyring` | ||
|
||
The `keyring` command is used to examine and modify the encryption keys used in | ||
Nomad server. It is capable of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reformat lines
t.Fatalf("bad: %v", kresp) | ||
} | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to also add a test for use
operation?
@diptanu Looks great! Does it make sense to add general options to the
|
@Gerrrr Definitely, good catch! I can do that, only have internet access via cybercafes at the moment as I am on vacation, but consider it done by the time we make the final 0.5 release. |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
@dadgar @slackpad for review.
@Gerrrr Please help us test this feature if you can!