Skip to content

Commit

Permalink
[v14] Updates self-hosted db discover to use 2190h ttl for certificate (
Browse files Browse the repository at this point in the history
#47128)

* Updates self-hosted db discover to use 2190h ttl

* include link to creating cert/pairs for self-hosted db

* update to lowercase variable

Co-authored-by: Gavin Frazar <[email protected]>

* revert variable name

* Refactor restart database messaging

---------

Co-authored-by: Steven Martin <[email protected]>
Co-authored-by: Gavin Frazar <[email protected]>
Co-authored-by: Lisa Kim <[email protected]>
  • Loading branch information
4 people authored Oct 3, 2024
1 parent eac25fd commit bc61d1a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
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

0 comments on commit bc61d1a

Please sign in to comment.