summaryrefslogtreecommitdiff
path: root/nonprism/hostname-blanker
diff options
context:
space:
mode:
authorGaming4JC <g4jc@openmailbox.org>2017-01-07 17:15:56 -0500
committerGaming4JC <g4jc@openmailbox.org>2017-01-07 17:15:56 -0500
commitf11691c637f27c032f2136abada397fc11253946 (patch)
tree1da24f210d7acec05156634d5fe1ed23750f6e7b /nonprism/hostname-blanker
parentc24bdf38fe89d74cfad9cc41a03de18a94159b28 (diff)
add hostname-blanker
Diffstat (limited to 'nonprism/hostname-blanker')
-rw-r--r--nonprism/hostname-blanker/PKGBUILD22
-rw-r--r--nonprism/hostname-blanker/hostname-blanker.service11
-rw-r--r--nonprism/hostname-blanker/hostname-blanker.sh11
3 files changed, 44 insertions, 0 deletions
diff --git a/nonprism/hostname-blanker/PKGBUILD b/nonprism/hostname-blanker/PKGBUILD
new file mode 100644
index 000000000..25ebfb596
--- /dev/null
+++ b/nonprism/hostname-blanker/PKGBUILD
@@ -0,0 +1,22 @@
+# Maintainer: Luke R. <g4jc@openmailbox.org> GPG: rsa4096/3EAE8697
+
+pkgname=hostname-blanker
+pkgver=0.1
+pkgrel=1
+pkgdesc="Service that removes computer hostname by setting it to localhost on startup, hence sending nothing to the network."
+arch=(any)
+license=(GPL2)
+depends=('systemd')
+replaces=('hostname-protection')
+provides=('hostname-protection')
+source=('hostname-blanker.sh'
+'hostname-blanker.service')
+sha512sums=('3f14d58fe05ab521594f2f48aaf0124c019b079a7fad267b70e5e0fd8cc08860edbaebeb68149de1599355845c17e4f5229d7664b74604e70d3f36b18c05b63a'
+'a8ee4b8e663daa0c282176852fdc1ca76ac48c19d2571bd898ea31f522d7233078c1cfc2775e7838964ede35179cf5c7e591431c7420a80a2fc6d75366d24bd8')
+whirlpoolsums=('01a554f1dad6a49adf99faea21fc4e622a2af3f0d4001b80adde30daf255e46f69d22cd94142d70d5984bcd7ac234e38bab507c919827709d799e6d808c02b2d'
+'ee2f8a3cff99d387ed223579b688663995ff626f784ea74ea5bcc70eca797472cf535f6cfe74665dcde6f297205c86b5613361f02bd1ed0081f26913391f3c2c')
+
+package() {
+ install -Dm755 hostname-blanker.sh "$pkgdir"/opt/hostname-blanker.sh
+ install -Dm644 "$srcdir/hostname-blanker.service" "$pkgdir/usr/lib/systemd/system/hostname-blanker.service"
+}
diff --git a/nonprism/hostname-blanker/hostname-blanker.service b/nonprism/hostname-blanker/hostname-blanker.service
new file mode 100644
index 000000000..3e5362b3a
--- /dev/null
+++ b/nonprism/hostname-blanker/hostname-blanker.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Sets hostname before network comes online
+Before=network-pre.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/bash /opt/hostname-blanker
+RemainAfterExit=false
+
+[Install]
+WantedBy=network-pre.target
diff --git a/nonprism/hostname-blanker/hostname-blanker.sh b/nonprism/hostname-blanker/hostname-blanker.sh
new file mode 100644
index 000000000..ecdcfd4b4
--- /dev/null
+++ b/nonprism/hostname-blanker/hostname-blanker.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# This script wipes hostname so that DHCP can't send it over the network
+#hostnamectl set-hostname localhost
+echo "localhost" > /etc/hostname
+wait
+sed -i '/127.0.0.1/c\127.0.0.1 localhost.localdomain localhost 'localhost'' /etc/hosts ##properly sets our new host in /etc/hosts file
+wait
+sysctl kernel.hostname=localhost
+wait
+hostname localhost ##avoids need to reboot before showing our new hostname in terminals etc.
+wait