mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
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
This commit is contained in:
@@ -121,9 +121,34 @@ function getAddresses(
|
||||
): MappedAddress[] {
|
||||
const addressInfo = serviceInterface.addressInfo
|
||||
|
||||
const hostnames =
|
||||
let hostnames =
|
||||
host.kind === 'multi' ? host.hostnameInfo[addressInfo.internalPort] : []
|
||||
|
||||
hostnames = hostnames.filter(
|
||||
h =>
|
||||
window.location.host === 'localhost' ||
|
||||
h.kind !== 'ip' ||
|
||||
h.hostname.kind !== 'ipv6' ||
|
||||
!h.hostname.value.startsWith('fe80::'),
|
||||
)
|
||||
if (window.location.host === 'localhost') {
|
||||
const local = hostnames.find(
|
||||
h => h.kind === 'ip' && h.hostname.kind === 'local',
|
||||
)
|
||||
if (local) {
|
||||
hostnames.unshift({
|
||||
kind: 'ip',
|
||||
networkInterfaceId: 'lo',
|
||||
public: false,
|
||||
hostname: {
|
||||
kind: 'local',
|
||||
port: local.hostname.port,
|
||||
sslPort: local.hostname.sslPort,
|
||||
value: 'localhost',
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
const addressesWithNames = hostnames.flatMap(h => {
|
||||
let name = ''
|
||||
|
||||
@@ -144,14 +169,14 @@ function getAddresses(
|
||||
|
||||
const addresses = utils.addressHostToUrl(addressInfo, h)
|
||||
if (addresses.length > 1) {
|
||||
return utils.addressHostToUrl(addressInfo, h).map(url => ({
|
||||
return addresses.map(url => ({
|
||||
name: `${name} (${new URL(url).protocol
|
||||
.replace(':', '')
|
||||
.toUpperCase()})`,
|
||||
url,
|
||||
}))
|
||||
} else {
|
||||
return utils.addressHostToUrl(addressInfo, h).map(url => ({
|
||||
return addresses.map(url => ({
|
||||
name,
|
||||
url,
|
||||
}))
|
||||
|
||||
@@ -58,25 +58,28 @@
|
||||
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-item>
|
||||
<ng-container *ngFor="let iface of server.ipInfo| keyvalue">
|
||||
<ion-item *tuiLet="iface.value.ipv4 as ipv4">
|
||||
<ion-label>
|
||||
<h2>{{ iface.key }} (IPv4)</h2>
|
||||
<p>{{ ipv4 || 'n/a' }}</p>
|
||||
</ion-label>
|
||||
<ion-button *ngIf="ipv4" slot="end" fill="clear" (click)="copy(ipv4)">
|
||||
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-item>
|
||||
<ion-item *tuiLet="iface.value.ipv6 as ipv6">
|
||||
<ion-label>
|
||||
<h2>{{ iface.key }} (IPv6)</h2>
|
||||
<p>{{ ipv6 || 'n/a' }}</p>
|
||||
</ion-label>
|
||||
<ion-button *ngIf="ipv6" slot="end" fill="clear" (click)="copy(ipv6)">
|
||||
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-item>
|
||||
<ng-container *ngFor="let iface of server.networkInterfaces | keyvalue">
|
||||
<ng-container *ngIf="(isLocalhost || iface.key !== 'lo') && iface.value.ipInfo">
|
||||
<ng-container *ngFor="let ipnet of iface.value.ipInfo.subnets">
|
||||
<ng-container *ngIf="!ipnet.includes('fe80::') || isLocalhost">
|
||||
<ion-item *tuiLet="ipnet.split('/')[0] as ipAddr">
|
||||
<ion-label>
|
||||
<h2>{{ iface.key }} ({{ ipAddr.includes("::") ? "IPv6" : "IPv4" }})</h2>
|
||||
<p>{{
|
||||
ipAddr.includes("fe80::")
|
||||
? "[" + ipAddr + "%" + iface.value.ipInfo.scopeId + "]"
|
||||
: ipAddr.includes("::")
|
||||
? "[" + ipAddr + "]"
|
||||
: ipAddr
|
||||
}}</p>
|
||||
</ion-label>
|
||||
<ion-button slot="end" fill="clear" (click)="copy(ipAddr)">
|
||||
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-item>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
||||
<ion-item-divider>Device Credentials</ion-item-divider>
|
||||
|
||||
@@ -14,6 +14,7 @@ import { DataModel } from 'src/app/services/patch-db/data-model'
|
||||
})
|
||||
export class ServerSpecsPage {
|
||||
readonly server$ = this.patch.watch$('serverInfo')
|
||||
readonly isLocalhost = window.location.host === 'localhost'
|
||||
|
||||
constructor(
|
||||
private readonly toastCtrl: ToastController,
|
||||
|
||||
@@ -1721,7 +1721,6 @@ export module Mock {
|
||||
serviceInterfaces: {
|
||||
ui: {
|
||||
id: 'ui',
|
||||
hasPrimary: false,
|
||||
masked: false,
|
||||
name: 'Web UI',
|
||||
description:
|
||||
@@ -1738,7 +1737,6 @@ export module Mock {
|
||||
},
|
||||
rpc: {
|
||||
id: 'rpc',
|
||||
hasPrimary: false,
|
||||
masked: false,
|
||||
name: 'RPC',
|
||||
description:
|
||||
@@ -1755,7 +1753,6 @@ export module Mock {
|
||||
},
|
||||
p2p: {
|
||||
id: 'p2p',
|
||||
hasPrimary: true,
|
||||
masked: false,
|
||||
name: 'P2P',
|
||||
description:
|
||||
@@ -1776,7 +1773,8 @@ export module Mock {
|
||||
abcdefg: {
|
||||
kind: 'multi',
|
||||
bindings: [],
|
||||
addresses: [],
|
||||
onions: [],
|
||||
domains: {},
|
||||
hostnameInfo: {
|
||||
80: [
|
||||
{
|
||||
@@ -1829,7 +1827,8 @@ export module Mock {
|
||||
public: false,
|
||||
hostname: {
|
||||
kind: 'ipv6',
|
||||
value: '[FE80:CD00:0000:0CDE:1257:0000:211E:729CD]',
|
||||
value: '[fe80:cd00:0000:0cde:1257:0000:211e:72cd]',
|
||||
scopeId: 2,
|
||||
port: null,
|
||||
sslPort: 1234,
|
||||
},
|
||||
@@ -1840,7 +1839,8 @@ export module Mock {
|
||||
public: false,
|
||||
hostname: {
|
||||
kind: 'ipv6',
|
||||
value: '[FE80:CD00:0000:0CDE:1257:0000:211E:1234]',
|
||||
value: '[fe80:cd00:0000:0cde:1257:0000:211e:1234]',
|
||||
scopeId: 3,
|
||||
port: null,
|
||||
sslPort: 1234,
|
||||
},
|
||||
@@ -1859,7 +1859,8 @@ export module Mock {
|
||||
bcdefgh: {
|
||||
kind: 'multi',
|
||||
bindings: [],
|
||||
addresses: [],
|
||||
onions: [],
|
||||
domains: {},
|
||||
hostnameInfo: {
|
||||
8332: [],
|
||||
},
|
||||
@@ -1867,7 +1868,8 @@ export module Mock {
|
||||
cdefghi: {
|
||||
kind: 'multi',
|
||||
bindings: [],
|
||||
addresses: [],
|
||||
onions: [],
|
||||
domains: {},
|
||||
hostnameInfo: {
|
||||
8333: [],
|
||||
},
|
||||
@@ -1914,7 +1916,6 @@ export module Mock {
|
||||
serviceInterfaces: {
|
||||
ui: {
|
||||
id: 'ui',
|
||||
hasPrimary: false,
|
||||
masked: false,
|
||||
name: 'Web UI',
|
||||
description: 'A launchable web app for Bitcoin Proxy',
|
||||
@@ -1960,7 +1961,6 @@ export module Mock {
|
||||
serviceInterfaces: {
|
||||
grpc: {
|
||||
id: 'grpc',
|
||||
hasPrimary: false,
|
||||
masked: false,
|
||||
name: 'GRPC',
|
||||
description:
|
||||
@@ -1977,7 +1977,6 @@ export module Mock {
|
||||
},
|
||||
lndconnect: {
|
||||
id: 'lndconnect',
|
||||
hasPrimary: false,
|
||||
masked: true,
|
||||
name: 'LND Connect',
|
||||
description:
|
||||
@@ -1994,7 +1993,6 @@ export module Mock {
|
||||
},
|
||||
p2p: {
|
||||
id: 'p2p',
|
||||
hasPrimary: true,
|
||||
masked: false,
|
||||
name: 'P2P',
|
||||
description:
|
||||
|
||||
@@ -41,21 +41,32 @@ export const mockPatchData: DataModel = {
|
||||
lastBackup: new Date(new Date().valueOf() - 604800001).toISOString(),
|
||||
lanAddress: 'https://adjective-noun.local',
|
||||
torAddress: 'https://myveryownspecialtoraddress.onion',
|
||||
ipInfo: {
|
||||
networkInterfaces: {
|
||||
eth0: {
|
||||
ipv4: '10.0.0.1',
|
||||
ipv4Range: '10.0.0.1/24',
|
||||
ipv6: null,
|
||||
ipv6Range: null,
|
||||
public: false,
|
||||
ipInfo: {
|
||||
scopeId: 1,
|
||||
deviceType: 'ethernet',
|
||||
subnets: ['10.0.0.1/24'],
|
||||
wanIp: null,
|
||||
ntpServers: [],
|
||||
},
|
||||
},
|
||||
wlan0: {
|
||||
ipv4: '10.0.90.12',
|
||||
ipv4Range: '10.0.90.12/24',
|
||||
ipv6: 'FE80:CD00:0000:0CDE:1257:0000:211E:729CD',
|
||||
ipv6Range: 'FE80:CD00:0000:0CDE:1257:0000:211E:729CD/64',
|
||||
public: false,
|
||||
ipInfo: {
|
||||
scopeId: 2,
|
||||
deviceType: 'wireless',
|
||||
subnets: [
|
||||
'10.0.90.12/24',
|
||||
'FE80:CD00:0000:0CDE:1257:0000:211E:729CD/64',
|
||||
],
|
||||
wanIp: null,
|
||||
ntpServers: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
acme: null,
|
||||
acme: {},
|
||||
unreadNotificationCount: 4,
|
||||
// password is asdfasdf
|
||||
passwordHash:
|
||||
@@ -140,7 +151,6 @@ export const mockPatchData: DataModel = {
|
||||
serviceInterfaces: {
|
||||
ui: {
|
||||
id: 'ui',
|
||||
hasPrimary: false,
|
||||
masked: false,
|
||||
name: 'Web UI',
|
||||
description:
|
||||
@@ -157,7 +167,6 @@ export const mockPatchData: DataModel = {
|
||||
},
|
||||
rpc: {
|
||||
id: 'rpc',
|
||||
hasPrimary: false,
|
||||
masked: false,
|
||||
name: 'RPC',
|
||||
description:
|
||||
@@ -174,7 +183,6 @@ export const mockPatchData: DataModel = {
|
||||
},
|
||||
p2p: {
|
||||
id: 'p2p',
|
||||
hasPrimary: true,
|
||||
masked: false,
|
||||
name: 'P2P',
|
||||
description:
|
||||
@@ -195,7 +203,8 @@ export const mockPatchData: DataModel = {
|
||||
abcdefg: {
|
||||
kind: 'multi',
|
||||
bindings: [],
|
||||
addresses: [],
|
||||
onions: [],
|
||||
domains: {},
|
||||
hostnameInfo: {
|
||||
80: [
|
||||
{
|
||||
@@ -248,7 +257,8 @@ export const mockPatchData: DataModel = {
|
||||
public: false,
|
||||
hostname: {
|
||||
kind: 'ipv6',
|
||||
value: '[FE80:CD00:0000:0CDE:1257:0000:211E:729CD]',
|
||||
value: '[fe80:cd00:0000:0cde:1257:0000:211e:72cd]',
|
||||
scopeId: 2,
|
||||
port: null,
|
||||
sslPort: 1234,
|
||||
},
|
||||
@@ -259,7 +269,8 @@ export const mockPatchData: DataModel = {
|
||||
public: false,
|
||||
hostname: {
|
||||
kind: 'ipv6',
|
||||
value: '[FE80:CD00:0000:0CDE:1257:0000:211E:1234]',
|
||||
value: '[fe80:cd00:0000:0cde:1257:0000:211e:1234]',
|
||||
scopeId: 3,
|
||||
port: null,
|
||||
sslPort: 1234,
|
||||
},
|
||||
@@ -278,7 +289,8 @@ export const mockPatchData: DataModel = {
|
||||
bcdefgh: {
|
||||
kind: 'multi',
|
||||
bindings: [],
|
||||
addresses: [],
|
||||
onions: [],
|
||||
domains: {},
|
||||
hostnameInfo: {
|
||||
8332: [],
|
||||
},
|
||||
@@ -286,7 +298,8 @@ export const mockPatchData: DataModel = {
|
||||
cdefghi: {
|
||||
kind: 'multi',
|
||||
bindings: [],
|
||||
addresses: [],
|
||||
onions: [],
|
||||
domains: {},
|
||||
hostnameInfo: {
|
||||
8333: [],
|
||||
},
|
||||
@@ -335,7 +348,6 @@ export const mockPatchData: DataModel = {
|
||||
serviceInterfaces: {
|
||||
grpc: {
|
||||
id: 'grpc',
|
||||
hasPrimary: false,
|
||||
masked: false,
|
||||
name: 'GRPC',
|
||||
description:
|
||||
@@ -352,7 +364,6 @@ export const mockPatchData: DataModel = {
|
||||
},
|
||||
lndconnect: {
|
||||
id: 'lndconnect',
|
||||
hasPrimary: false,
|
||||
masked: true,
|
||||
name: 'LND Connect',
|
||||
description:
|
||||
@@ -369,7 +380,6 @@ export const mockPatchData: DataModel = {
|
||||
},
|
||||
p2p: {
|
||||
id: 'p2p',
|
||||
hasPrimary: true,
|
||||
masked: false,
|
||||
name: 'P2P',
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user