Merge branch 'security/lor-blacklist-traefik' into 'develop'
Create blocklist for attacker See merge request ldc-web/cluster-k8s!97
This commit is contained in:
commit
1f0863cdd1
1 changed files with 61 additions and 0 deletions
|
|
@ -393,3 +393,64 @@ spec:
|
|||
port: 54322
|
||||
targetPort: 54322
|
||||
protocol: TCP
|
||||
|
||||
- apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: blackhole
|
||||
namespace: common-services
|
||||
spec:
|
||||
# Placeholder : jamais contacté, le middleware renvoie 403 avant.
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 80
|
||||
|
||||
- apiVersion: traefik.io/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: deny-ip-blocklist
|
||||
namespace: common-services
|
||||
spec:
|
||||
# ipAllowList rejette en 403
|
||||
ipAllowList:
|
||||
sourceRange:
|
||||
- 192.0.2.1/32 # TEST-NET-1 (RFC 5737) : ne matche aucun client réel => deny
|
||||
|
||||
- apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: security-ip-blocklist
|
||||
namespace: common-services
|
||||
spec:
|
||||
entryPoints:
|
||||
- websecure
|
||||
routes:
|
||||
- match: >-
|
||||
ClientIP(`45.88.138.45/32`)
|
||||
priority: 100000
|
||||
middlewares:
|
||||
- name: deny-ip-blocklist
|
||||
namespace: common-services
|
||||
services:
|
||||
- name: blackhole
|
||||
port: 80
|
||||
|
||||
- apiVersion: discovery.k8s.io/v1
|
||||
kind: EndpointSlice
|
||||
metadata:
|
||||
name: blackhole
|
||||
namespace: common-services
|
||||
labels:
|
||||
kubernetes.io/service-name: blackhole
|
||||
addressType: IPv4
|
||||
endpoints:
|
||||
- addresses:
|
||||
- 192.0.2.1 # TEST-NET-1 : non-routable, jamais contacté
|
||||
conditions:
|
||||
ready: true
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
protocol: TCP
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue