diff --git a/src/components/PageConfig.jsx b/src/components/PageConfig.jsx index c7ec1402..fcdf859a 100644 --- a/src/components/PageConfig.jsx +++ b/src/components/PageConfig.jsx @@ -1,10 +1,10 @@ import { useContext } from 'react'; -import { PageContext } from '../context'; +import { DocContext } from '../context'; const PageConfig = ({ children }) => { - const value = useContext(PageContext); - return children(value); + const { provisioner, deployment } = useContext(DocContext); + return children({ provisioner, deployment }); }; export default PageConfig; diff --git a/src/components/ProvisionerSelector.jsx b/src/components/ProvisionerSelector.jsx new file mode 100644 index 00000000..f6d96bac --- /dev/null +++ b/src/components/ProvisionerSelector.jsx @@ -0,0 +1,33 @@ +import React from 'react'; +import FormControl from '@material-ui/core/FormControl'; +import FormControlLabel from '@material-ui/core/FormControlLabel'; +import RadioGroup from '@material-ui/core/RadioGroup'; +import Radio from '@material-ui/core/Radio'; +import { Heading } from '@smallstep/step-ui'; + +const ProvisionerSelector = ({ provisioner, onProvisionerChange }) => ( + + + Show me instructions for... + + + } + label="Generic (password-based, etc.)" + /> + } + label="ACME" + /> + + +); + +export default ProvisionerSelector; diff --git a/src/context.js b/src/context.js index 02d04216..e1fdb51f 100644 --- a/src/context.js +++ b/src/context.js @@ -1,4 +1,3 @@ import { createContext } from 'react'; export const DocContext = createContext(); -export const PageContext = createContext(); diff --git a/src/docs/kubernetes-ingress.yaml b/src/docs/kubernetes-ingress.yaml new file mode 100644 index 00000000..85ca933f --- /dev/null +++ b/src/docs/kubernetes-ingress.yaml @@ -0,0 +1,6 @@ +slug: kubernetes-ingress +name: Kubernetes Ingress +template: ingress +written: September 21, 2021 +updated: '' +protocol: https diff --git a/src/docs/kubernetes-ingress/sections/20-operationalize/10-renewal/20-deployments/kubernetes/30-configuration.mdx b/src/docs/kubernetes-ingress/sections/20-operationalize/10-renewal/20-deployments/kubernetes/30-configuration.mdx new file mode 100644 index 00000000..82c7c6d0 --- /dev/null +++ b/src/docs/kubernetes-ingress/sections/20-operationalize/10-renewal/20-deployments/kubernetes/30-configuration.mdx @@ -0,0 +1,42 @@ +Telling your ingress to make use of the certificate and private key +in the `tls-myserver` secret is as easy as adding a `tls` block +to your exsting `Ingress` resources. + +```yaml +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: myserver + labels: ... + annotations: ... +spec: + rules: + - host: myserver.example.net + http: + paths: + - backend: + serviceName: my-service + servicePort: 5000 + path: / + tls: + - hosts: + - myserver.company.net + secretName: tls-myserver +``` + +Voila! Your ingress controller will pick up this `tls` configuration +and automatically serve the renewed certificate each time +the `tls-myserver` secret is updated. + +Use `curl` to check that your TLS configuraiton is working as expected. +You'll need to pass your CA root certificate as an argument +so `curl` can verify the ingress certificate. + + + {`$ curl --cacert ca.crt https://myserver.example.net +HTTP/2 200 +...`} + diff --git a/src/docs/nginx.yaml b/src/docs/nginx.yaml index 3c52e17a..2dff72f7 100644 --- a/src/docs/nginx.yaml +++ b/src/docs/nginx.yaml @@ -1,5 +1,6 @@ slug: nginx name: Nginx +template: server written: September 15, 2021 updated: '' protocol: https diff --git a/src/docs/nginx/sections/40-further-reading.mdx b/src/docs/nginx/sections/40-further-reading.mdx index 0b7a6003..8f055e06 100644 --- a/src/docs/nginx/sections/40-further-reading.mdx +++ b/src/docs/nginx/sections/40-further-reading.mdx @@ -1,2 +1,2 @@ -- [Nginx Documentation: Configuring HTTPS servers](https://nginx.org/en/docs/http/configuring_https_servers.html) -- [Nginx Documentation: Module ngx_http_ssl_module](https://nginx.org/en/docs/http/ngx_http_ssl_module.html) +- [Nginx: Configuring HTTPS servers](https://nginx.org/en/docs/http/configuring_https_servers.html) +- [Nginx: Module ngx_http_ssl_module](https://nginx.org/en/docs/http/ngx_http_ssl_module.html) diff --git a/src/docs/redis.yaml b/src/docs/redis.yaml index cc5e507e..60725591 100644 --- a/src/docs/redis.yaml +++ b/src/docs/redis.yaml @@ -1,5 +1,6 @@ slug: redis name: Redis +template: server written: September 20, 2021 updated: '' protocol: RESP diff --git a/src/pages/{DocsYaml.slug}-tls.jsx b/src/pages/{DocsYaml.slug}-tls.jsx index 81d7d266..5a30e60c 100644 --- a/src/pages/{DocsYaml.slug}-tls.jsx +++ b/src/pages/{DocsYaml.slug}-tls.jsx @@ -5,32 +5,16 @@ import { GatsbySeo } from 'gatsby-plugin-next-seo'; import queryString from 'query-string'; import { makeStyles } from '@material-ui/styles'; import Box from '@material-ui/core/Box'; -import FormControl from '@material-ui/core/FormControl'; -import FormControlLabel from '@material-ui/core/FormControlLabel'; -import RadioGroup from '@material-ui/core/RadioGroup'; -import Radio from '@material-ui/core/Radio'; -import Tabs from '@material-ui/core/Tabs'; -import Tab from '@material-ui/core/Tab'; -import ExpansionPanel from '@material-ui/core/ExpansionPanel'; -import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary'; -import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails'; -import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { Heading, Paragraph } from '@smallstep/step-ui'; -import { DocContext, PageContext } from '../context'; -import MDXBlock from '../components/MDXBlock'; -import HBase from '../components/HBase'; +import { DocContext } from '../context'; +import ServerTemplate from '../templates/ServerTemplate'; +import IngressTemplate from '../templates/IngressTemplate'; const useStyles = makeStyles((theme) => ({ timestamp: { color: theme.palette.text.secondary, }, - tabPanel: { - paddingLeft: 0, - paddingRight: 0, - paddingTop: theme.spacing(4), - paddingBotom: 0, - }, })); const Page = ({ data, location }) => { @@ -102,187 +86,65 @@ const Page = ({ data, location }) => { description={`Practical step-by-step instructions for implementing zero trust principals with ${doc.name}.`} /> - - - - - {doc.name} TLS — Practical Zero Trust - - - How to get and renew {doc.name} TLS certificates - - - Written {doc.written} - {doc.updated && `, last updated ${doc.updated}`} - - - - - - - - - Try it - - Create a private key and request a certificate - - - - Configure {doc.name} to use the certificate - - - Test {doc.name} TLS configuration - - - - - Operationalize It - - Configuring Automated {doc.name} TLS Renewal - - - - - - Show me instructions for... - - - } - label="Generic (password-based, etc.)" - /> - } - label="ACME" - /> - - - - - - - - - - - - - - - - -
- -
- -
- - - - -
- -
- - - -
- -
- - - - -
- - - Distribute your root certificate to end users and systems - - -
- - {content[`${doc.slug}/sections/30-research-notes/10-notes`] && ( - - Research notes - - - }> - - Full research notes - - - - - - - - - - )} - - {content[`${doc.slug}/sections/40-further-reading`] && ( - - Further reading - - - )} - - Contribute to this document - -
-
+ + + + {doc.name} TLS — Practical Zero Trust + + + How to get and renew {doc.name} TLS certificates + + + Written {doc.written} + {doc.updated && `, last updated ${doc.updated}`} + + + + {doc.template === 'server' && ( + + )} + + {doc.template === 'ingress' && ( + + )} + ); }; @@ -292,6 +154,7 @@ export const query = graphql` docsYaml(id: { eq: $id }) { slug name + template written updated server { diff --git a/src/templates/IngressTemplate.jsx b/src/templates/IngressTemplate.jsx new file mode 100644 index 00000000..5db87bb6 --- /dev/null +++ b/src/templates/IngressTemplate.jsx @@ -0,0 +1,69 @@ +import React from 'react'; +import Box from '@material-ui/core/Box'; + +import MDXBlock from '../components/MDXBlock'; +import HBase from '../components/HBase'; +import ProvisionerSelector from '../components/ProvisionerSelector'; + +const IngressTemplate = ({ + doc, + content, + provisioner, + onProvisionerChange, +}) => ( + <> + + + + + + Configuring Automated {doc.name} TLS Renewal + + + + + + + + + + + + + + + + + Distribute your root certificate to end users and systems + + + + + {content[`${doc.slug}/sections/40-further-reading`] && ( + + Further reading + + + )} + + Contribute to this document + + +); + +export default IngressTemplate; diff --git a/src/templates/ServerTemplate.jsx b/src/templates/ServerTemplate.jsx new file mode 100644 index 00000000..83cd8949 --- /dev/null +++ b/src/templates/ServerTemplate.jsx @@ -0,0 +1,184 @@ +import React from 'react'; +import { makeStyles } from '@material-ui/styles'; +import Box from '@material-ui/core/Box'; +import Tabs from '@material-ui/core/Tabs'; +import Tab from '@material-ui/core/Tab'; +import ExpansionPanel from '@material-ui/core/ExpansionPanel'; +import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary'; +import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails'; +import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; +import { Heading } from '@smallstep/step-ui'; + +import MDXBlock from '../components/MDXBlock'; +import HBase from '../components/HBase'; +import ProvisionerSelector from '../components/ProvisionerSelector'; + +const useStyles = makeStyles((theme) => ({ + tabPanel: { + paddingLeft: 0, + paddingRight: 0, + paddingTop: theme.spacing(4), + paddingBotom: 0, + }, +})); + +const ServerTemplate = ({ + doc, + content, + provisioner, + deployment, + onProvisionerChange, + onDeploymentChange, +}) => { + const classes = useStyles(); + + return ( + <> + + + + + + Try it + + Create a private key and request a certificate + + + + Configure {doc.name} to use the certificate + + Test {doc.name} TLS configuration + + + + + Operationalize It + Configuring Automated {doc.name} TLS Renewal + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + +
+ +
+ + + +
+ +
+ + + + +
+ + + Distribute your root certificate to end users and systems + + +
+ + {content[`${doc.slug}/sections/30-research-notes/10-notes`] && ( + + Research notes + + + }> + + Full research notes + + + + + + + + + + )} + + {content[`${doc.slug}/sections/40-further-reading`] && ( + + Further reading + + + )} + + Contribute to this document + + + ); +}; + +export default ServerTemplate;