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 docker-based in-toto apt transport demo #25

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

lukpueh
Copy link
Member

@lukpueh lukpueh commented Jun 5, 2019

Fixes issue #:
None

Description of the changes being introduced by the pull request:
See commit messages and demo/README.md for details.

Files to consider for review:
demo/README.md (most importantly), demo/docker-compose.yml and demo/Dockerfile-* files

Please verify and check that the pull request fulfills the following
requirements
:

  • The code follows the Code Style Guidelines
  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

lukpueh added 5 commits June 5, 2019 16:52
Add dummy debian package based on "hello-world" package tutorial
http://wiki.opf-labs.org/display/SP/The+Hello+World+Debian+Package

Also add two builds created with dpkg-buildpackage (see tutorial).
One of the builds is used as an "ok" version and as a "bad", i.e.
compromised version of the package.
Add gpg keyring (copy of tests/data/gpg_keyring) keys for
Alice, Bobby and Carly.

Alice's key is used to sign both the demo root layout and the
demo archives. This is purely done for convenience, in real live
different keys should be used.

Bobby and Carly are each used to sign rebuilder link metadata.

Other demo data includes the link metadata served by the
demo rebuilder, the root layout and the apt in-toto config file.
All components used for the demo are defined as docker compose
services:

- *mirror.ok* and *mirror.bad* each set up a basic Debian archive
that serves a single `demo-package`. *mirror.ok* serves a package,
whose hash corresponds to the rebuilder results. *mirror.bad* does
not.

- *rebuilder.a* and *rebuilder.b* each statically serve in-toto
link metadata, to provide the signed rebuild evidence for
`demo-package`.

- *client* is a pre-configured Debian host, which is set up to
demonstrate the installation.
Add demo command snippets and background information.
- Make all log messages bold to better distinguish from apt
notifications.
- Colorize failure and success message
- Shorten error message sent to apt, because we have to escape
newlines, which aren't un-escaped when apt prints them.
- Add newlines where appropriate
@lukpueh
Copy link
Member Author

lukpueh commented Jun 24, 2019

Note that tests that expect the transport to emit certain messages fail due to output updates in 660f622. Before merging we need to either revert the output updates or update the test cases.

build:
context: ..
dockerfile: demo/Dockerfile-client
tty: true

Choose a reason for hiding this comment

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

GitHub is showing this "no newline at EOF" error. I'm not sure if that's a concern.

Choose a reason for hiding this comment

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

Maybe minor comments would be helpful here so someone doesn't have to go back to the README to tell what's going on.

logger.info("In-toto verification for '{}' passed! :)".format(filename))
# Colorize (blue) success message
logger.info("\033[34mIn-toto verification for '{}' passed! :)\033[0m"
.format(filename))

Choose a reason for hiding this comment

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

The SSL guidelines seem to favor string concatenation over string formatting. Not sure if this is a big deal.

Copy link
Member Author

Choose a reason for hiding this comment

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

in-toto projects favors format over string concatenation pretty much everywhere. :)

Copy link
Member

@adityasaky adityasaky left a comment

Choose a reason for hiding this comment

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

Is this one waiting for something in particular?

RUN echo 'autocmd BufRead,BufNewFile metadata* set filetype=json' >> ~/.vimrc


# NOTE: Below setup will be replaced by `apt-get install apt-transport-intoto`
Copy link
Member

Choose a reason for hiding this comment

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

```bash
# In project root
docker-compose -f demo/docker-compose.yml up

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

@@ -650,7 +651,8 @@ def _intoto_verify(message_data):
in_toto.verifylib.in_toto_verify(layout, layout_keys)

except Exception as e:
error_msg = ("In-toto verification for '{}' failed, reason was: {}"
# Colorize (red) error message
error_msg = ("\033[31mIn-toto verification for '{}' failed:\033[0m\n{}"
Copy link
Member

Choose a reason for hiding this comment

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

nit: should in-toto be capitalized here?

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