From 0ba5024474d0641ac39cbe2d1ea588aa9ad32e7e Mon Sep 17 00:00:00 2001 From: TolaMironcenko Date: Sat, 2 Nov 2024 11:06:54 +0700 Subject: [PATCH] added configs and services and dropbear --- etc/default/dropbear | 3 ++ etc/dnsmasq.conf | 6 ++++ etc/dnsmasq.conf.d/hosts | 1 + etc/dnsmasq.conf.d/resolv.conf | 1 + etc/group | 4 +++ etc/hosts | 2 ++ etc/inittab | 11 ++++++ etc/issue | 11 ++++++ etc/network/interfaces | 16 +++++++++ etc/openrouter/dns/status | 1 + etc/openrouter/ftp/path | 1 + etc/openrouter/ftp/status | 1 + etc/openrouter/ssh/port | 1 + etc/openrouter/ssh/status | 1 + etc/openrouter/telnet/port | 1 + etc/openrouter/telnet/status | 1 + etc/openrouter/wifi/status | 1 + etc/passwd | 4 +++ etc/profile | 25 +++++++++++++ etc/shadow | 4 +++ etc/shells | 2 ++ usr/bin/pm | 14 ++++---- usr/bin/rc | 2 +- usr/lib/init/init-funcs.sh | 6 ++-- usr/lib/init/services/dropbear.service | 38 ++++++++++++++++++++ usr/lib/init/services/openrouterinit.service | 0 usr/share/rc/orders | 3 +- 27 files changed, 149 insertions(+), 12 deletions(-) create mode 100644 etc/default/dropbear create mode 100644 etc/dnsmasq.conf create mode 100644 etc/dnsmasq.conf.d/hosts create mode 100644 etc/dnsmasq.conf.d/resolv.conf create mode 100644 etc/group create mode 100644 etc/hosts create mode 100644 etc/inittab create mode 100644 etc/issue create mode 100644 etc/network/interfaces create mode 100644 etc/openrouter/dns/status create mode 100644 etc/openrouter/ftp/path create mode 100644 etc/openrouter/ftp/status create mode 100644 etc/openrouter/ssh/port create mode 100644 etc/openrouter/ssh/status create mode 100644 etc/openrouter/telnet/port create mode 100644 etc/openrouter/telnet/status create mode 100644 etc/openrouter/wifi/status create mode 100644 etc/passwd create mode 100644 etc/profile create mode 100644 etc/shadow create mode 100644 etc/shells create mode 100755 usr/lib/init/services/dropbear.service mode change 100644 => 100755 usr/lib/init/services/openrouterinit.service diff --git a/etc/default/dropbear b/etc/default/dropbear new file mode 100644 index 0000000..0fffb13 --- /dev/null +++ b/etc/default/dropbear @@ -0,0 +1,3 @@ +DROPBEAR_PORT=22 +DROPBEAR_EXTRA_ARGS="-E -R -B -m" +ENABLE_ROOT_LOGIN="yes" \ No newline at end of file diff --git a/etc/dnsmasq.conf b/etc/dnsmasq.conf new file mode 100644 index 0000000..7dcb9a1 --- /dev/null +++ b/etc/dnsmasq.conf @@ -0,0 +1,6 @@ +interface=eth1 +dhcp-range=interface:eth1,192.168.200.2,192.168.200.100,12h +dhcp-range=interface:wlan0,192.168.201.2,192.168.201.100,12h +resolv-file=/etc/dnsmasq.conf.d/resolv.conf +addn-hosts=/etc/dnsmasq.conf.d/hosts +cache-size=10000 \ No newline at end of file diff --git a/etc/dnsmasq.conf.d/hosts b/etc/dnsmasq.conf.d/hosts new file mode 100644 index 0000000..aa19a08 --- /dev/null +++ b/etc/dnsmasq.conf.d/hosts @@ -0,0 +1 @@ +192.168.200.1 router.local.com \ No newline at end of file diff --git a/etc/dnsmasq.conf.d/resolv.conf b/etc/dnsmasq.conf.d/resolv.conf new file mode 100644 index 0000000..bb781c9 --- /dev/null +++ b/etc/dnsmasq.conf.d/resolv.conf @@ -0,0 +1 @@ +nameserver 8.8.8.8 \ No newline at end of file diff --git a/etc/group b/etc/group new file mode 100644 index 0000000..a298035 --- /dev/null +++ b/etc/group @@ -0,0 +1,4 @@ +root:x:0:root +dnsmasq:x:963:dnsmasq +sshd:x:33:sshd +nobody:x:65534: \ No newline at end of file diff --git a/etc/hosts b/etc/hosts new file mode 100644 index 0000000..3f29fac --- /dev/null +++ b/etc/hosts @@ -0,0 +1,2 @@ +127.0.0.1 localhost +::1 localhost \ No newline at end of file diff --git a/etc/inittab b/etc/inittab new file mode 100644 index 0000000..b2e73e8 --- /dev/null +++ b/etc/inittab @@ -0,0 +1,11 @@ +::sysinit:/etc/init.d/rcS + +::ctrlaltdel:/sbin/reboot +::shutdown:/etc/init.d/rcK + +tty1::respawn:/usr/bin/getty 38400 tty1 +tty2::respawn:/usr/bin/getty 38400 tty2 +tty3::respawn:/usr/bin/getty 38400 tty3 +tty4::respawn:/usr/bin/getty 38400 tty4 + +ttyS0::respawn:/usr/bin/getty 115200 ttyS0 \ No newline at end of file diff --git a/etc/issue b/etc/issue new file mode 100644 index 0000000..209cfd0 --- /dev/null +++ b/etc/issue @@ -0,0 +1,11 @@ +\h \r (\l) +########## ## #### #### ########## ## ########## +########## ## #### #### ########## ## ########## +## ## ## ## ## ## ## ## ## +## ## ## ## ## ## ## ## ## ## +########## ## ## ## ## ########## ## ########## +########## ## ## ## ## ########## ## ########## + ## ## ## ## ## ## ## + ## ## ## ## ## ## ## +########## ## ## ## ## ########## ########## +########## ## ## ## ## ########## ########## diff --git a/etc/network/interfaces b/etc/network/interfaces new file mode 100644 index 0000000..d8c9c8a --- /dev/null +++ b/etc/network/interfaces @@ -0,0 +1,16 @@ +#--- Loopback interface --- +auto lo +iface lo inet loopback +#-------------------------- + +#--- eth0 connected to the internet dhcp --- +# auto eth0 +# iface eth0 inet dhcp +#------------------------------------------- + +#--- eth0 connected to the internet static --- +# auto eth0 +# iface eth0 inet static +# address 192.168.200.1 +# netmask 255.255.255.0 +#--------------------------------------------- diff --git a/etc/openrouter/dns/status b/etc/openrouter/dns/status new file mode 100644 index 0000000..c227083 --- /dev/null +++ b/etc/openrouter/dns/status @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/etc/openrouter/ftp/path b/etc/openrouter/ftp/path new file mode 100644 index 0000000..35ec3b9 --- /dev/null +++ b/etc/openrouter/ftp/path @@ -0,0 +1 @@ +/ \ No newline at end of file diff --git a/etc/openrouter/ftp/status b/etc/openrouter/ftp/status new file mode 100644 index 0000000..c227083 --- /dev/null +++ b/etc/openrouter/ftp/status @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/etc/openrouter/ssh/port b/etc/openrouter/ssh/port new file mode 100644 index 0000000..8fdd954 --- /dev/null +++ b/etc/openrouter/ssh/port @@ -0,0 +1 @@ +22 \ No newline at end of file diff --git a/etc/openrouter/ssh/status b/etc/openrouter/ssh/status new file mode 100644 index 0000000..c227083 --- /dev/null +++ b/etc/openrouter/ssh/status @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/etc/openrouter/telnet/port b/etc/openrouter/telnet/port new file mode 100644 index 0000000..b393560 --- /dev/null +++ b/etc/openrouter/telnet/port @@ -0,0 +1 @@ +23 \ No newline at end of file diff --git a/etc/openrouter/telnet/status b/etc/openrouter/telnet/status new file mode 100644 index 0000000..c227083 --- /dev/null +++ b/etc/openrouter/telnet/status @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/etc/openrouter/wifi/status b/etc/openrouter/wifi/status new file mode 100644 index 0000000..c227083 --- /dev/null +++ b/etc/openrouter/wifi/status @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/etc/passwd b/etc/passwd new file mode 100644 index 0000000..72f2cb6 --- /dev/null +++ b/etc/passwd @@ -0,0 +1,4 @@ +root:x:0:0:root:/root:/bin/sh +dnsmasq:x:963:963:dnsmasq daemon:/:/usr/bin/nologin +sshd:x:33:33:SSH daemon:/var/lib/sshd:/bin/sh +nobody:x:65534:65534:Kernel Oerflow User:/:/usr/bin/nologin \ No newline at end of file diff --git a/etc/profile b/etc/profile new file mode 100644 index 0000000..9845f19 --- /dev/null +++ b/etc/profile @@ -0,0 +1,25 @@ +#!/bin/sh + +#--- import colors --- +. /usr/lib/init/colors.sh +#--------------------- + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/.local/bin + +export PS1="$BGREEN** \u@\h: \$(date +%d.%m.%Y) \t\n\w \\\$ $RESET" +[ $(id -u) -eq 0 ] && export PS1="$BRED** \u@\h: \$(date +%d.%m.%Y) \t\n\w \\\$ $RESET" + +#--- sys --- +alias psa='busybox ps' # show all processes +alias c='clear' # clear terminal screen +alias e='echo' # print in terminal +alias s='source' # source +alias una='uname -a' # system name +alias ifcnf='ifconfig' # ifconfig +alias ipr='ip route' # show routes +alias ipa='ip addr' # show addresses +alias ipl='ip link' # show links +alias ll='ls -lh' # show list files with information +alias la='ls -a' +alias l='ls -alh' +#----------- diff --git a/etc/shadow b/etc/shadow new file mode 100644 index 0000000..a559900 --- /dev/null +++ b/etc/shadow @@ -0,0 +1,4 @@ +root:F.fHA5x2Q.xNY:19797:::::: +dnsmasq:!*:19889:::::: +sshd:!:19906:0:99999:7::: +nobody:!*:19889:::::: \ No newline at end of file diff --git a/etc/shells b/etc/shells new file mode 100644 index 0000000..2cc1c7e --- /dev/null +++ b/etc/shells @@ -0,0 +1,2 @@ +/usr/bin/sh +/usr/bin/ash \ No newline at end of file diff --git a/usr/bin/pm b/usr/bin/pm index d5fb9c6..84724b0 100755 --- a/usr/bin/pm +++ b/usr/bin/pm @@ -12,7 +12,7 @@ ## ## ## #---------------- variables -------------------------- -rootdir=$(pwd) +rootdir=/ repofile=$rootdir/etc/pm/repo packagesqueryfile=$rootdir/usr/share/pm/query reposquerydir=$rootdir/usr/share/pm/repos @@ -245,22 +245,22 @@ clear() { #------------------------------------------------------------------------ case "$1" in - add) + add|a|-a) add $* ;; - down) + down|download) down $2 ;; - unpack) + unpack|u|-u) unpack $2 ;; - del) + del|d|-d) del $* ;; - list) + list|l|-l) list $2 ;; - query) + query|q|-q) query ;; help) diff --git a/usr/bin/rc b/usr/bin/rc index 70f7292..12d0f6a 100755 --- a/usr/bin/rc +++ b/usr/bin/rc @@ -11,7 +11,7 @@ ## ########## ## ########## -rootdir=$(pwd) +rootdir=/ #----- colors ------- . $rootdir/usr/lib/init/colors.sh diff --git a/usr/lib/init/init-funcs.sh b/usr/lib/init/init-funcs.sh index 3831ef6..4ccaa8b 100644 --- a/usr/lib/init/init-funcs.sh +++ b/usr/lib/init/init-funcs.sh @@ -54,15 +54,15 @@ help() { #------------ check status function ------------ check() { if [ $1 -ne 0 ]; then - printf "$BBLUE**$BRED ERROR: $2\n$RESET" + printf "$BBLUE**$BWHITE $2 [$BRED ERROR $RESET]\n$RESET" return fi - printf "$BBLUE**$BGREEN SUCCESS: $2\n$RESET" + printf "$BBLUE**$BWHITE $2 [$BGREEN SUCCESS $RESET]\n$RESET" } #----------------------------------------------- #--- notify func --- notify() { - printf "$BBLUE**$BGREEN $1\n$RESET" + printf "$BBLUE**$BWHITE $1\n$RESET" } #------------------- diff --git a/usr/lib/init/services/dropbear.service b/usr/lib/init/services/dropbear.service new file mode 100755 index 0000000..dbc522d --- /dev/null +++ b/usr/lib/init/services/dropbear.service @@ -0,0 +1,38 @@ +#!/bin/sh + +#--- import colors and init-funcs --- +. /usr/lib/init/colors.sh +. /usr/lib/init/init-funcs.sh +#------------------------------------ + +. /etc/default/dropbear + +ENABLE_ROOT_LOGIN_ARGS="" + +if [ "$ENABLE_ROOT_LOGIN" = "no" ]; then + ENABLE_ROOT_LOGIN_ARGS="-w -g" +fi + +start() { + notify "Starting dropbear" + /usr/bin/dropbear -P /var/run/dropbear.pid $DROPBEAR_EXTRA_ARGS $ENABLE_ROOT_LOGIN_ARGS -p $DROPBEAR_PORT &> /var/log/dropbear.log + check $? "start dropbear" + return $? +} + +stop() { + notify "Stopping dropbear" + kill $(cat /var/run/dropbear.pid) + check $? "stop dropbear" + return $? +} + +case "$1" in + start|stop|restart|reload|help) + "$1" + ;; + *) + help + ;; +esac +return $? diff --git a/usr/lib/init/services/openrouterinit.service b/usr/lib/init/services/openrouterinit.service old mode 100644 new mode 100755 diff --git a/usr/share/rc/orders b/usr/share/rc/orders index 4076dcd..5be61d9 100644 --- a/usr/share/rc/orders +++ b/usr/share/rc/orders @@ -13,4 +13,5 @@ 13hostapd 14httpd 15nginx -16openrouterinit \ No newline at end of file +16openrouterinit +17dropbear \ No newline at end of file