commit bc83084

hovercats  ·  2024-10-05 09:47:11 +0000 UTC
parent bc83084
initial /etc template
24 files changed,  +253, -0
A .perms
A fstab
A group
A hosts
A kshrc
A mtab
A passwd
A shadow
A .perms
+3, -0
1@@ -0,0 +1,3 @@
2+041755 rcsm/avail/
3+100400 doas.conf
4+100600 shadow
+21, -0
 1@@ -0,0 +1,21 @@
 2+MIT License
 3+
 4+Copyright (c) 2024 hovercats
 5+
 6+Permission is hereby granted, free of charge, to any person obtaining a copy
 7+of this software and associated documentation files (the "Software"), to deal
 8+in the Software without restriction, including without limitation the rights
 9+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+copies of the Software, and to permit persons to whom the Software is
11+furnished to do so, subject to the following conditions:
12+
13+The above copyright notice and this permission notice shall be included in all
14+copies or substantial portions of the Software.
15+
16+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+SOFTWARE.
+2, -0
1@@ -0,0 +1,2 @@
2+permit persist setenv { ENV=/etc/kshrc PS1 SSH_CONNECTION } :admin
3+permit nopass keepenv root
A fstab
+6, -0
1@@ -0,0 +1,6 @@
2+none /dev/pts devpts nosuid,noexec,relatime      0 0
3+none /dev/shm tmpfs nodev,nosuid,noexec          0 0
4+none /proc    proc nodev,noexec,nosuid,relatime  0 0
5+none /run     tmpfs nodev,noexec,nosuid,mode=755 0 0
6+none /sys     sysfs nodev,noexec,nosuid,relatime 0 0
7+none /tmp     tmpfs nodev,nosuid,relatime        0 0
A group
+9, -0
 1@@ -0,0 +1,9 @@
 2+root:x:0:root
 3+admin:x:1:root
 4+tty:x:2:
 5+disk:x:3:
 6+audio:x:4:
 7+video:x:5:
 8+input:x:6:
 9+sshd:x:100:
10+ntpd:x:102:
A hosts
+2, -0
1@@ -0,0 +1,2 @@
2+127.0.0.1 localhost.localdomain localhost
3+::1 localhost.localdomain localhost
+29, -0
 1@@ -0,0 +1,29 @@
 2+#!/bin/rc
 3+
 4+flag e +
 5+
 6+if(! ~ $ACTION add) exit
 7+
 8+fn chownmod {
 9+	chown $1 $3
10+	chmod $2 $3
11+}
12+
13+switch($DEVNAME) {
14+case dri/*
15+	chownmod :video 660 /dev/$DEVNAME
16+case input/*
17+	chownmod :input 660 /dev/$DEVNAME
18+case snd/*
19+	chownmod :audio 660 /dev/$DEVNAME
20+case fuse
21+	chmod 666 /dev/$DEVNAME
22+}
23+
24+switch($SUBSYSTEM) {
25+case hidraw
26+	switch(`{awk -F '=' '$1 == "HID_ID" {print $2}' /sys/$DEVPATH/device/uevent}) {
27+	case *:00001050:00000115 # Yubico Yubikey NEO U2F+CCID
28+		chownmod :sk 660 /dev/$DEVNAME
29+	}
30+}
A kshrc
+1, -0
1@@ -0,0 +1 @@
2+set -o vi
A mtab
+1, -0
1@@ -0,0 +1 @@
2+../proc/self/mounts
A passwd
+5, -0
1@@ -0,0 +1,5 @@
2+root:x:0:0:root:/root:/bin/ksh
3+log:x:100:100:Logging daemon:/var/empty:/bin/false
4+sshd:x:101:101:SSH daemon:/var/empty:/bin/false
5+ntpd:x:102:102:NTP daemon:/var/empty:/bin/false
6+
+20, -0
 1@@ -0,0 +1,20 @@
 2+umask 022
 3+
 4+export ENV=/etc/kshrc
 5+export PATH=/bin
 6+export MANPATH=/share/man
 7+export PAGER=cat
 8+export EDITOR=ed
 9+export PS1='\$ '
10+export XDG_RUNTIME_DIR=/tmp
11+
12+export KISS_SU=doas
13+export KISS_PATH=/src/oakiss/repo
14+
15+export CFLAGS="-I/usr/include"
16+export CXXFLAGS="-I/usr/include"
17+export LDFLAGS="-L/usr/lib"
18+
19+if [ -n "$SSH_CONNECTION" ] ; then
20+	PS1=$(hostname)$PS1
21+fi
+16, -0
 1@@ -0,0 +1,16 @@
 2+#!/bin/rc
 3+
 4+path=/bin
 5+
 6+umask 022
 7+
 8+mkdir /dev/pts
 9+mkdir /dev/shm
10+
11+mount -t proc none /proc
12+mount -o remount,rw /
13+mount -a
14+
15+/etc/rc.local
16+
17+exec rcsm -s
+5, -0
1@@ -0,0 +1,5 @@
2+#!/bin/rc
3+
4+ip link set wlan0 up &
5+
6+wait
+22, -0
 1@@ -0,0 +1,22 @@
 2+#!/bin/rc
 3+
 4+path=/bin
 5+
 6+killall5
 7+sleep 1
 8+killall5 -s KILL
 9+sleep 1
10+
11+mount -o remount,ro /
12+sync
13+
14+umount -a
15+
16+wait
17+
18+switch($1) {
19+case -p
20+	exec halt -p
21+case -r
22+	exec halt -r
23+}
+15, -0
 1@@ -0,0 +1,15 @@
 2+#!/bin/rc
 3+
 4+flag e +
 5+
 6+switch($1){
 7+case -s
 8+	while(){
 9+		/bin/getty /dev/tty1 linux && login
10+	} &
11+case -k
12+	exit 0
13+case *
14+	printf 'Usage: -s|-k\n'
15+	exit 1
16+}
+15, -0
 1@@ -0,0 +1,15 @@
 2+#!/bin/rc
 3+
 4+flag e +
 5+
 6+switch($1){
 7+case -s
 8+	while(){
 9+		/bin/getty /dev/tty2 linux && login
10+	} &
11+case -k
12+	exit 0
13+case *
14+	printf 'Usage: -s|-k\n'
15+	exit 1
16+}
+15, -0
 1@@ -0,0 +1,15 @@
 2+#!/bin/rc
 3+
 4+flag e +
 5+
 6+switch($1){
 7+case -s
 8+	while(){
 9+		/bin/getty /dev/tty3 linux && login
10+	} &
11+case -k
12+	exit 0
13+case *
14+	printf 'Usage: -s|-k\n'
15+	exit 1
16+}
+14, -0
 1@@ -0,0 +1,14 @@
 2+#!/bin/rc
 3+
 4+flag e +
 5+
 6+switch($1) {
 7+case -s
 8+	exec /usr/bin/ntpd -d > /tmp/.ntpd.log >[2=1]
 9+case -k
10+	PID=`{pidof ntpd}
11+	exec kill -9 $PID
12+case *
13+	printf 'Usage: -s|-k\n'
14+	exit 1
15+}
+14, -0
 1@@ -0,0 +1,14 @@
 2+#!/bin/rc
 3+
 4+flag e +
 5+
 6+switch($1) {
 7+case -s
 8+	exec sdhcp wlan0
 9+case -k
10+	PID=`{pidof sdhcp}
11+	exec kill -9 $PID
12+case *
13+	printf 'Usage: -s|-k\n'
14+	exit 1
15+}
+14, -0
 1@@ -0,0 +1,14 @@
 2+#!/bin/rc
 3+
 4+flag e +
 5+
 6+switch($1) {
 7+case -s
 8+	exec /usr/bin/sshd -D
 9+case -k
10+	PID=~{pidof sshd}
11+	exec kill -9 $PID
12+case *
13+	printf 'Usage: -s|-k\n'
14+	exit 1
15+}
+17, -0
 1@@ -0,0 +1,17 @@
 2+#!/bin/rc
 3+
 4+flag e +
 5+
 6+switch($1) {
 7+case -s
 8+	exec wpa_supplicant \
 9+		-B -iwlan0 \
10+		-c /etc/wpa_supplicant/wpa_supplicant.conf \
11+		>/tmp/.wpa_supplicant.log >[2=1]
12+case -k
13+	PID=`{pidof wpa_supplicant}
14+	exec kill -9 $PID
15+case *
16+	printf 'Usage: -s|-k\n'
17+	exit 1
18+}
A shadow
+4, -0
1@@ -0,0 +1,4 @@
2+root::::::::
3+log:!:::::::
4+sshd:!:::::::
5+ntpd:!:::::::
+2, -0
1@@ -0,0 +1,2 @@
2+PermitRootLogin no
3+Subsystem sftp /libexec/sftp-server
+1, -0
1@@ -0,0 +1 @@
2+../../share/cacert/cert.pem