skx / knownfs

A FUSE-based filesystem that exports ~/.ssh/known_hosts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Report Card license Release

Table of Contents

KnownFS

A simple FUSE-based filesystem which exports the contents of ~/.ssh/known_hosts.

For every hostname listed in your known_hosts file this filesystem will create a directory, and that directory will contain a single file holding the servers' SSH-fingerprint.

Installation

There are two ways to install this project from source, which depend on the version of the go version you're using.

If you just need the binaries you can find them upon the project release page.

Source Installation go <= 1.11

If you're using go before 1.11 then the following command should fetch/update the project and install it upon your system:

 $ go get -u github.com/skx/knownfs

Source installation go >= 1.12

If you're using a more recent version of go (which is highly recommended), you need to clone to a directory which is not present upon your GOPATH:

git clone https://github.com/skx/knownfs
cd knownfs
go install

Usage:

Make a directory for the filesystem, and mount it like so:

 $ mkdir ~/knownfs/
 $ knownfs ~/knownfs/

In another window:

 $ ls -1 ~/knownfs/

You should see a single subdirectory for each hostname listed in your ~/.ssh/known_hosts file, and inside the directory you'll find a file named fingerprint with the hosts' fingerprint.

Once you're done you will need to unmount the mount-point. If you have fusermount installed you can do so like this:

  $ fusermount -u ~/knownfs/

If not you'll need root permissions to unmount the end-point:

  $ sudo umount ~/knownfs/

Options

By default you'll see entries for each host found, whether those entries are hostnames or IP addresses. For example on my own system I see this:

  frodo ~/knownfs $ ls | head -n 5
  10.0.0.10
  10.10.10.100
  10.10.10.20
  10.10.10.97
  10.10.10.98

I prefer to only view real hosts, so I exclude IPv4/IPv6-based entries like so:

  $ knownfs -hosts-only

That gives me just hostnames:

  $ ls | head -5
  blogspam.blogspam.net
  blogspam.net
  blog.steve.fi
  builder.steve.org.uk
  builder.vpn

You can also specify the path to an alternative known_hosts file, with -config /path/to/file.

Github Setup

This repository is configured to run tests upon every commit, and when pull-requests are created/updated. The testing is carried out via .github/run-tests.sh which is used by the github-action-tester action.

Releases are automated in a similar fashion via .github/build, and the github-action-publish-binaries action.

Steve

About

A FUSE-based filesystem that exports ~/.ssh/known_hosts

License:GNU General Public License v2.0


Languages

Language:Go 100.0%