mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-04 17:56:38 +00:00
Send the right port and cert
This commit is contained in:
@@ -24,7 +24,7 @@ import { eq, or, and } from "drizzle-orm";
|
|||||||
import { canUserAccessSiteResource } from "@server/auth/canUserAccessSiteResource";
|
import { canUserAccessSiteResource } from "@server/auth/canUserAccessSiteResource";
|
||||||
import { signPublicKey, getOrgCAKeys } from "#private/lib/sshCA";
|
import { signPublicKey, getOrgCAKeys } from "#private/lib/sshCA";
|
||||||
import config from "@server/lib/config";
|
import config from "@server/lib/config";
|
||||||
import { sendToClient } from "#dynamic/routers/ws";
|
import { sendToClient } from "#private/routers/ws";
|
||||||
|
|
||||||
const paramsSchema = z.strictObject({
|
const paramsSchema = z.strictObject({
|
||||||
orgId: z.string().nonempty()
|
orgId: z.string().nonempty()
|
||||||
@@ -352,13 +352,13 @@ export async function signSshKey(
|
|||||||
data: {
|
data: {
|
||||||
messageId: message.messageId,
|
messageId: message.messageId,
|
||||||
orgId: orgId,
|
orgId: orgId,
|
||||||
agentPort: 8080,
|
agentPort: 22123,
|
||||||
agentHost: resource.destination,
|
agentHost: resource.destination,
|
||||||
caCert: publicKey,
|
caCert: caKeys.publicKeyOpenSSH,
|
||||||
username: usernameToUse,
|
username: usernameToUse,
|
||||||
niceId: resource.niceId,
|
niceId: resource.niceId,
|
||||||
metadata: {
|
metadata: {
|
||||||
sudo: true,
|
sudo: true, // we are hardcoding these for now but should make configurable from the role or something
|
||||||
homedir: true
|
homedir: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,12 +366,19 @@ export async function signSshKey(
|
|||||||
|
|
||||||
const expiresIn = Number(validFor); // seconds
|
const expiresIn = Number(validFor); // seconds
|
||||||
|
|
||||||
|
let sshHost;
|
||||||
|
if (resource.alias && resource.alias != "") {
|
||||||
|
sshHost = resource.alias;
|
||||||
|
} else {
|
||||||
|
sshHost = resource.destination;
|
||||||
|
}
|
||||||
|
|
||||||
return response<SignSshKeyResponse>(res, {
|
return response<SignSshKeyResponse>(res, {
|
||||||
data: {
|
data: {
|
||||||
certificate: cert.certificate,
|
certificate: cert.certificate,
|
||||||
messageId: message.messageId,
|
messageId: message.messageId,
|
||||||
sshUsername: usernameToUse,
|
sshUsername: usernameToUse,
|
||||||
sshHost: resource.destination,
|
sshHost: sshHost,
|
||||||
resourceId: resource.siteResourceId,
|
resourceId: resource.siteResourceId,
|
||||||
keyId: cert.keyId,
|
keyId: cert.keyId,
|
||||||
validPrincipals: cert.validPrincipals,
|
validPrincipals: cert.validPrincipals,
|
||||||
|
|||||||
Reference in New Issue
Block a user