traefik/docs/content/middlewares/tcp/ipallowlist.md

61 lines
1.4 KiB
Markdown
Raw Normal View History

---
2022-10-26 15:16:05 +00:00
title: "Traefik TCP Middlewares IPAllowList"
description: "Learn how to use IPAllowList in TCP middleware for limiting clients to specific IPs in Traefik Proxy. Read the technical documentation."
---
2022-10-26 15:16:05 +00:00
# IPAllowList
2021-06-11 13:30:05 +00:00
Limiting Clients to Specific IPs
{: .subtitle }
2022-10-26 15:16:05 +00:00
IPAllowList accepts / refuses connections based on the client IP.
2021-06-11 13:30:05 +00:00
## Configuration Examples
```yaml tab="Docker"
# Accepts connections from defined IP
labels:
2022-10-26 15:16:05 +00:00
- "traefik.tcp.middlewares.test-ipallowlist.ipallowlist.sourcerange=127.0.0.1/32, 192.168.1.7"
2021-06-11 13:30:05 +00:00
```
```yaml tab="Kubernetes"
apiVersion: traefik.containo.us/v1alpha1
kind: MiddlewareTCP
metadata:
2022-10-26 15:16:05 +00:00
name: test-ipallowlist
2021-06-11 13:30:05 +00:00
spec:
2022-10-26 15:16:05 +00:00
ipAllowList:
2021-06-11 13:30:05 +00:00
sourceRange:
- 127.0.0.1/32
- 192.168.1.7
```
```yaml tab="Consul Catalog"
# Accepts request from defined IP
2022-10-26 15:16:05 +00:00
- "traefik.tcp.middlewares.test-ipallowlist.ipallowlist.sourcerange=127.0.0.1/32, 192.168.1.7"
2021-06-11 13:30:05 +00:00
```
```toml tab="File (TOML)"
# Accepts request from defined IP
[tcp.middlewares]
2022-10-26 15:16:05 +00:00
[tcp.middlewares.test-ipallowlist.ipAllowList]
2021-06-11 13:30:05 +00:00
sourceRange = ["127.0.0.1/32", "192.168.1.7"]
```
```yaml tab="File (YAML)"
# Accepts request from defined IP
tcp:
2021-06-11 13:30:05 +00:00
middlewares:
2022-10-26 15:16:05 +00:00
test-ipallowlist:
ipAllowList:
2021-06-11 13:30:05 +00:00
sourceRange:
- "127.0.0.1/32"
- "192.168.1.7"
```
## Configuration Options
### `sourceRange`
The `sourceRange` option sets the allowed IPs (or ranges of allowed IPs by using CIDR notation).