Kc needs libbsd

kc is a console based password storing application using an encrypted XML document as its database.

It has a clean and simple command line interface and works on *BSD and Linux.

Features include:

  • fixed string or regex based search
  • OpenSSH agent support for protecting the database
  • YubiKey challenge-response support for protecting the database
  • encrypted or plain text database import/export
  • multiple keychains per database
  • copy passwords to various clipboards
  • editline (libedit) and readline support

I’m using it in Linux, FreeBSD and OpenBSD at the moment.

The install guide mentions:

Prerequisites

  • libbsd >= 0.2.0 (except on BSDs, of course)
  • libxml >= 2.6
  • libedit or libreadline
  • openssl >= 1.1.1

Optional

  • libpcre >= 8.12 <= 10.0 (i.e. not PCRE2)
  • libscrypt >= 1.14

For YubiKey support

Would it be possible for someone with knowledge to port this software to Haiku?
I searched libbsd and couldn’t find it.
Would libbsd be the show stopper?
Is it planned to be ported to Haiku or not at all?

For the record: this seems to be kc’s main repo. (@lib1 if you know a better one, let us know!)

libbsd.so should not be a problem, as it comes with Haiku.

The one I can’t find already on HaikuPorts is libscrypt, but (after just a quick glance) it may not take too long to get it working (and it’s optional, so no show-stoppper there).

I’ll try to give it a go later today, assuming I can stop coughing :mask:. If not, surely this might pick the interest of someone else over HaikuPorts :-).

2 Likes

quick update:

After some “quick-and-dirty” hacks, recipe compiles, but build fails at linking stage: missing some symbols (be64toh/ htobe64) that Haiku defines in headers/compatibility/bsd/endian.h, but not on develop/headers/bsd/endian.h. Mmm.

Also missing is arc4random_buf, available in the freebsd compat layer for drivers, but I don’t think that’s exposed to user-space code.

Might be a good idea to see if we have better luck with the mentioned optional libscrypt.so, instead of relying on kc’s bcrypt lib (that where the mentioned issues came from).

Or I just suck at this, and just need to try harder :-D.

Just in case… early work-in-progress branch.

1 Like

Seems I’d mistaken the optional libscrypt as a drop-in replacement for the included bcrypt, which it is not. HAVE_LIBSCRYPT=y do “Turn on scrypt KDF support”, but the included bcrypt code is still used (and that requires arc4random_buf()).

That means that, AFAICT, we’re stuck, as there’s no arc4random functionality currently available for user-space code (see topic: Arc4random, where are you?).

Helping with that is far above my limited skills so… sorry for not being of more help with kc. :frowning:

I think you can define them like this: https://github.com/haikuports/haikuports/blob/master/net-dns/bind_utils/patches/bind_utils-9.16.42.patchset

Perhaps this can be of use haikuports/www-client/ladybird/patches/serenity-pre20220728.patchset at master · haikuports/haikuports · GitHub

2 Likes

Shouldn’t be too hard :slight_smile:

~/wip/kc> kc
Creating '/boot/home/.kc/default.kcd'
Using '/boot/home/.kc/default.kcd' database.

Path could be set to ~/config/settings/kc with a small change, I’ll let @BiPolar tackle this further :rofl:

2 Likes

Thanks a lot @Diver! Much appreciated!

And thanks to @Begasus too, of course :slight_smile:

I’ll give it another go ASAP.

3 Likes

Can’t connect to the irc server (oftc.net looks down for me), so, leaving this here…

PR open as: kc: new recipe by OscarL · Pull Request #9278 · haikuports/haikuports · GitHub

Thanks again for the help, @Diver and @Begasus!

2 Likes

Hey @lib1!

You should be able to install kc with pkgman install kc (or with pkgman install kc_x86 if you’re using the 32-bits version of Haiku) now.

Particularities of this version:

  • Settings/db files are stored not under ~/.kc/, but ~/config/settings/kc/. (man page patched too to reflect that change).
  • Uses editline/libedit instead of readline (like it does under Linux). This seems to cause some glitches when line-editing, how noticeable/annoying those are… depends on what you do/expect I guess. Let us know if it is too broken :smiley: (we can switch it to readline, if we don’t find some other fix/alternative).
  • Patched away the use of arc4random_buf(), should not affect kc, as far as I can tell.

I’ve ran the tests that comes with kc. 30 passed, 3 skipped, none failed. Did some quick manual test… seems relatively sane to me, so…

As you have experience with it… let us know what you think/find. (once we iron-out the wrinkles, would be nice to upstream the small changes).

5 Likes

Hi @BiPolar ,

Great, great work!
I thank you and all other that have helped.

kc is indeed working, I could manage to open one database that I was using in a Linux machine.

The line-editing seems really nice.
For example, pressing c k then tab lists all keychains that start with letter k, so that I can choose the one I want to change (c) to.

From my part, it’s ready to upstream.
Maybe kc will acquire a lot of Haiku users…

All the best!

4 Likes