Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v15] Updates self-hosted db discover to use 2190h ttl for certificate #47127

Merged
merged 5 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ function DbEngineInstructions({ dbEngine }: { dbEngine: DatabaseEngine }) {
},
]}
/>
<Text mt={1}>
Restart the database server to apply the configuration.
</Text>
<RestartDatabaseText link="https://goteleport.com/docs/enroll-resources/database-access/enroll-self-hosted-databases/postgres-self-hosted/#step-25-create-a-certificatekey-pair" />
</Box>
);
}
Expand Down Expand Up @@ -247,9 +245,7 @@ function DbEngineInstructions({ dbEngine }: { dbEngine: DatabaseEngine }) {
},
]}
/>
<Text mt={1}>
Restart the database server to apply the configuration.
</Text>
<RestartDatabaseText link="https://goteleport.com/docs/enroll-resources/database-access/enroll-self-hosted-databases/mysql-self-hosted/#step-24-create-a-certificatekey-pair" />
<Text mt={2}>
See{' '}
<Link
Expand Down Expand Up @@ -280,9 +276,7 @@ function DbEngineInstructions({ dbEngine }: { dbEngine: DatabaseEngine }) {
},
]}
/>
<Text mt={1}>
Restart the database server to apply the configuration.
</Text>
<RestartDatabaseText link="https://goteleport.com/docs/enroll-resources/database-access/enroll-self-hosted-databases/mysql-self-hosted/#step-24-create-a-certificatekey-pair" />
<Text mt={2}>
See{' '}
<Link
Expand All @@ -302,3 +296,14 @@ function DbEngineInstructions({ dbEngine }: { dbEngine: DatabaseEngine }) {
);
}
}

const RestartDatabaseText = ({ link }: { link: string }) => (
<Text mt={1}>
Restart the database server to apply the configuration. The certificate is
valid for 90 days so this will require installing an{' '}
<Link href={link} target="_blank">
updated certificate
</Link>{' '}
and restarting the database server before that to continue access.
</Text>
);
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ function generateSignCertificateCurlCommand(
if (!token) return '';

const requestUrl = cfg.getDatabaseSignUrl(clusterId);
const requestData = JSON.stringify({ hostname });
const ttl = cfg.getDatabaseCertificateTTL();
const requestData = JSON.stringify({ hostname, ttl });

// curl flag -OJ makes curl use the file name
// defined from the response header.
Expand Down
7 changes: 7 additions & 0 deletions web/packages/teleport/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ const cfg = {
dateFormat: 'YYYY-MM-DD',
},

defaultDatabaseTTL: '2190h',

routes: {
root: '/web',
discover: '/web/discover',
Expand Down Expand Up @@ -776,6 +778,11 @@ const cfg = {
return generatePath(cfg.api.dbSign, { clusterId });
},

getDatabaseCertificateTTL() {
// the length of the certificate to request for the database
return cfg.defaultDatabaseTTL;
},

getDesktopsUrl(clusterId: string, params: UrlResourcesParams) {
return generateResourcePath(cfg.api.desktopsPath, {
clusterId,
Expand Down
Loading