Skip to content

Commit 6ffd43b

Browse files
committed
Add authentication docs
Describes functions and the gateway including how to configure the built-in gateway basic authentication. Signed-off-by: Alex Ellis (VMware) <[email protected]>
1 parent d082b3d commit 6ffd43b

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ All commits into master (or merged PRs) will appear on the front-page after bein
2020

2121
## mkdocs-material markdown extensions
2222

23-
There are several markdown extensions that can be used to create special formatting. Look at the docs [here](https://squidfunk.github.io/mkdocs-material/extensions/admonition/) for all available extensions.
23+
There are several markdown extensions that can be used to create special formatting. Look at the docs [here](https://squidfunk.github.io/mkdocs-material/extensions/admonition/) for all available extensions.

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ OpenFaaS is written in Golang and is MIT licensed - contributions are welcomed w
7474

7575
* View the [contributing page](/community/#contribute)
7676

77+
If you would like to contribute to the documentation site or find out more check out the [docs repo](https://github.com/openfaas/docs).
78+
7779
### Grafana dashboards
7880

7981
Example of a Grafana dashboards linked to OpenFaaS showing auto-scaling live in action: [here](https://grafana.com/dashboards/3526)

docs/reference/authentication.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Authentication for functions
2+
3+
There are two main concerns for authentication for OpenFaaS: the administrative API Gateway API and the individual functions.
4+
5+
## For the API Gateway
6+
7+
When exposing OpenFaaS on the public internet it is important to protect the administrative API endpoints of the API Gateway.
8+
9+
These APIs exist at:
10+
11+
* `/system/`
12+
13+
We recommend using basic authentication and a strong password to protect the `/system/` route, but it is not the only option. If you prefer you can use a reverse proxy project such as [Kong](https://getkong.org/docs/) to enable OAuth or a similar strategy.
14+
15+
The API Gateway as of version 0.8.2 provides built-in basic authentication. To use it set the environmental variable `basic_auth` to true. Then create two secrets named `basic-auth-user` and `basiic-auth-password`.
16+
17+
Once basic authentication is enabled you will need to use `faas-cli login` before using the CLI.
18+
19+
## For functions
20+
21+
Functions are exposed at:
22+
23+
* `/function/`
24+
* `/async-function/`
25+
26+
Functions exposed on OpenFaaS often do not need to have authentication enabled, this is because they may be responding to webhooks from an external system such as GitHub or Patreon. Neither GitHub, nor Patreon will support authenticating with OAuth or basic authentication strategies, but rely on HMAC.
27+
28+
HMAC involves a shared symmetric secret - both parties store the key securely. The sender computes a hash of the body of the request with their symmetric key and sends this data to the receiver along with the has value in the HTTP header. The receiver then computes a hash of the body with their copy of the key and checks that this matches what the sender supplied in the HTTP header.
29+

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ pages:
121121
- Featured: ./tutorials/featured.md
122122
- Reference:
123123
- Secrets: ./reference/secrets.md
124+
- Auth: ./reference/authentication.md
124125
- Design & Architecture:
125126
- Gateway: ./architecture/gateway.md
126127
- Watchdog: ./architecture/watchdog.md
127128
- Autoscaling: ./architecture/autoscaling.md
128129
- Contributing:
129130
- Get Started: ./contributing/get-started.md
130-

0 commit comments

Comments
 (0)