mirror of
https://github.com/tale/headplane.git
synced 2026-07-28 16:48:56 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 41b1d3c847 | |||
| 712fc28683 | |||
| 320dab1d4f | |||
| da0ee1382b | |||
| a7d127c7bf |
@@ -1,3 +1,9 @@
|
|||||||
|
### 0.3.7 (November 30, 2024)
|
||||||
|
- Allow customizing the OIDC token endpoint auth method via `OIDC_CLIENT_SECRET_METHOD` (fixes [#57](https://github.com/tale/headplane/issues/57))
|
||||||
|
- Added a `/healthz` endpoint for Kubernetes and other health checks (fixes [#59](https://github.com/tale/headplane/issues/59))
|
||||||
|
- Allow `HEADSCALE_PUBLIC_URL` to be set if `HEADSCALE_URL` points to a different internal address (fixes [#60](https://github.com/tale/headplane/issues/60))
|
||||||
|
- Fixed an issue where the copy machine registration command had a typo.
|
||||||
|
|
||||||
### 0.3.6 (November 20, 2024)
|
### 0.3.6 (November 20, 2024)
|
||||||
- Fixed an issue where select dropdowns would not scroll (fixes [#53](https://github.com/tale/headplane/issues/53))
|
- Fixed an issue where select dropdowns would not scroll (fixes [#53](https://github.com/tale/headplane/issues/53))
|
||||||
- Added a button to copy the machine registration command to the clipboard (fixes [#52](https://github.com/tale/headplane/issues/52))
|
- Added a button to copy the machine registration command to the clipboard (fixes [#52](https://github.com/tale/headplane/issues/52))
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default function Code(props: Props) {
|
|||||||
'inline-flex items-center justify-center'
|
'inline-flex items-center justify-center'
|
||||||
)}
|
)}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigator.clipboard.writeText(props.children as string)
|
navigator.clipboard.writeText(props.children.join(''))
|
||||||
toast('Copied to clipboard')
|
toast('Copied to clipboard')
|
||||||
setIsCopied(true)
|
setIsCopied(true)
|
||||||
setTimeout(() => setIsCopied(false), 1000)
|
setTimeout(() => setIsCopied(false), 1000)
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|||||||
users: users.users,
|
users: users.users,
|
||||||
magic,
|
magic,
|
||||||
server: context.headscaleUrl,
|
server: context.headscaleUrl,
|
||||||
|
publicServer: context.headscalePublicUrl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +74,10 @@ export default function Page() {
|
|||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<NewMachine server={data.server} users={data.users} />
|
<NewMachine
|
||||||
|
server={data.publicServer ?? data.server}
|
||||||
|
users={data.users}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<table className="table-auto w-full rounded-lg">
|
<table className="table-auto w-full rounded-lg">
|
||||||
<thead className="text-gray-500 dark:text-gray-400">
|
<thead className="text-gray-500 dark:text-gray-400">
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|||||||
return {
|
return {
|
||||||
keys: preAuthKeys.flatMap(keys => keys.preAuthKeys),
|
keys: preAuthKeys.flatMap(keys => keys.preAuthKeys),
|
||||||
users: users.users,
|
users: users.users,
|
||||||
server: context.headscaleUrl,
|
server: context.headscalePublicUrl ?? context.headscaleUrl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { loadContext } from '~/utils/config/headplane'
|
||||||
|
import { HeadscaleError, pull } from '~/utils/headscale'
|
||||||
|
import log from '~/utils/log'
|
||||||
|
|
||||||
|
export async function loader() {
|
||||||
|
const context = await loadContext()
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Doesn't matter, we just need a 401
|
||||||
|
await pull('v1/', 'wrongkey')
|
||||||
|
} catch (e) {
|
||||||
|
if (!(e instanceof HeadscaleError)) {
|
||||||
|
log.debug('Healthz', 'Headscale is not reachable')
|
||||||
|
return new Response('Headscale is not reachable', {
|
||||||
|
status: 500,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response('OK', {
|
||||||
|
status: 200,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ import log from '~/utils/log'
|
|||||||
export interface HeadplaneContext {
|
export interface HeadplaneContext {
|
||||||
debug: boolean
|
debug: boolean
|
||||||
headscaleUrl: string
|
headscaleUrl: string
|
||||||
|
headscalePublicUrl?: string
|
||||||
cookieSecret: string
|
cookieSecret: string
|
||||||
integration: IntegrationFactory | undefined
|
integration: IntegrationFactory | undefined
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ export interface HeadplaneContext {
|
|||||||
client: string
|
client: string
|
||||||
secret: string
|
secret: string
|
||||||
rootKey: string
|
rootKey: string
|
||||||
|
method: string
|
||||||
disableKeyLogin: boolean
|
disableKeyLogin: boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,12 +57,18 @@ export async function loadContext(): Promise<HeadplaneContext> {
|
|||||||
const { config, contextData } = await checkConfig(path)
|
const { config, contextData } = await checkConfig(path)
|
||||||
|
|
||||||
let headscaleUrl = process.env.HEADSCALE_URL
|
let headscaleUrl = process.env.HEADSCALE_URL
|
||||||
|
let headscalePublicUrl = process.env.HEADSCALE_PUBLIC_URL
|
||||||
|
|
||||||
if (!headscaleUrl && !config) {
|
if (!headscaleUrl && !config) {
|
||||||
throw new Error('HEADSCALE_URL not set')
|
throw new Error('HEADSCALE_URL not set')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config) {
|
if (config) {
|
||||||
headscaleUrl = headscaleUrl ?? config.server_url
|
headscaleUrl = headscaleUrl ?? config.server_url
|
||||||
|
if (!headscalePublicUrl) {
|
||||||
|
// Fallback to the config value if the env var is not set
|
||||||
|
headscalePublicUrl = config.public_url
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!headscaleUrl) {
|
if (!headscaleUrl) {
|
||||||
@@ -75,6 +83,7 @@ export async function loadContext(): Promise<HeadplaneContext> {
|
|||||||
context = {
|
context = {
|
||||||
debug,
|
debug,
|
||||||
headscaleUrl,
|
headscaleUrl,
|
||||||
|
headscalePublicUrl,
|
||||||
cookieSecret,
|
cookieSecret,
|
||||||
integration: await loadIntegration(),
|
integration: await loadIntegration(),
|
||||||
config: contextData,
|
config: contextData,
|
||||||
@@ -83,6 +92,10 @@ export async function loadContext(): Promise<HeadplaneContext> {
|
|||||||
|
|
||||||
log.info('CTXT', 'Starting Headplane with Context')
|
log.info('CTXT', 'Starting Headplane with Context')
|
||||||
log.info('CTXT', 'HEADSCALE_URL: %s', headscaleUrl)
|
log.info('CTXT', 'HEADSCALE_URL: %s', headscaleUrl)
|
||||||
|
if (headscalePublicUrl) {
|
||||||
|
log.info('CTXT', 'HEADSCALE_PUBLIC_URL: %s', headscalePublicUrl)
|
||||||
|
}
|
||||||
|
|
||||||
log.info('CTXT', 'Integration: %s', context.integration?.name ?? 'None')
|
log.info('CTXT', 'Integration: %s', context.integration?.name ?? 'None')
|
||||||
log.info('CTXT', 'Config: %s', contextData.read
|
log.info('CTXT', 'Config: %s', contextData.read
|
||||||
? `Found ${contextData.write ? '' : '(Read Only)'}`
|
? `Found ${contextData.write ? '' : '(Read Only)'}`
|
||||||
@@ -143,6 +156,7 @@ async function checkOidc(config?: HeadscaleConfig) {
|
|||||||
let issuer = process.env.OIDC_ISSUER
|
let issuer = process.env.OIDC_ISSUER
|
||||||
let client = process.env.OIDC_CLIENT_ID
|
let client = process.env.OIDC_CLIENT_ID
|
||||||
let secret = process.env.OIDC_CLIENT_SECRET
|
let secret = process.env.OIDC_CLIENT_SECRET
|
||||||
|
let method = process.env.OIDC_CLIENT_SECRET_METHOD ?? 'client_secret_basic'
|
||||||
|
|
||||||
log.debug('CTXT', 'Checking OIDC environment variables')
|
log.debug('CTXT', 'Checking OIDC environment variables')
|
||||||
log.debug('CTXT', 'Issuer: %s', issuer)
|
log.debug('CTXT', 'Issuer: %s', issuer)
|
||||||
@@ -161,6 +175,7 @@ async function checkOidc(config?: HeadscaleConfig) {
|
|||||||
issuer,
|
issuer,
|
||||||
client,
|
client,
|
||||||
secret,
|
secret,
|
||||||
|
method,
|
||||||
rootKey,
|
rootKey,
|
||||||
disableKeyLogin,
|
disableKeyLogin,
|
||||||
}
|
}
|
||||||
@@ -204,6 +219,7 @@ async function checkOidc(config?: HeadscaleConfig) {
|
|||||||
client,
|
client,
|
||||||
secret,
|
secret,
|
||||||
rootKey,
|
rootKey,
|
||||||
|
method,
|
||||||
disableKeyLogin,
|
disableKeyLogin,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -36,7 +36,7 @@ export async function startOidc(oidc: OidcConfig, req: Request) {
|
|||||||
const issuerUrl = new URL(oidc.issuer)
|
const issuerUrl = new URL(oidc.issuer)
|
||||||
const oidcClient = {
|
const oidcClient = {
|
||||||
client_id: oidc.client,
|
client_id: oidc.client,
|
||||||
token_endpoint_auth_method: 'client_secret_basic',
|
token_endpoint_auth_method: oidc.method,
|
||||||
} satisfies Client
|
} satisfies Client
|
||||||
|
|
||||||
const response = await discoveryRequest(issuerUrl)
|
const response = await discoveryRequest(issuerUrl)
|
||||||
@@ -91,7 +91,7 @@ export async function finishOidc(oidc: OidcConfig, req: Request) {
|
|||||||
const oidcClient = {
|
const oidcClient = {
|
||||||
client_id: oidc.client,
|
client_id: oidc.client,
|
||||||
client_secret: oidc.secret,
|
client_secret: oidc.secret,
|
||||||
token_endpoint_auth_method: 'client_secret_basic',
|
token_endpoint_auth_method: oidc.method,
|
||||||
} satisfies Client
|
} satisfies Client
|
||||||
|
|
||||||
const response = await discoveryRequest(issuerUrl)
|
const response = await discoveryRequest(issuerUrl)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ You can configure Headplane using environment variables.
|
|||||||
|
|
||||||
#### Optional Variables
|
#### Optional Variables
|
||||||
|
|
||||||
|
- **`HEADSCALE_PUBLIC_URL`**: The public URL of your Headscale server (if different from `HEADSCALE_URL`).
|
||||||
- **`DEBUG`**: Enable debug logging (default: `false`).
|
- **`DEBUG`**: Enable debug logging (default: `false`).
|
||||||
- **`HOST`**: The host to bind the server to (default: `0.0.0.0`).
|
- **`HOST`**: The host to bind the server to (default: `0.0.0.0`).
|
||||||
- **`PORT`**: The port to bind the server to (default: `3000`).
|
- **`PORT`**: The port to bind the server to (default: `3000`).
|
||||||
@@ -34,6 +35,7 @@ If you use the Headscale configuration integration, these are not required.
|
|||||||
- **`OIDC_ISSUER`**: The issuer URL of your OIDC provider.
|
- **`OIDC_ISSUER`**: The issuer URL of your OIDC provider.
|
||||||
- **`OIDC_CLIENT_ID`**: The client ID of your OIDC provider.
|
- **`OIDC_CLIENT_ID`**: The client ID of your OIDC provider.
|
||||||
- **`OIDC_CLIENT_SECRET`**: The client secret of your OIDC provider.
|
- **`OIDC_CLIENT_SECRET`**: The client secret of your OIDC provider.
|
||||||
|
- **`OIDC_CLIENT_SECRET_METHOD`**: The method used to send the client secret (default: `client_secret_basic`).
|
||||||
- **`ROOT_API_KEY`**: An API key used to issue new ones for sessions (keep expiry fairly long).
|
- **`ROOT_API_KEY`**: An API key used to issue new ones for sessions (keep expiry fairly long).
|
||||||
- **`DISABLE_API_KEY_LOGIN`**: If you want to disable API key login, set this to `true`.
|
- **`DISABLE_API_KEY_LOGIN`**: If you want to disable API key login, set this to `true`.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user