Crypto error: No revisions found for msreddy sig key ( even though, I have valid keys present )


#1

Here is my environment issue, this was working fine, since, I have keys present and was also able to use HAB_AUTH_TOKEN, earlier.

Now, same keys and HAB_AUTH_TOKEN are not working to “hab studio enter”.
Steps tried:

  1. hab studio enter
  2. using existing keys and new keys by regenerating, and also tried with HAB_AUTH_TOKEN setup.
  3. But, ended up with following error:
    hab-studio: Creating Studio at /hab/studios/src (default)
    hab-studio: Importing ‘msreddy’ secret origin key
    ✗✗✗
    ✗✗✗ Crypto error: No revisions found for msreddy sig key
    ✗✗✗
    Error exporting msreddy key

Habitat was unable to export your secret signing key. Please
verify that you have a signing key for msreddy present in either
~/.hab/cache/keys (if running via sudo) or /hab/cache/keys
(if running as root). You can test this by running:

hab origin key export --type secret msreddy

This test will print your signing key to the console or error
if it cannot find the key. To create a signing key, you can run:

hab origin key generate msreddy

You’ll also be prompted to create an origin signing key when
you run ‘hab setup’.


#2

Can you run hab origin key export --type secret msreddy? Don’t post the output in this public forum, but it should show your key material.

What Habitat environment variables are present? (They’ll start with HAB_; again, be sure you don’t post any sensitive information here.)

What files are present in ~/.hab/cache/keys or /hab/cache/keys?


#3
  1. Habitat env variables are present:
    HAB_DOCKER_OPTS=-p 9631:9631 -p 8080:8080

  2. files are present in ~/.hab/cache/keys
    msreddy-20180702214044.sig.key
    msreddy-20180702214044.pub

  3. hab origin key export --type secret msreddy

DEBUG 2018-07-03T15:45:28Z: habitat_common::ui: UI { shell: Shell { input: InputStream { isatty: true }, out: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true }, err: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true } } }
DEBUG 2018-07-03T15:45:28Z: hab: clap cli args: [“hab”, “origin”, “key”, “export”, “–type”, “secret”, “msreddy”]
DEBUG 2018-07-03T15:45:28Z: hab: remaining cli args: []
DEBUG 2018-07-03T15:45:28Z: habitat_core::crypto::keys: checking file: msreddy-20180702214044.pub
DEBUG 2018-07-03T15:45:28Z: habitat_core::crypto::keys: valid key suffix
DEBUG 2018-07-03T15:45:28Z: habitat_core::crypto::keys: checking file: msreddy-20180702214044.sig.key
DEBUG 2018-07-03T15:45:28Z: habitat_core::crypto::keys: valid key suffix
DEBUG 2018-07-03T15:45:28Z: habitat_core::crypto::keys::sig_key_pair: revisions = [“msreddy-20180702214044”]
DEBUG 2018-07-03T15:45:28Z: habitat_core::crypto::keys::sig_key_pair: Attempting to read key name_with_rev msreddy-20180702214044 for msreddy
DEBUG 2018-07-03T15:45:28Z: hab::command::origin::key::export: Streaming file contents of secret C:\Users\t973443.hab/cache/keys\msreddy-20180702214044.sig.key to standard out
SIG-SEC-1
msreddy-20180702214044


#4

Strange, @msreddy can you tell me what the contents of C:/hab/cache/keys are? We have two paths for keys the user path as well as the root path.


#5

C:/hab/cache/keys folder does not exists.
C:/hab does not exists on file system.


#6

One Windows nuance here is whether you are running in an elevated (run as administrator) console or not. If the console is elevated then c:\hab\cache\keys will be mounted to the studio otherwise ~/.hab/cache/keys will be mounted. So you might try either entering the studio in an unelevated console or copying ~/.hab/cache/keys to c:\hab\cache\keys


#7

I tried both ways, but ended up with same issue.
Ran as administrator > hab studio enter
And, also copying ~/.hab/cache/keys to c:\hab\cache\keys


#8

can you turn on debug output and show the output when entering the studio?


#9

DEBUG 2018-07-03T22:04:32Z: habitat_common::ui: UI { shell: Shell { input: InputStream { isatty: true }, out: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true }, err: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true } } }
DEBUG 2018-07-03T22:04:32Z: hab::config: Loading CLI config from C:\Users\t973443.hab/etc/cli.toml
DEBUG 2018-07-03T22:04:32Z: hab::command::studio::enter: Setting default origin msreddy via CLI config
DEBUG 2018-07-03T22:04:32Z: hab::command::studio::enter: Setting HAB_CACHE_KEY_PATH=C:\Users\t973443.hab/cache/keys
DEBUG 2018-07-03T22:04:32Z: hab::command::studio::enter: Setting ARTIFACT_PATH=C:\Users\t973443.hab/cache/artifacts
DEBUG 2018-07-03T22:04:32Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:04:32Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “images” “habitat-docker-registry.bintray.io/studio:0.58.0” “-q”
DEBUG 2018-07-03T22:04:33Z: hab::command::studio::docker: Found Studio Docker image locally.
DEBUG 2018-07-03T22:04:33Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:04:33Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:04:33Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:04:33Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:04:36Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:04:36Z: hab::command::studio::docker: Adding extra Docker options from HAB_DOCKER_OPTS = ["-p", “9631:9631”, “-p”, “8080:8080”, “-p”, “9080:9080”, “-p”, “10080:10080”, “-p”, “11080:11080”]
DEBUG 2018-07-03T22:04:36Z: hab::command::studio::docker: Setting container env var: “HAB_ORIGIN”=‘msreddy’
DEBUG 2018-07-03T22:04:36Z: hab::command::studio::docker: Setting container env var: “RUST_LOG”=‘debug’
DEBUG 2018-07-03T22:04:36Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:04:36Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:04:36Z: habitat_core::os::process::imp: Calling child process: (“C:\Program Files\Docker\Docker\Resources\bin\docker.EXE”) [“run”, “–rm”, “–privileged”, “–tty”, “–interactive”, “-p”, “9631:9631”, “-p”, “8080:8080”, “-p”, “9080:9080”, “-p”, “10080:10080”, “-p”, “11080:11080”, “–env”, “HAB_ORIGIN=msreddy”, “–env”, “RUST_LOG=debug”, “–volume”, “c:\mint\workspaces:/src”, “–volume”, “C:\Users\t973443\.hab/cache/keys:/hab/cache/keys”, “–volume”, “C:\Users\t973443\.hab/cache/artifacts:/hab/cache/artifacts”, “–volume”, “/var/run/docker.sock:/var/run/docker.sock”, “habitat-docker-registry.bintray.io/studio:0.58.0”, “enter”]
DEBUG 2018-07-03T22:04:38Z: habitat_common::ui: UI { shell: Shell { input: InputStream { isatty: true }, out: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true }, err: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true } } }
DEBUG 2018-07-03T22:04:38Z: hab::command::studio::enter: Setting HAB_CACHE_KEY_PATH=/hab/cache/keys
DEBUG 2018-07-03T22:04:38Z: hab::command::studio::enter: Setting ARTIFACT_PATH=/hab/cache/artifacts
DEBUG 2018-07-03T22:04:38Z: habitat_core::os::process::imp: Calling execvp(): ("/hab/pkgs/core/hab-studio/0.58.0/20180629150552/bin/hab-studio") [“enter”]
hab-studio: Creating Studio at /hab/studios/src (default)
hab-studio: Importing ‘msreddy’ secret origin key
DEBUG 2018-07-03T22:04:38Z: habitat_common::ui: UI { shell: Shell { input: InputStream { isatty: true }, out: OutputStream { coloring: Auto, isatty: false, is_colored(): true, supports_color(): true }, err: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true } } }
DEBUG 2018-07-03T22:04:38Z: hab: clap cli args: ["/hab/pkgs/core/hab-studio/0.58.0/20180629150552/libexec/hab", “origin”, “key”, “export”, “–type”, “secret”, “msreddy”]
DEBUG 2018-07-03T22:04:38Z: hab: remaining cli args: []
DEBUG 2018-07-03T22:04:38Z: habitat_core::crypto::keys::sig_key_pair: revisions = []
✗✗✗
✗✗✗ Crypto error: No revisions found for msreddy sig key
✗✗✗
Error exporting msreddy key

Habitat was unable to export your secret signing key. Please
verify that you have a signing key for msreddy present in either
~/.hab/cache/keys (if running via sudo) or /hab/cache/keys
(if running as root). You can test this by running:

hab origin key export --type secret msreddy

This test will print your signing key to the console or error
if it cannot find the key. To create a signing key, you can run:

hab origin key generate msreddy

You’ll also be prompted to create an origin signing key when
you run ‘hab setup’.


#10

Let’s try running a vannila syudio container but without actually entering the studio - just a raw shell prompt:

docker run --entrypoint sh --rm --privileged --tty --interactive --volume C:\\Users\\t973443\\.hab/cache/keys:/hab/cache/keys habitat-docker-registry.bintray.io/studio:0.58.0

This should land you into the same environment where a Studio starts to configure itself and have your keys directory mounted.

From here can you ls /hab/cache/keys and confirm you see the same keys you see on your host?


#11

@mwrock - Good news. I was able to get it working. Thank you for the kind support.

Root cuase: It was problem of docker process that was having issue on accessing shared folder.

OMG. hab studio enter ( seems dumb) was giving false alarm that, there is crypto error, when it was unable to get hookup with docker process, since docker was having issue on accessing shared folder on windows ( win10).

Thank you, again.

Here is debug output, after successfully “hab studio enter”:

DEBUG 2018-07-03T22:46:59Z: habitat_common::ui: UI { shell: Shell { input: InputStream { isatty: true }, out: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true }, err: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true } } }
DEBUG 2018-07-03T22:46:59Z: hab::config: Loading CLI config from C:\hab/etc/cli.toml
DEBUG 2018-07-03T22:46:59Z: hab::command::studio::enter: Setting default origin msreddy via CLI config
DEBUG 2018-07-03T22:46:59Z: hab::command::studio::enter: Setting HAB_CACHE_KEY_PATH=C:\hab/cache/keys
DEBUG 2018-07-03T22:46:59Z: hab::command::studio::enter: Setting ARTIFACT_PATH=C:\hab/cache/artifacts
DEBUG 2018-07-03T22:46:59Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:46:59Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “images” “habitat-docker-registry.bintray.io/studio:0.58.0” “-q”
DEBUG 2018-07-03T22:47:00Z: hab::command::studio::docker: Found Studio Docker image locally.
DEBUG 2018-07-03T22:47:00Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:47:00Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:47:00Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:47:00Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:47:03Z: hab::command::studio::docker: Running command: “C:\Program Files\Docker\Docker\Resources\bin\docker.EXE” “version” “–format=’{{.Server.Os}}’”
DEBUG 2018-07-03T22:47:03Z: hab::command::studio::docker: Adding extra Docker options from HAB_DOCKER_OPTS = ["-p", “9631:9631”, “-p”, “8080:8080”, “-p”, “9080:9080”, “-p”, “10080:10080”, “-p”, “11080:11080”]
DEBUG 2018-07-03T22:47:05Z: habitat_common::ui: UI { shell: Shell { input: InputStream { isatty: true }, out: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true }, err: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true } } }
DEBUG 2018-07-03T22:47:05Z: hab::command::studio::enter: Setting HAB_CACHE_KEY_PATH=/hab/cache/keys
DEBUG 2018-07-03T22:47:05Z: hab::command::studio::enter: Setting ARTIFACT_PATH=/hab/cache/artifacts
DEBUG 2018-07-03T22:47:05Z: habitat_core::os::process::imp: Calling execvp(): ("/hab/pkgs/core/hab-studio/0.58.0/20180629150552/bin/hab-studio") [“enter”]
hab-studio: Creating Studio at /hab/studios/src (default)
hab-studio: Importing ‘msreddy’ secret origin key
DEBUG 2018-07-03T22:47:05Z: habitat_common::ui: UI { shell: Shell { input: InputStream { isatty: true }, out: OutputStream { coloring: Auto, isatty: false, is_colored(): true, supports_color(): true }, err: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true } } }
DEBUG 2018-07-03T22:47:05Z: hab: clap cli args: ["/hab/pkgs/core/hab-studio/0.58.0/20180629150552/libexec/hab", “origin”, “key”, “export”, “–type”, “secret”, “msreddy”]
DEBUG 2018-07-03T22:47:05Z: hab: remaining cli args: []
DEBUG 2018-07-03T22:47:05Z: habitat_core::crypto::keys: checking file: msreddy-20180703223650.pub
DEBUG 2018-07-03T22:47:05Z: habitat_core::crypto::keys: valid key suffix
DEBUG 2018-07-03T22:47:05Z: habitat_core::crypto::keys: checking file: msreddy-20180703223650.sig.key
DEBUG 2018-07-03T22:47:05Z: habitat_core::crypto::keys: valid key suffix
DEBUG 2018-07-03T22:47:05Z: habitat_core::crypto::keys::sig_key_pair: revisions = [“msreddy-20180703223650”]
DEBUG 2018-07-03T22:47:05Z: habitat_core::crypto::keys::sig_key_pair: Attempting to read key name_with_rev msreddy-20180703223650 for msreddy
DEBUG 2018-07-03T22:47:05Z: hab::command::origin::key::export: Streaming file contents of secret /hab/cache/keys/msreddy-20180703223650.sig.key to standard out
DEBUG 2018-07-03T22:47:05Z: habitat_common::ui: UI { shell: Shell { input: InputStream { isatty: false }, out: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true }, err: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true } } }
DEBUG 2018-07-03T22:47:05Z: hab: clap cli args: ["/hab/pkgs/core/hab-studio/0.58.0/20180629150552/libexec/hab", “origin”, “key”, “import”]
DEBUG 2018-07-03T22:47:05Z: hab: remaining cli args: []
» Importing origin key from standard input
DEBUG 2018-07-03T22:47:05Z: habitat_core::crypto::keys::sig_key_pair: Writing temp key file /hab/studios/src/hab/cache/keys/msreddy-20180703223650.sig.key.27978c8352a6
DEBUG 2018-07-03T22:47:05Z: habitat_core::crypto::keys::sig_key_pair: Can’t find public key for name_with_rev msreddy-20180703223650: No such file or directory (os error 2)
★ Imported secret origin key msreddy-20180703223650.
hab-studio: Importing ‘msreddy’ public origin key
DEBUG 2018-07-03T22:47:05Z: habitat_common::ui: UI { shell: Shell { input: InputStream { isatty: false }, out: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true }, err: OutputStream { coloring: Auto, isatty: true, is_colored(): true, supports_color(): true } } }
DEBUG 2018-07-03T22:47:05Z: hab: clap cli args: ["/hab/pkgs/core/hab-studio/0.58.0/20180629150552/libexec/hab", “origin”, “key”, “import”]
DEBUG 2018-07-03T22:47:05Z: hab: remaining cli args: []
» Importing origin key from standard input
DEBUG 2018-07-03T22:47:05Z: habitat_core::crypto::keys::sig_key_pair: Writing temp key file /hab/studios/src/hab/cache/keys/msreddy-20180703223650.pub.569638f988b8
★ Imported public origin key msreddy-20180703223650.
hab-studio: Entering Studio at /hab/studios/src (default)
hab-studio: Exported: HAB_AUTH_TOKEN=[redacted]
hab-studio: Exported: HAB_ORIGIN=msreddy

–> Detected and loading /src/.studiorc

–> Launching the Habitat Supervisor in the background…
Running: hab sup run
* Use ‘hab svc start’ & ‘hab svc stop’ to start and stop services
* Use ‘sup-log’ to tail the Supervisor’s output (Ctrl+c to stop)
* Use ‘sup-term’ to terminate the Supervisor
* To pass custom arguments to run the Supervisor, export
‘HAB_STUDIO_SUP’ with the arguments before running
‘hab studio enter’.

–> To prevent a Supervisor from running automatically in your
Studio, export ‘HAB_STUDIO_SUP=false’ before running
‘hab studio enter’.

[1][default:/src:0]#