Skip to main content

Convert SSH config to Ananta hosts format (CSV or TOML)

Project description

Anata No Minato(あなたのみなと)

English | 简体中文 | 日本語

CI Unittest codecov CodeRabbit Pull Request Reviews PyPI - Version Python Version from PEP 621 TOML CodeQL OpenSSF Scorecard

This project is an attempt to packaging the Ananta with its runtime into a minimum, hardened docker image, while also providing a convenient way to use it.
It is recommended to bind mount the ${HOME}/.ssh/ into the container, and the container will automatically generate hosts.toml based on ~/.ssh/config for you.

Since it is routine for me to spend lot of my labour hours in an air-gapped environment, a docker image seems to be the best way to package some of my favourite tools.

How to start

Install the ananta helper script:

curl -sSLROJ --fail -- \
    "https://github.com/IceCodeNew/anata-no-minato/releases/latest/download/ananta"

# it is always a good idea to check the content of a script before executing it
cat ./ananta

sudo install -pvD ./ananta /usr/local/bin/
rm ./ananta

This helper script will automatically generate hosts.toml based on ~/.ssh/config, issue the command as below:
(omit the hosts.toml argument)

ananta -CS fastfetch

In case you want to specify an existing hosts.toml,
issue the command with the same arguments sequence as the original ananta command:

ananta -t arch hosts.toml sudo pacman -Syu --noconfirm

Hacking SSH Config for Ananta

Specify Tags

You can assign tags to hosts by including a #tags line in your SSH config. Separate multiple tags using either commas (,) or colons (:), as shown below:

Host mynas
    Hostname 1.1.1.1
    User root
    #tags tailscale,debian:nas,home

Excluding a Host from hosts.toml Generation

To exclude a host from the generated hosts.toml file, add the !ananta tag to its tags list. Any host marked with this tag will be skipped during the generation process.

Host do_not_ananta_in_this_host
    #tags home,debian,!ananta

Disabling the tags option

To disable a #tags line, simply add an extra # at the beginning, effectively re-enabling the SSH host.

Host will_ananta_in_this_host
    ##tags home,debian,!ananta

Why named "Anata No Minato"

My local disk already has too many git repositories named docker-XXX. Since I want to save a few keystrokes when jumping into this project directory, I won't name it docker-ananta. Ananta doesn't align with Chinese or Japanese pronunciation conventions. By omitting one 'n' it becomes the Japanese word Anata (あなた), which means "you" and gives me tab completion after typing just four letters.
Meanwhile, Minato (みなと) in Japanese means "harbor" - a natural association with Docker containers. When combined, these form the title of a classic Japanese enka song. Please take a listen to it ;-)

あなたのみなと~いい夫婦~ 松前ひろ子(2001)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sshconfig_to_ananta-2.1.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sshconfig_to_ananta-2.1.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file sshconfig_to_ananta-2.1.1.tar.gz.

File metadata

  • Download URL: sshconfig_to_ananta-2.1.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.25.9 CPython/3.13.7 Linux/6.11.0-1018-azure

File hashes

Hashes for sshconfig_to_ananta-2.1.1.tar.gz
Algorithm Hash digest
SHA256 80e341743507ae11e18a1df8288e6994b36e9fa63d8598979556b6ebb22b2043
MD5 4b8ab679272b4e7e7c976a5c64410a57
BLAKE2b-256 61d316fb46be2e613ef147adca08017f6a14085f88ef691728545cdc7b79d276

See more details on using hashes here.

File details

Details for the file sshconfig_to_ananta-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: sshconfig_to_ananta-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.25.9 CPython/3.13.7 Linux/6.11.0-1018-azure

File hashes

Hashes for sshconfig_to_ananta-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ac6fca2f4276b2fcafa17028f5cb781a318c97b548ad493f62d796887f36522
MD5 3d12885160ae88091badaddb3aa01483
BLAKE2b-256 b33cc19d9b28ee7d9b3d167b273a32a9349515fd5cc29c34741006ee61778b62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page