Skip to content

Assignment 0: Define scone alias

The recommended way to run the scone CLI (Command Line Interface) is inside a container of your computer or a remote computer. The syntax to run a command inside a container is quite verbose and it is challenging to remember all the required options.

Some of the scone CLI commands store state in your home directory:

  • $HOME/.cas keeps state related to the scone cas (configuration and attestation service) instances. For each instance that you have attested, it contains the certificate and the attestation report. This file also contains a private/public key pair to authenticate you to CAS. The scone CLI generates this key pair the first time you need the key pair.

  • $HOME/.scone contains state related to the scone CLI. Often, this file might be empty.

Task

To simplify the usage of the scone CLI, we recommend using an alias. In case you are using the bash shell, this might look as follows:

alias scone="docker run -it --rm \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v \"$HOME/.docker:/root/.docker\" \
    -v \"$HOME/.cas:/root/.cas\" \
    -v \"$HOME/.scone:/root/.scone\" \
    -v \"\$PWD:/root\" \
    -w /root \
    registry.scontain.com/community/cli scone"

Try to add this alias to your shell defaults to ensure that this alias is automatically defined. If you use bash as a shell, you might want to add this alias as part of .bashrc in your home directory, i.e., in ~/.bashrc. If you use zsh, you could add the alias as part of ~/.zshrc.

Checking the result

Start a new instance of your shell, say, bash. You can check if an alias scone already exists by typing:

type -a scone

This command will print the alias. If scone is not defined, it will print an error.

Given that alias scone is defined, you can now execute commands like:

scone session --help

To print help messages regarding session related commands:

rust-cli-session 0.2.0
Manage CAS sessions

USAGE:
    rust-cli session <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    check     Check the syntax of the provided session file. Exits with a non-zero exit code on validation error
    create    Upload a new session to CAS. Prints the hash of the created session on success
    help      Prints this message or the help of the given subcommand(s)
    read      Load an active session from CAS and print it to stdout
    update    Update an existing session in CAS. Prints the hash of the updated session on success
    verify    Verify that a session active on CAS matches the given session. Prints the hash of the verified session
              on success

Solution

A solution for this task using bash is available at Assignment 0.

Screencast

Troubleshooting

  • Command Not Found

  • scone: command not found: the alias scone does not seem to exist. Try to define.

  • docker: command not found: docker is not installed. Please install docker (or alternative) on your machine (see docker installation).

  • No Access

  • If you get an error message like:

    Unable to find image 'registry.scontain.com/community/cli:latest' locally
    docker: Error response from daemon: pull access denied for registry.scontain.com/community/cli, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
    See 'docker run --help'.
  • You might not have registered an account. Please follow these instructions to register an account.

  • You might not have logged into registry.scontain.com. Please follow these instructions on how to generate an access token and log into our repository.

  • You might try to access images that are not available as part of the community edition. Please send an email to info@scontain.com.

  • If you experience any additional issues, please let us know via email. We will add the issue and a proposed solution to this troubleshooting section.