From 5b76275984dd572e9fafde0cdaada76c87dc8f69 Mon Sep 17 00:00:00 2001 From: Muhamad Azmy Date: Mon, 4 Mar 2019 11:53:48 +0200 Subject: [PATCH 1/3] Start a getty on tty3 --- apps/core0/conf/getty.toml | 22 ++++++++++++++++++++++ tools/direct-login.sh | 7 +++++++ 2 files changed, 29 insertions(+) create mode 100644 apps/core0/conf/getty.toml create mode 100755 tools/direct-login.sh diff --git a/apps/core0/conf/getty.toml b/apps/core0/conf/getty.toml new file mode 100644 index 00000000..246e8ea7 --- /dev/null +++ b/apps/core0/conf/getty.toml @@ -0,0 +1,22 @@ +# NOTICE: +# This file will give any user with physical access to the node +# full access to the system, include in the image on your own risk +# +# busybox setsid getty -I -n -l /sbin/login.sh 0 /dev/tty3 + +[startup.getty] +name = 'core.system' +after = ['init'] +condition = 'development' +# the job is not marked as protected, instead we respawn the shell +# from the direct-login.sh script, because busybox setsid doesn't +# support the -w flag (wait for process to exit), it means with protected=true +# the system will keep spawning gettys infinitely. + +[startup.getty.args] +name = "busybox" +args = [ + 'setsid', + 'getty', '-l', '/usr/bin/direct-login.sh', + '0', '/dev/tty3' +] \ No newline at end of file diff --git a/tools/direct-login.sh b/tools/direct-login.sh new file mode 100755 index 00000000..7b2525cc --- /dev/null +++ b/tools/direct-login.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# this script relates to the core0/conf/getty.toml file +while true; do + /bin/sh + echo "respawing shell" +done From 3f957ca10c38cc8cb9deca5d2484ad35af64ceca Mon Sep 17 00:00:00 2001 From: Muhamad Azmy Date: Mon, 4 Mar 2019 16:08:05 +0200 Subject: [PATCH 2/3] Initialize zt later --- apps/core0/bootstrap/bootstrap.go | 2 +- apps/core0/conf/zerotier.toml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/core0/bootstrap/bootstrap.go b/apps/core0/bootstrap/bootstrap.go index 055099a9..44ee976a 100644 --- a/apps/core0/bootstrap/bootstrap.go +++ b/apps/core0/bootstrap/bootstrap.go @@ -209,7 +209,7 @@ func (b *Bootstrap) setupNetworking() error { <-time.After(3 * time.Second) } - log.Warning("can not reach interent, continue booting anyway") + log.Warning("can not reach internet, continue booting anyway") return nil } diff --git a/apps/core0/conf/zerotier.toml b/apps/core0/conf/zerotier.toml index 5be55118..7fbd271f 100644 --- a/apps/core0/conf/zerotier.toml +++ b/apps/core0/conf/zerotier.toml @@ -4,7 +4,6 @@ [startup."zerotier-init"] name = "bash" running_delay = -1 -after = ["init"] [startup."zerotier-init".args] "not(ztid)|script" = """ @@ -21,7 +20,7 @@ chmod 0400 /tmp/zt/identity.secret [startup.zerotier] name = "core.system" -after = ["net", "zerotier-init"] +after = ["zerotier-init"] protected = true [startup.zerotier.args] From c7922ca1c38beae802a87f8f7b2c4b4deacd9f6b Mon Sep 17 00:00:00 2001 From: Muhamad Azmy Date: Thu, 7 Mar 2019 11:34:20 +0200 Subject: [PATCH 3/3] Add debug flag to ztid --- apps/core0/conf/zerotier.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/core0/conf/zerotier.toml b/apps/core0/conf/zerotier.toml index 7fbd271f..6fbdc9e2 100644 --- a/apps/core0/conf/zerotier.toml +++ b/apps/core0/conf/zerotier.toml @@ -7,7 +7,7 @@ running_delay = -1 [startup."zerotier-init".args] "not(ztid)|script" = """ -ztid -out /tmp/zt +ztid -debug -out /tmp/zt """ "ztid|script" = """