Skip to content

Implement reference key server#71

Merged
vqhuy merged 1 commit into
masterfrom
registration
Aug 18, 2016
Merged

Implement reference key server#71
vqhuy merged 1 commit into
masterfrom
registration

Conversation

@vqhuy
Copy link
Copy Markdown
Member

@vqhuy vqhuy commented Aug 15, 2016

  • Implement registration function

Comment thread keyserver/coniksserver/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.

Can remove the true here.

Comment thread keyserver/coniksserver/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.

fallthrough doesn't seem right

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 we could do ./main -genconfig -genkey=sign,vrf. Does it make sense?

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, fallthrough just falls through, it doesn't check the second condition.

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.

Oops :( Thanks!

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 just tried with coniksserver -genconfig and it generated the config file only. So I think it worked as expected?

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.

Only because genkey doesn't have a default value, right. The code still gets executed but on the empty string, so nothing happens.

I guess it's ok with the fallthrough then, but maybe leave a comment saying that we're relying on that. Or not.

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.

Yup, I got it. Thanks!

Comment thread keyserver/coniksserver/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.

boolStringFlag is no longer used.

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 you want to keep it, go back and look at,

keyTypes = strings.Split(keys, ",")
log.Println(keyTypes)

@vqhuy vqhuy force-pushed the registration branch 2 times, most recently from a437eed to 0ea4be3 Compare August 15, 2016 18:07
Comment thread keyserver/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.

I wonder if this should be a path to dir?

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.

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 know, I was just thinking about,

cd keyserver/coniksserver/
mkdir config
./coniksserver -dir config -genconfig -genkey "sign,vrf"
./conkisserver -dir config   // to run

But, ya, nevermind.

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.

Yeah, sounds good!

@vqhuy vqhuy force-pushed the registration branch 3 times, most recently from 4e62d69 to 00d4868 Compare August 15, 2016 18:39
Comment thread keyserver/coniksserver/coniksserver.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.

λ (registration *) ./coniksserver -genkey "sign"
2016/08/15 11:58:06 {true sign,vrf}

boolStringFlag still doesn't seem to be working.

Copy link
Copy Markdown
Member Author

@vqhuy vqhuy Aug 15, 2016

Choose a reason for hiding this comment

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

boolStringFlag is a bool type flag. The reason is I want to have a call like ./coniksserver -genkey with default value. I'm not sure if we want to change it to string type flag.

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, but right now it doesn't support generating the keys individually. So there's no point in doing all the string split orchestration.

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.

Did you try -genkey=sign. I think it should work.

Copy link
Copy Markdown
Member

@arlolra arlolra Aug 15, 2016

Choose a reason for hiding this comment

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

Did you try -genkey=sign. I think it should work.

Well that's embarrassing. Yup, that works. You've even documented it correctly. Although, it's slightly unintuitive that ./coniksserver -genkey "sign" doesn't work, but at least I see why now. It shorts to bool and "sign" ends up being another argument.

Ok, sorry for being slow here. What you have is fine.

@vqhuy vqhuy force-pushed the registration branch 3 times, most recently from 69ee0f0 to 16d7eb8 Compare August 15, 2016 20:43
Comment thread keyserver/server.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.

Maybe a helper for this boilerplate?

func resolvePath(file, other string) other string {
  if !filename.IsAbs(other) {
    file = filepath.Join(filepath.Dir(file), other)
  }
} 

vrfPath := util.resolvePath(file, conf.Policies.VRFKeyPath)

Comment thread keyserver/server_test.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.

Maybe NewConiksServer could take an optional db?

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.

Maybe it's unnecessary, since this's just a modification for testing.

Comment thread keyserver/listener.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.

Sorry, move this below the err check.

@masomel
Copy link
Copy Markdown
Member

masomel commented Aug 16, 2016

I'm still reviewing this pull, and was going through every single commit. Please don't merge this yet.

Comment thread keyserver/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.

What does this image represent?

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 think it's an ascii onion. But, yeah, we should probably stick to CONIKS branding.

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, it's Tor logo ascii. I hope you don't get mad at this :(

@arlolra
Copy link
Copy Markdown
Member

arlolra commented Aug 16, 2016

was going through every single commit.

Sorry for clearing the history, I can restore it if you want :(

@masomel
Copy link
Copy Markdown
Member

masomel commented Aug 16, 2016

Don't worry about it :) It's much easier to review a single commit and I had only made one small comment (which I've added back in).

@arlolra
Copy link
Copy Markdown
Member

arlolra commented Aug 16, 2016

Phew

Comment thread keyserver/listener.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.

I think the panic should be on err not e, no? Otherwise, if the registration request resulted in an error as well, we'll end up panicking on that instead.

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.

panic seems very wrong here.

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 the panic should be on err not e, no?

Yes, it should panic on err.

panic seems very wrong here.

I think if there is any error here, it must be our bug?

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 think if there is any error here, it must be our bug?

Not necessarily a bug? I'm not sure. But definitely internal server error (e.g. ErrorDirectory)

panic seems very wrong here.

@arlolra do you think we shouldn't be panicking here?

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 definitely internal server error (e.g. ErrorDirectory)

No, it is panic(err) which is an error returned by json.Marshal. That's why I said it's maybe our bug.

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, it is panic(err) which is an error returned by json.Marshal. That's why I said it's maybe our bug.

Oh yeah you're right, it's definitely a bug in this case because the response might be malformed. My previous response more for the general case.

Copy link
Copy Markdown
Member

@arlolra arlolra Aug 17, 2016

Choose a reason for hiding this comment

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

Sorry, I hastily threw in the above comment. Don't mind me here.

it's definitely a bug in this case because the response might be malformed

Sounds right.

Thanks for digging into the error propagation so thoroughly.

@vqhuy vqhuy force-pushed the registration branch 2 times, most recently from 40c2fb5 to 736eb0b Compare August 17, 2016 03:04
Comment thread keyserver/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.

That's Tor Messenger specific. We should keep this to CONIKS only. Since there's no logo, what if you just did "CONIKS" in ascii art?

Pick your favourite http://patorjk.com/software/taag/#p=display&f=Rectangles&t=CONIKS


 _____ _____ _____ _____ _____ _____ 
|     |     |   | |     |  |  |   __|
|   --|  |  | | | |-   -|    -|__   |
|_____|_____|_|___|_____|__|__|_____|

Copy link
Copy Markdown
Member Author

@vqhuy vqhuy Aug 17, 2016

Choose a reason for hiding this comment

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

Yup, I probably should remove it :D. Sorry for the noise :D

@vqhuy vqhuy force-pushed the registration branch 2 times, most recently from d144f97 to a2b9f3d Compare August 17, 2016 17:39
Comment thread keyserver/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.

Nice!

@masomel
Copy link
Copy Markdown
Member

masomel commented Aug 18, 2016

LGTM :)

* Implement registration function
@vqhuy vqhuy merged commit f8a4bdc into master Aug 18, 2016
@vqhuy vqhuy deleted the registration branch August 18, 2016 18:56
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.

4 participants