Coder Social home page Coder Social logo

libnss-mac-mdns's Introduction

libnss-mac-mdns

Test

This project is dedicated to enable containers on a Docker subnetwork to lookup macOS compatible mDNS domain names by the low level Name Service Switch (NSS). So when a request from the host system is routed into the Docker subnetwork, with a domain like app.local.mac and the compatibility jump host was able to resolve the correct mDNS domain (app.local) everything is fine. But when the subnetwork internal applications start using the macOS compatibility domain (.mac suffix), things get messy. The lookup is doomed to fail, because nobody responds to the .mac suffix domain. Thats where this plugin jumps into. We allow domain resolution with the .mac suffix in place by using the Avahi client, just like a jump host.

Requirements

Usecase

libnss-mac-mdns

Getting started

First you need to clone this repository from Github:

# Clone the repository
$ git clone https://github.com/hausgold/libnss-mac-mdns.git
# Go in the repository directory
$ cd libnss-mac-mdns

We assume you have prepared the requirements in advance. The only thing which is left, is to build, install and use the NSS plugin:

# Build the NSS plugin from source
$ make build
# Install the NSS plugin into your system
$ sudo make install

After the successful installation of the plugin you can configure it. Just edit your /etc/nsswitch.conf file with system permissions and change the hosts configuration like this:

hosts: [..all your stuff..] mac_mdns

Just make sure that mac_mdns is before dns.

Usage

We assume you have a running mDNS stack on every Docker container you use, and/or on your host system is an Avahi mDNS server running. Just make sure your mDNS stack is working properly and can resolve domains like app.local.

When you installed and configured the libnss-mac-mdns library, you can start resolving .mac suffixed domains.

# Lookup a regular mDNS domain
$ getent hosts app.local
# => 172.17.0.17

# Lookup the macOS compatibility domain
$ getent hosts app.local.mac
# => 172.17.0.17

As you can see here, we just allow both resolutions, without touching the mDNS configuration at all.

Testing

So if you like to start developing, just make your changes, and run make test and you should be able to validate your changes. The only requirement to make this work, is the configuration on the /etc/nsswitch.conf file, just like described above. (hard requirement for the tests)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hausgold/libnss-mac-mdns.

Credits

This project was heavily inspired by Danielle Madeley excellent docker-nss library. We also had a deeper look at the following projects to get our thing going:

libnss-mac-mdns's People

Contributors

jack12816 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.