Andrés J. Díaz

dothosts


Latest stable relases:

Source:releases/dothosts-0.1.tar.gz
Signature:releases/dothosts-0.1.tar.gz.asc

Show all releases
Github page

Contents:


README

libdothosts.so
==============

The dothosts library is a LD_PRELOAD based library which allows you to
have a user based hosts file.

The library will catch all calls to gethostbyname(3), gethostbyname2(3),
getaddrinfo(3),gethostbyname_r(3) and gethostbyname2_r(3) and perform
a search of the requested host in a local (i.e. a file into home user
directory) to resolve the hostname. If not found in this file, then proceed
with the regular resolv mechanism.

---- Install ---------------------------------------------------------------

make && make test && make install

If you want to use the 'dothosts' helper, just copy the script to your path.
The make install proccess will not copy helper script.

---- Usage -----------------------------------------------------------------

To use dothosts just type:

  export LD_PRELOAD=path/to/libdothosts.so

And then new applications will use ~/.hosts file as /etc/hosts (the original
/etc/hosts will be also used if host does not match in ~/.hosts).

Aditionally, environment variable DOTHOSTS will use to change the path of
local .hosts file, for exaple:

  export DOTHOSTS=~/.config/hosts

You can use the dothost utility to run an application with library loaded,
in the form:

  dothosts wget http://test

---- Limitations ----------------------------------------------------------

- Only works for programs that use glibc calls to resolve hostnames.
- No working for SUID programs for security reasons.

---- Development ----------------------------------------------------------

For bug report please fill a issue in the github project [1], or send an
email to ajdiaz+dothosts at ajdiaz.me

[1] https://github.com/ajdiaz/dothosts/issues

Any pull-request is also welcome.


Happy Hacking!

CONTRIBUTE

The source code of the project is managed by git, you can clone it in the usual way:

git clone https://git.ajdiaz.me/dothosts

A mirror in github is also available, but keep in mind that could be out of date.

If you find any error in the code or incorrect behaviour, please do not hesitate to report it in the devel mailing list: dothosts-devel@lists.ajdiaz.me.

Please note that you need to subscribe to the list prior to post to avoid spam, just send an empty email to help@lists.ajdiaz.me with the text subscribe dothosts-devel in the subject.

Please submit the patches via mailing list. You can read how to in this email + git guide

Any suggestion, discussion or improvement are welcome, just mail to the list!


LICENSE

The MIT License (MIT)

Copyright (c) 2017 Andrés J. Díaz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Andrés J. Díaz <ajdiaz at ajdiaz.me>.
GPG Key: 4D851F4ECDCFD81EF6AB2FC6021D2DCF8575C18B. GPG Key Signing Policy.
Gopher server