Skip to content

Implement registration function#29

Closed
vqhuy wants to merge 15 commits into
masterfrom
server-registration
Closed

Implement registration function#29
vqhuy wants to merge 15 commits into
masterfrom
server-registration

Conversation

@vqhuy
Copy link
Copy Markdown
Member

@vqhuy vqhuy commented Jul 22, 2016

Comment thread main.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This file should be in server/, no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My intention is it just a sample usage of the library.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, then please rename it to main.example.go or some such, and add a comment at the top of the file indicating the intention.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I still think it should be in server/ though, since it's a sample usage of this package.

Also, the server/README.md seems to describe it that way.

Copy link
Copy Markdown
Member

@masomel masomel Jul 23, 2016

Choose a reason for hiding this comment

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

The layering approach is also interesting and I can be convinced of it.

I think there's a little more layering we can do, though I agree that any server executable we build should be considered to be a reference implementation. Other developers might want to have a different server architecture, and we should allow for that. As @c633 and I had originally thought, I think the protocols package should also include a high-level API for the CONIKS protocols and transparency operations: registration, lookups, key changes, updating the directory and generating (and publishing) new STRs, all of these with the option to store them to a DB. The handlers in the reference implementation could then simply use this API. How does this sound?

But how I originally thought about these was that they'd be separate processes, and the server would only accept registrations from the privileged places (ie. only registrations from localhost)

Also agree on this one. This also just seems like a configuration in the server, no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But how I originally thought about these was that they'd be separate processes, and the server would only accept registrations from the privileged places (ie. only registrations from localhost)

I would like to count @liamsi in, since we all agree on this.

This also just seems like a configuration in the server, no?

I don't think so, since the server also has to accept lookup requests, too. I just have only 2 solutions for this:

  1. We can check if the registration requests are originated from the localhost or not. (something like conn.RemoteAddr() == conn.LocalAddr()). But I don't know whether there is any type of attacks that can fake the remote address?

  2. Sign the request with registration bot's private key, and the key server verifies the request using the bot's public key. This way, the bot and the key server can run on 2 separated machines.

What do you think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But how I originally thought about these was that they'd be separate processes, and the server would only accept registrations from the privileged places (ie. only registrations from localhost)

I would like to count @liamsi in, since we all agree on this.

I also thought about it in exactly this way. But I also agree on the security concerns @c633 raised below.

We can check if the registration requests are originated from the localhost or not. (something like conn.RemoteAddr() == conn.LocalAddr()). But I don't know whether there is any type of attacks that can fake the remote address?

I fear this alone doesn't give you any reasonable security. We have to find ways to additionally secure that (firewall/network setup, TLS). But all this makes only sense if we want both processes also to be able to run on different machines (on the same machine they could use other means to communicate with each other).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I fear this alone doesn't give you any reasonable security. We have to find ways to additionally secure that (firewall/network setup, TLS). But all this makes only sense if we want both processes also to be able to run on different machines (on the same machine they could use other means to communicate with each other).

That's why I suggest the 2) option.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I had assumed we'd accept registrations on a separate port, and have the firewall restrict access to it. But 2) is also a viable option. Does anyone have a strong preference?

@vqhuy vqhuy force-pushed the server-registration branch from 07f39af to e731ef9 Compare July 22, 2016 16:38
Comment thread server/main.example.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should I put it into a sub-directory, namely bin? /cc @masomel

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't bin conventionally the place where compiled binaries are placed? Maybe naming the package something like keyserver or coniksServer would be more descriptive.

Copy link
Copy Markdown
Member Author

@vqhuy vqhuy Jul 23, 2016

Choose a reason for hiding this comment

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

If so, I would move all the source files except main.example.go into coniksserver subpackage.
Never mind. I got your idea.

Copy link
Copy Markdown
Member Author

@vqhuy vqhuy Jul 24, 2016

Choose a reason for hiding this comment

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

@arlolra @masomel : What do you think about 8be171fe5d2019717636019f32e5df888b3a0ea5 and 78db200a2a10b46ece5c5a973d384e3bbe330921?

@vqhuy vqhuy changed the title Implement registration function [WIP] Implement registration function Jul 22, 2016
Comment thread server/message.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we split the reusable server code and the executable implementation into separate packages, I would include this module in the "reusable" package.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like this is being discussed as part of the #29 (comment) thread.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it is done in 78db200a2a10b46ece5c5a973d384e3bbe330921

@vqhuy vqhuy force-pushed the server-registration branch from fd73f1c to 8be171f Compare July 24, 2016 18:30
Comment thread README.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now that we've split up the code, I think the description here should be something like "Key server executable" or "Key server reference implementation".

@vqhuy vqhuy force-pushed the server-registration branch 4 times, most recently from a6c0c26 to 8e1b496 Compare July 27, 2016 08:26
Comment thread protocol/directory.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like you're cutting off just one letter from directorSize. If you want to abbreviate, maybe just call it something like dirSize?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh sorry. :(

Btw, dirSize sounds good!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No worries at all!

Comment thread protocol/directory.go Outdated
signKey sign.PrivateKey, dirSize uint64,
useTBs bool, capacity uint64) *ConiksDirectory {
d := new(ConiksDirectory)
d.policies = merkletree.NewPolicies(epDeadline, vrfKey)
Copy link
Copy Markdown
Member

@arlolra arlolra Aug 11, 2016

Choose a reason for hiding this comment

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

d.SetPolicies(epDeadline, vrfKey)

@arlolra
Copy link
Copy Markdown
Member

arlolra commented Aug 12, 2016

This pull is very big and unwieldy.

I think you should break it up into a few new pulls,

  • The changes to merkletree/policy.go and utils/util.go, which seem uncontroversial and can be merged right away.
  • The protocol/ package
  • The keyserver/ package, but when you make this pull, the base you choose is the pull for the protocol/ package so that we only see the diff between those two.

Then we can close this conversation with 180+ comments that's threatening to crash my browser.

@vqhuy
Copy link
Copy Markdown
Member Author

vqhuy commented Aug 12, 2016

Thanks for all your feedback so far! I'm working on this!

I think you should break it up into a few new pulls,

Yes, I totally agree!

Then we can close this conversation with 180+ comments that's threatening to crash my browser.

Me too. That's my bad. I'm sorry!

@masomel
Copy link
Copy Markdown
Member

masomel commented Aug 12, 2016

The keyserver/ package, but when you make this pull, the base you choose is the pull for the protocol/ package so that we only see the diff between those two.

One more question, are we going to wait to open this pull after the protocol pull is merged? It seems only pulls for the protocol and the policy/util stuff were created.

@vqhuy vqhuy deleted the server-registration branch August 14, 2016 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement registration

4 participants