Skip to content

Commit 29e8210

Browse files
authored
enabling support for wireguard and firewall (#2713)
* wip: enabling support for wireguard and firewall * wip * wip * wip * wip * wip * implement some things * fix warning * wip * alpha.23 * misc fixes * remove ufw since no longer required * remove debug info * add cli bindings * debugging * fixes * individualized acme and privacy settings for domains and bindings * sdk version bump * migration * misc fixes * refactor Host::update * debug info * refactor webserver * misc fixes * misc fixes * refactor port forwarding * recheck interfaces every 5 min if no dbus event * misc fixes and cleanup * misc fixes
1 parent 45ca940 commit 29e8210

File tree

144 files changed

+4872
-2392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+4872
-2392
lines changed

CLEARNET.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ GZIP_BIN := $(shell which pigz || which gzip)
2626
TAR_BIN := $(shell which gtar || which tar)
2727
COMPILED_TARGETS := core/target/$(ARCH)-unknown-linux-musl/release/startbox core/target/$(ARCH)-unknown-linux-musl/release/containerbox system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar container-runtime/rootfs.$(ARCH).squashfs
2828
ALL_TARGETS := $(STARTD_SRC) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) $(VERSION_FILE) $(COMPILED_TARGETS) cargo-deps/$(ARCH)-unknown-linux-musl/release/startos-backup-fs $(shell if [ "$(PLATFORM)" = "raspberrypi" ]; then echo cargo-deps/aarch64-unknown-linux-musl/release/pi-beep; fi) $(shell /bin/bash -c 'if [[ "${ENVIRONMENT}" =~ (^|-)unstable($$|-) ]]; then echo cargo-deps/$(ARCH)-unknown-linux-musl/release/tokio-console; fi') $(PLATFORM_FILE)
29+
REBUILD_TYPES = 1
2930

3031
ifeq ($(REMOTE),)
3132
mkdir = mkdir -p $1
@@ -226,7 +227,7 @@ container-runtime/node_modules/.package-lock.json: container-runtime/package.jso
226227
npm --prefix container-runtime ci
227228
touch container-runtime/node_modules/.package-lock.json
228229

229-
sdk/base/lib/osBindings/index.ts: core/startos/bindings/index.ts
230+
sdk/base/lib/osBindings/index.ts: $(shell if [ "$(REBUILD_TYPES)" -ne 0 ]; then echo core/startos/bindings/index.ts; fi)
230231
mkdir -p sdk/base/lib/osBindings
231232
rsync -ac --delete core/startos/bindings/ sdk/base/lib/osBindings/
232233
touch sdk/base/lib/osBindings/index.ts

build/dpkg-deps/depends

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ cryptsetup
1111
curl
1212
dnsutils
1313
dmidecode
14+
dnsutils
1415
dosfstools
1516
e2fsprogs
1617
ecryptfs-utils
@@ -57,4 +58,5 @@ systemd-timesyncd
5758
tor
5859
util-linux
5960
vim
61+
wireguard-tools
6062
wireless-tools

build/lib/scripts/dhclient-exit-hook

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/lib/scripts/enable-kiosk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44

55
# install dependencies
66
/usr/bin/apt update
7-
/usr/bin/apt install --no-install-recommends -y xserver-xorg x11-xserver-utils xinit firefox-esr matchbox-window-manager libnss3-tools
7+
/usr/bin/apt install --no-install-recommends -y xserver-xorg x11-xserver-utils xinit firefox-esr matchbox-window-manager libnss3-tools p11-kit-modules
88

99
#Change a default preference set by stock debian firefox-esr
1010
sed -i 's|^pref("extensions.update.enabled", true);$|pref("extensions.update.enabled", false);|' /etc/firefox-esr/firefox-esr.js
@@ -83,6 +83,8 @@ user_pref("toolkit.telemetry.updatePing.enabled", false);
8383
user_pref("toolkit.telemetry.cachedClientID", "");
8484
EOF
8585

86+
ln -sf /usr/lib/$(uname -m)-linux-gnu/pkcs11/p11-kit-trust.so /usr/lib/firefox-esr/libnssckbi.so
87+
8688
# create kiosk script
8789
cat > /home/kiosk/kiosk.sh << 'EOF'
8890
#!/bin/sh

container-runtime/src/Adapters/EffectCreator.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,6 @@ export function makeEffects(context: EffectContext): Effects {
216216
}) as ReturnType<T.Effects["getServiceInterface"]>
217217
},
218218

219-
getPrimaryUrl(...[options]: Parameters<T.Effects["getPrimaryUrl"]>) {
220-
return rpcRound("get-primary-url", {
221-
...options,
222-
callback: context.callbacks?.addCallback(options.callback) || null,
223-
}) as ReturnType<T.Effects["getPrimaryUrl"]>
224-
},
225219
getServicePortForward(
226220
...[options]: Parameters<T.Effects["getServicePortForward"]>
227221
) {

container-runtime/src/Adapters/RpcListener.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,22 @@ export class RpcListener {
212212
s.on("data", (a) =>
213213
Promise.resolve(a)
214214
.then((b) => b.toString())
215-
.then(logData("dataIn"))
216-
.then(jsonParse)
217-
.then(captureId)
218-
.then((x) => this.dealWithInput(x))
219-
.catch(mapError)
220-
.then(logData("response"))
221-
.then(writeDataToSocket)
222-
.catch((e) => {
223-
console.error(`Major error in socket handling: ${e}`)
224-
console.debug(`Data in: ${a.toString()}`)
215+
.then((buf) => {
216+
for (let s of buf.split("\n")) {
217+
if (s)
218+
Promise.resolve(s)
219+
.then(logData("dataIn"))
220+
.then(jsonParse)
221+
.then(captureId)
222+
.then((x) => this.dealWithInput(x))
223+
.catch(mapError)
224+
.then(logData("response"))
225+
.then(writeDataToSocket)
226+
.catch((e) => {
227+
console.error(`Major error in socket handling: ${e}`)
228+
console.debug(`Data in: ${a.toString()}`)
229+
})
230+
}
225231
}),
226232
)
227233
})
@@ -390,7 +396,7 @@ export class RpcListener {
390396

391397
.defaultToLazy(() => {
392398
console.warn(
393-
`Coudln't parse the following input ${JSON.stringify(input)}`,
399+
`Couldn't parse the following input ${JSON.stringify(input)}`,
394400
)
395401
return {
396402
jsonrpc,

container-runtime/src/Adapters/Systems/SystemForEmbassy/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ export class SystemForEmbassy implements System {
425425
name: interfaceValue.name,
426426
id: `${id}-${internal}`,
427427
description: interfaceValue.description,
428-
hasPrimary: false,
429428
type:
430429
interfaceValue.ui &&
431430
(origin.scheme === "http" || origin.sslScheme === "https")

container-runtime/src/Adapters/Systems/SystemForStartOs.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export class SystemForStartOs implements System {
7474
async exit(): Promise<void> {}
7575

7676
async start(effects: Effects): Promise<void> {
77+
if (this.runningMain) return
7778
effects.constRetry = utils.once(() => effects.restart())
78-
if (this.runningMain) await this.stop()
7979
let mainOnTerm: () => Promise<void> | undefined
8080
const started = async (onTerm: () => Promise<void>) => {
8181
await effects.setMainStatus({ status: "running" })
@@ -98,8 +98,11 @@ export class SystemForStartOs implements System {
9898

9999
async stop(): Promise<void> {
100100
if (this.runningMain) {
101-
await this.runningMain.stop()
102-
this.runningMain = undefined
101+
try {
102+
await this.runningMain.stop()
103+
} finally {
104+
this.runningMain = undefined
105+
}
103106
}
104107
}
105108
}

0 commit comments

Comments
 (0)