From 477bfced7fdaa525f9cc7f13afdacb2a48f07379 Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Mon, 23 Apr 2018 00:23:36 -0400 Subject: Massive changes, ssh and Nginx work! Bump to 4.16.3 in /boot/syslinux.cfg Add `ssh`, `nobody`, and `nogroup`, in `/etc/passwd` and `/etc/group` Updated the init script to use `mdev` Added a service definition for a getty on tty0 Added a service definition for sshd Added busybox udhcpc `default.script` I *still need to check the license* ( Copied from my Gentoo installation, and works ) Updated readme.md to reflect the fact that we pull in the commands from `pfx` and you'll need to add `/lib/ld-musl-x86_64.so.1` or change the PATH in `./inc` Added rsync, ncdu xz and grub. Removed tar-pfx.sh Replaced with cpio-pfx.sh added `conf.sh` which will be taking care of basic system configuration for now Change configuration directory for libressl Enable wide chars in `ncurses` Use `/etc` for SSH configuration files Remove make clean from tree.sh and xz.sh Added relevant files to sources.lst --- local/boot/syslinux.cfg | 8 ++--- local/etc/group | 3 ++ local/etc/passwd | 2 ++ local/etc/runit/1 | 20 ++++++------ local/etc/sv/getty-tty0/run | 4 +++ local/etc/sv/sshd/run | 3 ++ local/usr/share/udhcpc/default.script | 59 +++++++++++++++++++++++++++++++++++ 7 files changed, 85 insertions(+), 14 deletions(-) create mode 100755 local/etc/sv/getty-tty0/run create mode 100755 local/etc/sv/sshd/run create mode 100644 local/usr/share/udhcpc/default.script (limited to 'local') diff --git a/local/boot/syslinux.cfg b/local/boot/syslinux.cfg index f5ef39c..34fa6ac 100644 --- a/local/boot/syslinux.cfg +++ b/local/boot/syslinux.cfg @@ -4,13 +4,13 @@ TIMEOUT 50 DEFAULT linux-runit LABEL linux-runit - LINUX /boot/vmlinuz-4.16.2 - APPEND root=/dev/vda1 rw init=/sbin/runit-init console=tty0 console=ttyS0,11500n8 + LINUX /boot/vmlinuz-4.16.3 + APPEND root=/dev/vda1 rw init=/sbin/runit-init quiet console=tty0 console=ttyS0,11500n8 LABEL linux-mksh - LINUX /boot/vmlinuz-4.16.2 + LINUX /boot/vmlinuz-4.16.3 APPEND root=/dev/vda1 rw init=/bin/mksh console=tty0 console=ttyS0,11500n8 LABEL linux - LINUX /boot/vmlinuz-4.16.2 + LINUX /boot/vmlinuz-4.16.3 APPEND root=/dev/vda1 rw init=/sbin/init console=tty0 console=ttyS0,11500n8 diff --git a/local/etc/group b/local/etc/group index 18acc30..0146ee7 100644 --- a/local/etc/group +++ b/local/etc/group @@ -1 +1,4 @@ root:x:0:root +ssh:x:22: +nogroup:x:65533: +nobody:x:65534: diff --git a/local/etc/passwd b/local/etc/passwd index 7710014..cf4d7f7 100644 --- a/local/etc/passwd +++ b/local/etc/passwd @@ -1 +1,3 @@ root:x:0:0:root:/root:/bin/mksh +sshd:x:22:22:sshd:/var/empty:/bin/false +nobody:x:65534:65534:nobody:/var/empty:/bin/false diff --git a/local/etc/runit/1 b/local/etc/runit/1 index 671b689..b22c9ef 100755 --- a/local/etc/runit/1 +++ b/local/etc/runit/1 @@ -2,26 +2,26 @@ . /etc/profile -printf "Starting *MIN*imum system\n" +set -x -mkdir -p /dev -mountpoint -q /dev || mount -t devtmpfs dev /dev -o mode=0755,nosuid -mkdir -p /dev/pts -mountpoint -q /dev/pts || mount -n -t devpts devpts /dev/pts -o mode=0620,gid=5,nosuid,noexec,noatime +printf "Starting *MIN*imum system\n" mkdir -p /proc /sys mountpoint -q /proc || mount -t proc proc /proc -o nosuid,noexec,nodev,hidepid=2 mountpoint -q /sys || mount -t sysfs sys /sys -o nosuid,noexec,nodev -mkdir -p /dev/shm -mountpoint -q /dev/shm || mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev,noatime +mkdir -p /dev/pts +mountpoint -q /dev/pts || mount -n -t devpts devpts /dev/pts -o \ + mode=0620,gid=5,nosuid,noexec,noatime +mdev -s -# It's going to be interesting to figure out what this one does. -ln -s /proc/self/fd /dev/fd +mkdir -p /dev/shm +mountpoint -q /dev/shm || mount -n -t tmpfs shm /dev/shm -o \ + mode=1777,nosuid,nodev,noatime mountpoint -q /sys/fs/cgroup || mount -n -t cgroup nodev /sys/fs/cgroup printf "Setting up loopback.\n" [ -d /sys/class/net/lo ] && ifconfig lo up - +if [ -e /etc/net ] ; then . /etc/net ; fi diff --git a/local/etc/sv/getty-tty0/run b/local/etc/sv/getty-tty0/run new file mode 100755 index 0000000..4fd121c --- /dev/null +++ b/local/etc/sv/getty-tty0/run @@ -0,0 +1,4 @@ +#!/bin/sh +. /etc/profile + +getty tty0 38400 vt100 diff --git a/local/etc/sv/sshd/run b/local/etc/sv/sshd/run new file mode 100755 index 0000000..8e5081a --- /dev/null +++ b/local/etc/sv/sshd/run @@ -0,0 +1,3 @@ +#!/bin/sh +ssh-keygen -A +/usr/sbin/sshd -D diff --git a/local/usr/share/udhcpc/default.script b/local/usr/share/udhcpc/default.script new file mode 100644 index 0000000..b2fe4a3 --- /dev/null +++ b/local/usr/share/udhcpc/default.script @@ -0,0 +1,59 @@ +#!/bin/sh +# udhcpc script edited by Tim Riker + +RESOLV_CONF="/etc/resolv.conf" + +[ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; } + +NETMASK="" +[ -n "$subnet" ] && NETMASK="netmask $subnet" +BROADCAST="broadcast +" +[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" + +case "$1" in + deconfig) + echo "Setting IP address 0.0.0.0 on $interface" + ifconfig $interface 0.0.0.0 + ;; + + renew|bound) + echo "Setting IP address $ip on $interface" + ifconfig $interface $ip $NETMASK $BROADCAST + + if [ -n "$router" ] ; then + echo "Deleting routers" + while route del default gw 0.0.0.0 dev $interface ; do + : + done + + metric=0 + for i in $router ; do + echo "Adding router $i" + if [ "$subnet" = "255.255.255.255" ]; then + # special case for /32 subnets: + # /32 instructs kernel to always use routing for all outgoing packets + # (they can never be sent to local subnet - there is no local subnet for /32). + # Used in datacenters, avoids the need for private ip-addresses between two hops. + ip route add $i dev $interface + fi + route add default gw $i dev $interface metric $((metric++)) + done + fi + + echo "Recreating $RESOLV_CONF" + # If the file is a symlink somewhere (like /etc/resolv.conf + # pointing to /run/resolv.conf), make sure things work. + realconf=$(readlink -f "$RESOLV_CONF" 2>/dev/null || echo "$RESOLV_CONF") + tmpfile="$realconf-$$" + > "$tmpfile" + [ -n "$domain" ] && echo "search $domain" >> "$tmpfile" + for i in $dns ; do + echo " Adding DNS server $i" + echo "nameserver $i" >> "$tmpfile" + done + mv "$tmpfile" "$realconf" + ;; +esac + +exit 0 + -- cgit v1.2.3