Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-1183

cf-promises segfaults if ppkeys directory does not contain key

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.0
    • Component/s: cf-key
    • Labels:
      None

      Description

      Steps to reproduce:

      1. Build cfengine from source.
      2. Wipe out @/var/cfengine@.
      3. Run "@make install@" in both core and masterfiles.
      4. Copy @/var/cfengine/masterfiles@ to @/var/cfengine/inputs@
      5. Try to bootstrap to yourself.

      I get this:
      <pre>
      (precise)root@cflu-10040:~/code/masterfiles# cf-agent -B 192.168.123.1
      2014-02-14T15:01:40+0100 error: Couldn't find a private key at '/var/cfengine/ppkeys/localhost.priv', use cf-key to get one. (fopen: No such file or directory)
      2014-02-14T15:01:40+0100 warning: No public/private key pair is loaded, trying to reload
      2014-02-14T15:01:40+0100 error: Couldn't find a private key at '/var/cfengine/ppkeys/localhost.priv', use cf-key to get one. (fopen: No such file or directory)
      2014-02-14T15:01:40+0100 error: No public/private key pair found
      2014-02-14T15:01:40+0100 error: Couldn't find a private key at '/var/cfengine/ppkeys/localhost.priv', use cf-key to get one. (fopen: No such file or directory)
      Segmentation fault (core dumped)
      2014-02-14T15:01:40+0100 error: Policy failed validation with command '"/var/cfengine/bin/cf-promises" -c "/var/cfengine/inputs/failsafe.cf"'
      R: Could not find key at /var/cfengine/ppkeys/localhost.pub
      R: This host assumes the role of policy server
      2014-02-14T15:01:40+0100 error: Bootstrapping failed, no input file at '/var/cfengine/inputs/promises.cf' after bootstrap
      (precise)root@cflu-10040:~/code/masterfiles#
      </pre>

      cf-promises is apparently segfaulting with this backtrace:
      <pre>
      Program terminated with signal 11, Segmentation fault.
      #0 HashPubKey (key=0x0, digest=0x7fff61f32fb0 "P<P\002",
      type=HASH_METHOD_SHA256) at files_hashes.c:131
      131 if (key->n)
      (gdb) bt
      #0 HashPubKey (key=0x0, digest=0x7fff61f32fb0 "P<P\002",
      type=HASH_METHOD_SHA256) at files_hashes.c:131
      #1 0x00007f9e5121ec8c in PolicyHubUpdateKeys (
      policy_server=0x2503b10 "192.168.123.1") at crypto.c:197
      #2 0x00007f9e5123d926 in GenericAgentInitialize (ctx=0x24ea010,
      config=0x24eaf40) at generic_agent.c:950
      #3 0x00007f9e5123df9b in GenericAgentDiscoverContext (ctx=0x24ea010,
      config=0x24eaf40) at generic_agent.c:114
      #4 0x000000000040221a in main (argc=3, argv=0x7fff61f38408)
      at cf-promises.c:127
      </pre>

      It doesn't affect the package, since it provides keys out of the box, but it's still pretty bad.

        Attachments

          Activity

            People

            • Assignee:
              a10025 Volker Hilsheimer (Inactive)
              Reporter:
              a10040 Kristian Amlie
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel