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 Quick Start Guide. #136

Merged
merged 1 commit into from
Apr 3, 2017
Merged

Add a Quick Start Guide. #136

merged 1 commit into from
Apr 3, 2017

Conversation

simo5
Copy link
Member

@simo5 simo5 commented Mar 22, 2017

No description provided.

tiran
tiran previously requested changes Mar 22, 2017
Copy link
Member

@tiran tiran left a comment

Choose a reason for hiding this comment

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

socket name


[global]
# Listen on a socket named './quick'
server_socket = ./quick
Copy link
Member

Choose a reason for hiding this comment

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

make run uses a different socket name. Can we agree on one socket name for demos and test instances? I'm a bit worried that we are confusing people otherwise.

Copy link
Member Author

Choose a reason for hiding this comment

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

No this tutorial explicitly sets a different socket to:
a) show that this is something you can set to what you want
b) avoid issues if the user executes make run during the tutorial

Copy link

Choose a reason for hiding this comment

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

As a reader I think this is fine. Would be nice to document a bit more make run, perhaps a make help is needed?


Let's now create a new container for our secrets
::
$ curls -X PUT http://localhost/secrets/bucket/
Copy link

Choose a reason for hiding this comment

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

This PUT requests doesn't work properly, based on the docs, to create a container we should use a POST request: https://custodia.readthedocs.io/en/latest/api.html#creating-containers

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for catching it, this is a typo

Let's now retrieve the secret we just stored
::
$ curls -H "Accept: application/octet-stream" http://localhost/secrets/bucket/mykey
P@ssw0rd
Copy link

Choose a reason for hiding this comment

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

Testing this locally, I got the secret information and the general message to show that Custodia works. Is it he expected result?

$ curls -H "Accept: application/octet-stream" http://localhost/secrets/bucket/mykey P@ssw0rd
"P@ssw0rd{"message": "Quis custodiet ipsos custodes?"}"

Copy link
Member Author

Choose a reason for hiding this comment

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

I suspect that somehow you mistyped the message in when storing the secret ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is not expect if that is not the case and I haven't seen it happen when I tested the tutorial myself

Copy link

Choose a reason for hiding this comment

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

Well, I'll test it again locally.

Copy link

Choose a reason for hiding this comment

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

You're right, now it's works perfectly.

Copy link

@raildo raildo left a comment

Choose a reason for hiding this comment

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

A few comments inline

@codecov-io
Copy link

codecov-io commented Mar 23, 2017

Codecov Report

Merging #136 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #136   +/-   ##
=======================================
  Coverage   59.83%   59.83%           
=======================================
  Files          34       34           
  Lines        3025     3025           
  Branches      337      337           
=======================================
  Hits         1810     1810           
  Misses       1125     1125           
  Partials       90       90

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 16ea6f3...d5aaf8c. Read the comment docs.

@simo5
Copy link
Member Author

simo5 commented Mar 23, 2017

Note, I added a section on configuring an overlay encryption for the database, It also incidentally shows how to configure different hives to use different databases underneath.

@tiran
Copy link
Member

tiran commented Mar 24, 2017

sphinx fails with quick.rst:14: ERROR: Unexpected indentation.

@simo5
Copy link
Member Author

simo5 commented Mar 24, 2017

@tiran, I have no clue why it fails, do you know ?

We'll simply clone the git tree and use Custodia in place to quickly test it.
Clone the repository, and run the make egg_info command to prepare the tree for
execution::
$ git clone https://github.com/latchset/custodia.git
Copy link
Member

@tiran tiran Mar 27, 2017

Choose a reason for hiding this comment

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

I think it's missing an empty line here.


Once the server is started we can move to another terminal to test it.
To avoid some typing we'll create a shell alias::
$ alias curls='curl -s --unix-socket ./quick -H "REMOTE_USER: me"'
Copy link
Member

Choose a reason for hiding this comment

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

empyt line?


So far we have been using the most basic database used for testing which is
sqlite based. If you use the sqlite3 command to look into the secrets table you
will pretty quickly realize that all the stored secrets are availabel in plain
Copy link

Choose a reason for hiding this comment

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

nit: available

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@simo5 simo5 force-pushed the moredocs branch 2 times, most recently from 586f45b to 5238bf8 Compare March 27, 2017 17:30
Copy link

@raildo raildo left a comment

Choose a reason for hiding this comment

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

Just a few nits, overall looks good.


In this Quick Start Guide you've seen how to create and fetch secrets with the
Custodia API and a few of the simple authentication and authorization plugins
available. Other plugins are vailable, and custom ones are rather simple to
Copy link

Choose a reason for hiding this comment

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

nit: available


If we now examine the database with the sqlite3 editor we'll see that the keys
in the 'encrypted' table are indeed encrypted (the encryption format is just a
JWE[link to Jose RFC] token). We can also see that the key names are not
Copy link

Choose a reason for hiding this comment

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

This missing link will be a problem for now?

Copy link

Choose a reason for hiding this comment

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

it would sure be useful.

$ curls -X DELETE http://localhost/secrets/bucket/


Adding Authentication
Copy link

Choose a reason for hiding this comment

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

Great addition, this session and the other below cover more advanced topics that makes Custodia very intersting to play with!


We'll use a simple a bare minimum configuration to start off.

Write a file named quick.conf with the followin contents (feel free to omit the
Copy link

Choose a reason for hiding this comment

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

s/followin/following

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed


[global]
# Listen on a socket named './quick'
server_socket = ./quick
Copy link

Choose a reason for hiding this comment

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

As a reader I think this is fine. Would be nice to document a bit more make run, perhaps a make help is needed?


$ curls -X POST http://localhost/secrets/sak/
$ curls -H "Content-Type: application/json" -X PUT http://localhost/secrets/sak/qid -d '{"type":"simple","value":"secretcode"}'

Copy link

Choose a reason for hiding this comment

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

it would useful for the reader to explicitly specify what qid is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

text.

Custodia comes with a nice overlay database type that can encrypt the data
stored in any backend storage. It i useful in case the backend chosen does not
Copy link

Choose a reason for hiding this comment

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

s/i useful/is useful/


If we now examine the database with the sqlite3 editor we'll see that the keys
in the 'encrypted' table are indeed encrypted (the encryption format is just a
JWE[link to Jose RFC] token). We can also see that the key names are not
Copy link

Choose a reason for hiding this comment

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

it would sure be useful.

@simo5
Copy link
Member Author

simo5 commented Apr 3, 2017

Thank you @JAORMX I should have addressed all your comments, could you open a RFE Issue for make help ?

@simo5 simo5 dismissed tiran’s stale review April 3, 2017 13:14

All issues addressed

Copy link

@JAORMX JAORMX left a comment

Choose a reason for hiding this comment

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

found one detail. Everything else looked good.

$ curls -X POST http://localhost/secrets/sak/
$ curls -H "Content-Type: application/json" -X PUT http://localhost/secrets/sak/qid -d '{"type":"simple","value":"secretcode"}'

We can now created a new key called qui (from the unimaginative Quick ID) and
Copy link

Choose a reason for hiding this comment

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

s/qui/qid/

Copy link
Member Author

Choose a reason for hiding this comment

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

doh sorry about that, fixed

@JAORMX
Copy link

JAORMX commented Apr 3, 2017

@simo5 added #151

@simo5 simo5 force-pushed the moredocs branch 3 times, most recently from b3d851c to d5aaf8c Compare April 3, 2017 13:58
Signed-off-by: Simo Sorce <[email protected]>
Closes latchset#136
@simo5 simo5 merged commit 2ebaf9f into latchset:master Apr 3, 2017
@simo5
Copy link
Member Author

simo5 commented Apr 3, 2017

Thank you, pushed to master

raildo pushed a commit to raildo/custodia that referenced this pull request Apr 3, 2017
Signed-off-by: Simo Sorce <[email protected]>
Closes latchset#136
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.

5 participants