Skip to content

Instantly share code, notes, and snippets.

View MarisElsins's full-sized avatar

Maris Elsins MarisElsins

View GitHub Profile
@MarisElsins
MarisElsins / fakehostname.c
Created February 11, 2020 07:31
An LD_PRELOAD library that fakes the hostname output in `hostname` and `uname commands`
// gcc -fPIC -shared -Wl,-soname,libfakehostname.so.1 -ldl -o /usr/lib64/libfakehostname.so.1 fakehostname.c
// gcc -m32 -fPIC -shared -Wl,-soname,libfakehostname.so.1 -ldl -o /usr/lib/libfakehostname.so.1 fakehostname.c
// export LD_PRELOAD=libfakehostname.so.1
// export FAKEHOSTNAME=myfakehostname.domain.com
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <unistd.h>
[Maris.Win10] ➤ vagrant box add --name ol-latest https://yum.oracle.com/boxes/oraclelinux/latest/ol7-latest.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'ol-latest' (v0) for provider:
box: Downloading: https://yum.oracle.com/boxes/oraclelinux/latest/ol7-latest.box
box:
==> box: Successfully added box 'ol-latest' (v0) for 'virtualbox'!
[Maris.Win10] ➤ mkdir -p ~/96_VAGRANT/OL-docker
[Maris.Win10] ➤ cd ~/96_VAGRANT/OL-docker