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

Make the usage of the registration bot configurable #130

Merged
merged 1 commit into from
Nov 22, 2016
Merged

Conversation

vqhuy
Copy link
Member

@vqhuy vqhuy commented Nov 18, 2016

Which do you prefer:

  • Set LocalAddress to an empty string to disable the registration bot
  • Or, have a IsUseBot field in ServerConfig?

@vqhuy vqhuy added this to the 0.1.0 milestone Nov 18, 2016
@vqhuy vqhuy added the server label Nov 18, 2016
@masomel
Copy link
Member

masomel commented Nov 18, 2016

Set LocalAddress to an empty string to disable the registration bot

This approach seems a little safer to me.

@arlolra
Copy link
Member

arlolra commented Nov 18, 2016

Proposal: How about we allow a list of addresses to bind to in the config.toml? Something like,

[[addresses]]
address = "0.0.0.0:3000"
cert = "server.pem"
key = "server.key"

[[addresses]]
address = "0.0.0.0:6000"

[[addresses]]
address = "/tmp/coniks.sock"
allow_registration = true

@masomel
Copy link
Member

masomel commented Nov 19, 2016

How about we allow a list of addresses to bind to in the config.toml?

A few questions: How does the server know which address to choose for which type of connection (bot vs. client, testing vs deployment, etc.)? It also seems like the second address in the list is an unencrypted connection (as opposed to the first one with TLS settings) -- do we want to have a non-TLS option? What does the allow_registration = true entry in the third address mean, is this an alternative to a useBot entry in the configuration/what would allow_registration = false mean?

@arlolra
Copy link
Member

arlolra commented Nov 19, 2016

How does the server know which address to choose for which type of connection (bot vs. client, testing vs deployment, etc.)?

Currently, the keyserver doesn't know anything about bots; it just listens on two addresses, with differing permission. The only change here is really to make that configurable, instead of hardcoded.

What does the allow_registration = true entry in the third address mean

I figured the safest default would be to disallow registration on all addresses, and for the unix socket you'd explicitly enable it.

It also seems like the second address in the list is an unencrypted connection (as opposed to the first one with TLS settings) -- do we want to have a non-TLS option?

Maybe not.

@vqhuy
Copy link
Member Author

vqhuy commented Nov 19, 2016

Does "disallow registration on all addresses" mean "all addresses can accept any request except registration"? Otherwise this totally makes sense to me.

@arlolra
Copy link
Member

arlolra commented Nov 19, 2016

Yup. All the other request are of the "read" type. Registration is the only "write". If you want to think about it like that. So, by default, addresses are "read-only".

@masomel
Copy link
Member

masomel commented Nov 20, 2016

All the other request are of the "read" type. Registration is the only "write". If you want to think about it like that.

Fair point, I agree that this is a good way to think about it.

@vqhuy vqhuy force-pushed the bot-switch branch 2 times, most recently from 58327ab to 88103d4 Compare November 21, 2016 05:06
@vqhuy
Copy link
Member Author

vqhuy commented Nov 21, 2016

I gave it a shot in 88103d43a14cf9d19046df90da823025dae32b84.

@arlolra
Copy link
Member

arlolra commented Nov 21, 2016

Nice work.

@vqhuy vqhuy force-pushed the bot-switch branch 2 times, most recently from 495e9f5 to fdb5b72 Compare November 21, 2016 08:08

// test TCP network
addr := &Address{
Address: "tcp:" + testutil.PublicConnection,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tcp:// ?

Copy link
Member

@arlolra arlolra Nov 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just change testutil.PublicConnection to include the protocol?

Copy link
Member Author

@vqhuy vqhuy Nov 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the latest is here: https://github.com/coniks-sys/coniks-go/pull/130/files#diff-d24d2023b15c72fdfbc6fec8561dcf0dR55 Sorry, my mistake.

Maybe just change testutil.PublicConnection to include the protocol?

Yes, it should be a constant instead.


// test Unix network
addr = &Address{
Address: "unix:" + testutil.LocalConnection,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unix:// ?

panic(err)
for i := 0; i < len(addrs); i++ {
addr := addrs[i]
ln, tlsConfig, perms := resolveAndListen(addr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's worth logging a warning if none of the addresses permit registration?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it makes sense. Added in 0f78e49ac4b22a8051818f30f103e7e74f2abf28. Thanks!

Copy link
Member

@arlolra arlolra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arlolra
Copy link
Member

arlolra commented Nov 22, 2016

Alright, good to merge.

@vqhuy
Copy link
Member Author

vqhuy commented Nov 22, 2016

Yes, wait me for one sec.

@vqhuy vqhuy merged commit 5c92812 into master Nov 22, 2016
@vqhuy vqhuy deleted the bot-switch branch November 22, 2016 07:02
@vqhuy vqhuy mentioned this pull request Nov 24, 2016
3 tasks
@masomel
Copy link
Member

masomel commented Nov 30, 2016

@c633 Maybe this is a silly question, how does one configure the server to use/not use the registration bot? It seems like the server default (i.e. in cmd/init.go) is still to use the bot. Or does this have to be configured manually after init?

@arlolra
Copy link
Member

arlolra commented Nov 30, 2016

Maybe a better framing is to say that the default configuration is to only allow local registrations, and if you want to deviate, you need to manually edit. We leave the bot out of the picture.

@masomel
Copy link
Member

masomel commented Nov 30, 2016

Maybe a better framing is to say that the default configuration is to only allow local registrations, and if you want to deviate, you need to manually edit.

That works I guess (a flag for init may be more convenient, though I realize that may be difficult to implement). This isn't stated in the README or anywhere yet. Will have to add that.

@vqhuy
Copy link
Member Author

vqhuy commented Nov 30, 2016

Will have to add that.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants