Skip to content
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 @@ -160,9 +160,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 @@ -251,9 +249,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 @@ -284,9 +280,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 @@ -306,3 +300,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 @@ -110,7 +110,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 @@ -98,6 +98,8 @@ const cfg = {
dateFormat: 'YYYY-MM-DD',
},

defaultDatabaseTTL: '2190h',

routes: {
root: '/web',
discover: '/web/discover',
Expand Down Expand Up @@ -680,6 +682,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