{"id":20510335,"url":"https://github.com/frobware/nss-juju","last_synced_at":"2025-04-13T22:33:35.893Z","repository":{"id":66961082,"uuid":"67019590","full_name":"frobware/nss-juju","owner":"frobware","description":"Name Service Switch (NSS) plugin for Juju","archived":false,"fork":false,"pushed_at":"2017-02-18T20:20:03.000Z","size":42,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T11:14:19.589Z","etag":null,"topics":["c","dns","internet-address-resolution","ipv4","juju","juju-charm","linux","nss","service-switch"],"latest_commit_sha":null,"homepage":"","language":"M4","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frobware.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-31T08:40:09.000Z","updated_at":"2021-02-21T02:10:22.000Z","dependencies_parsed_at":"2023-05-14T05:45:18.038Z","dependency_job_id":null,"html_url":"https://github.com/frobware/nss-juju","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frobware%2Fnss-juju","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frobware%2Fnss-juju/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frobware%2Fnss-juju/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frobware%2Fnss-juju/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frobware","download_url":"https://codeload.github.com/frobware/nss-juju/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248790729,"owners_count":21162081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","dns","internet-address-resolution","ipv4","juju","juju-charm","linux","nss","service-switch"],"created_at":"2024-11-15T20:29:06.036Z","updated_at":"2025-04-13T22:33:35.869Z","avatar_url":"https://github.com/frobware.png","language":"M4","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/frobware/nss-juju.svg?branch=master)](https://travis-ci.org/frobware/nss-juju)\n[![Coverage Status](https://coveralls.io/repos/github/frobware/nss-juju/badge.svg?branch=master)](https://coveralls.io/github/frobware/nss-juju?branch=master)\n[![Coverage status](https://codecov.io/gh/frobware/nss-juju/branch/master/graph/badge.svg)](https://codecov.io/gh/frobware/nss-juju)\n\n# Name Service Switch (NSS) module for Juju (Proof of Concept).\n\nThis Name Service Switch (NSS) module provides internet address\nresolution for Juju encoded hostnames.\n\n## Supporting Juju charms\n\nSome charms require a hostname in lieu of an IP address to work\nproperly. To support this you can use ```network-get\n--primary-hostname``` in a charm hook to get an always-resolvable\nhostname. Internet address resolution is provided by this plugin.\n\nThe encoding of the name is *TBD* but this proof of concept currently\nsupports the following patterns:\n\n* IPv4\n\n\tjuju-ip-172-31-38-207\n\n* IPv6\n\n\tjuju-ip-2001-470-1f1d-8d8-c0db-9559-9417-2416\n\nIPv6 names must be fully expanded (i.e., no collapsed 0's (zeros)).\n\n### Juju Charm Example\n\n\t$ network-get --primary-hostname\n\tjuju-ip-192-168-20-1\n\n### General Address Resolution\n\n\t$ getent hosts juju-ip-192-168-20-1\n\t192.168.20.1    juju-ip-192-168-20-1\n\n\t$ ping -c 4 juju-ip-192-168-20-1\n\tPING juju-ip-192-168-20-1 (192.168.20.1) 56(84) bytes of data.\n\t64 bytes from 192.168.20.1: icmp_seq=1 ttl=64 time=0.069 ms\n\t64 bytes from 192.168.20.1: icmp_seq=2 ttl=64 time=0.052 ms\n\t64 bytes from 192.168.20.1: icmp_seq=3 ttl=64 time=0.048 ms\n\t64 bytes from 192.168.20.1: icmp_seq=4 ttl=64 time=0.048 ms\n\n## Limitations\n\n### Reverse lookup needs to be handled by the host\n\nThe module itself cannot be authoritative for arbitrary IP addresses,\nparticularly if the module is listed before the ```dns``` entry. It\ncan, however, rely on the host to do reverse lookup.\n\n#### Reverse lookup on AWS\n\n\t$ hostname\n\tip-172-31-0-139\n\n\t$ network-get --primary-hostname\n\tjuju-ip-172-31-0-139\n\n\t$ getent hosts juju-ip-172-31-0-139\n\t172.31.0.139    juju-ip-172-31-0-139\n\n\t# Reverse lookup\n\t$ dig -x 172.31.0.139 +short\n\tip-172-31-0-139.ec2.internal.\n\n\t# Forward lookup\n\t$ dig ip-172-31-0-139.ec2.internal. +short\n\t172.31.0.139\n\n#### Reverse lookup on GCE\n\nWorks and behaves the same way as AWS does.\n\n#### Reverse lookup on Azure\n\nReverse lookup does **not** work for private addresses.\n\n### Only IPv4 or IPv6 for a single hostname\n\nBecause the IP address is encoded in the name it is not (currently)\npossible to get both an IPv4 and IPv6 address associated for one\nhostname. Arguably, this can be fixed by encoding both addresses in\nthe name, but it doesn't read terribly well and may well break\nhostname limits.\n\n   $ juju-ip-172-31-38-207-2001-470-1f1d-8d8-c0db-9559-9417-2416\n\n# Building from source\n\nBuild from source requires the following packages be installed:\n\n\t$ sudo sh ./prerequisites.sh\n\nConfigure and build using autoconf:\n\n\t$ ./autogen.sh\n\t$ ./configure --prefix=/usr\n\t$ make\n\t$ sudo make install\n\t$ sudo ldconfig /usr/lib\n\n## Installing the module\n\nTo activate the NSS module, add ```juju``` to the line starting with\n```hosts``` in ```/etc/nsswitch.conf```. It is recommended to place\n```juju``` early in the list, but after the ```files``` entry.\n\nFor example:\n\n\t$ cat /etc/nsswitch.conf\n\n\tpasswd:         compat\n\tgroup:          compat\n\tshadow:         compat\n\tgshadow:        files\n\n\thosts:          files juju dns\n\tnetworks:       files\n\n\tprotocols:      db files\n\tservices:       db files\n\tethers:         db files\n\trpc:            db files\n\tnetgroup:       nis\n\nYou can verify the module is working using ```getent(1)```.\n\n\t$ getent hosts juju-ip-192-168-20-1\n\t192.168.20.1    juju-ip-192-168-20-1\n\nAnd if you had a machine with that address on your network you can\nping it by name:\n\n\t$ ping -c 4 juju-ip-192-168-20-1\n\tPING juju-ip-192-168-20-1 (192.168.20.1) 56(84) bytes of data.\n\t64 bytes from 192.168.20.1: icmp_seq=1 ttl=64 time=0.069 ms\n\t64 bytes from 192.168.20.1: icmp_seq=2 ttl=64 time=0.052 ms\n\t64 bytes from 192.168.20.1: icmp_seq=3 ttl=64 time=0.048 ms\n\t64 bytes from 192.168.20.1: icmp_seq=4 ttl=64 time=0.048 ms\n\nPlease read the [HACKING](HACKING.md) companion to this file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrobware%2Fnss-juju","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrobware%2Fnss-juju","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrobware%2Fnss-juju/lists"}