kryptco / kr

DEPRECATED A dev tool for SSH auth + Git commit/tag signing using a key stored in Krypton.
https://krypt.co/developers/
Other
1.59k stars 109 forks source link

Installer script fails on Linux subsystem for Windows #238

Open jasperweiss opened 6 years ago

jasperweiss commented 6 years ago

Ubuntu 18.04 LTS on Windows 10 (Linux subsystem for Windows) fails to complete the installer script.

curl https://krypt.co/kr | sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 8289 100 8289 0 0 102k 0 --:--:-- --:--:-- --:--:-- 102k [sudo] password for user: Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'apt' instead of 'apt-transport-https' apt is already the newest version (1.6.3). dirmngr is already the newest version (2.2.4-1ubuntu1.1). software-properties-common is already the newest version (0.96.24.32.4). The following package was automatically installed and is no longer required: libfreetype6 Use 'sudo apt autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. kr: Adding KryptCo signing key... Executing: /tmp/apt-key-gpghome.nGqKKhmNLd/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C4A05888A1C4FA02E1566F859F2A29A569653940 gpg: connecting dirmngr at '/tmp/apt-key-gpghome.nGqKKhmNLd/S.dirmngr' failed: IPC connect call failed gpg: keyserver receive failed: No dirmngr kr: command failed: sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C4A05888A1C4FA02E1566F859F2A29A569653940 user@DESKTOP-T0PCSDF:~$

fbartels commented 6 years ago

According to https://github.com/Microsoft/WSL/issues/3286 this is a known issue in wsl. With the following modification to the install file the setup succeeds:

--- install-kr.orig     2018-10-24 15:53:32.494769600 +0200
+++ install-kr  2018-10-24 16:09:36.468622500 +0200
@@ -157,7 +157,7 @@
        need_cmd apt-key
        need_cmd sleep
        say Adding KryptCo signing key...
-       ensure sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C4A05888A1C4FA02E1566F859F2A29A569653940
+       ensure curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x9F2A29A569653940" | sudo apt-key add
        which kr && say Removing old version of kr...
        ignore sudo apt-get remove kr -y &>/dev/null
        say Adding KryptCo repository...

I did not find the source for that file in this repo, else I would have created a pr.

kcking commented 6 years ago

This approach is less desirable as it does not actually verify that the key coming back from the server corresponds to the provided key fingerprint. At a minimum I would suggest changing the http:// to https://, but that is still trusting the server to send back the correct key.

ghost commented 5 years ago

Installation script fails for me on a different step using Ubuntu WSL:

kr: command failed: sudo apt-get remove kr -y
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Get:1 https://kryptco.github.io/deb kryptco InRelease [3843 B]
Get:6 https://kryptco.github.io/deb kryptco/main amd64 Packages [619 B]
Fetched 4462 B in 10s (465 B/s)
Reading package lists... Done // STUCK HERE, I THEN PRESS ENTER
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
kr: Installing kr...
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package kr
kr: command failed: sudo apt-get install kr -y

This does not happen when using WLinux (Debian based) though.

iljapanic commented 5 years ago

Installation fails at the same stage

gpg: keyserver receive failed: No dirmngr

I have updated all the pagckages, including gpg but to no avail.

Any suggestions how to install Krypton on Ubuntu on WSL?

iljapanic commented 5 years ago

I have found a workaround by adjusting method from https://github.com/Microsoft/WSL/issues/3286#issuecomment-402594992

  1. install dependencies sudo apt-get install software-properties-common dirmngr apt-transport-https -y
  2. add repository sudo add-apt-repository "deb http://kryptco.github.io/deb kryptco main", you will get an error along the lines of The following signatures couldn't be verified because the public key is not available: NO_PUBKEYXXXXXXXXXXX
  3. add key with curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xXXXXXXXXXXX | sudo apt-key add, replacing XXXXXXXXXXX with the pubkey from step 2, keep the 0x at the beginning
  4. sudo apt-get update
  5. sudo apt-get install kr -y
fbartels commented 5 years ago

Hi @iljapanic ,

which means that you have come to the exact same conclusion as I have in https://github.com/kryptco/kr/issues/238#issuecomment-432673432 ;-)

Even if that may not be 100% as secure (yes one valid change to my patch above is to get the key through https) "works" is always better than "does not work" imho.

eengelking commented 5 years ago

@fbartels Out of curiosity, once you get it to install, does kr pair work for you? I see the daemon running, etc, but it never seems to pair despite it working successfully in normal Linux and macOS terminals. Just a timeout with the error:

Timed out. Please make sure Bluetooth is on or you have an internet connection and try again.

Bluetooth is on and Internet is fine.

fbartels commented 5 years ago

Hi @eengelking,

I just tried this on a windows box where I did not previously had kr installed. On this machine (still ubuntu xenial in wsl) I was able to successfully run kr pair.

eengelking commented 5 years ago

@fbartels Thanks for testing/trying for me. I tried again and it magically worked. I guess the service was just having issues when I made the attempt. Much appreciated!