forked from CENGN/netbox-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netbox-configmap.yaml
117 lines (104 loc) · 3.5 KB
/
netbox-configmap.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
apiVersion: v1
kind: ConfigMap
metadata:
name: netbox-configmap
namespace: netbox-community
data:
# NetBox environment variables
# More configuration can be added via: https://netbox.readthedocs.io/en/stable/configuration/optional-settings/
#changeme
ALLOWED_HOSTS: '*'
DB_HOST: netbox-community-postgresql
DB_NAME: netbox
DB_USER: netbox
EMAIL_FROM: [email protected]
EMAIL_PORT: "25"
EMAIL_SERVER: localhost
EMAIL_TIMEOUT: "10"
EMAIL_USERNAME: foo
EXEMPT_VIEW_PERMISSIONS: ''
LOGIN_REQUIRED: "true"
METRICS_ENABLED: "true"
NETBOX_USERNAME: guest
REDIS_HOST: netbox-redis-master
REDIS_PORT: "6379"
REDIS_DATABASE: "0"
REDIS_CACHE_DATABASE: "1"
SUPERUSER_EMAIL: [email protected]
SUPERUSER_NAME: admin
# ngin.conf
# client_max_body_size used to increase limit on attachement sizes
nginx.conf: |
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
server_tokens off;
server {
client_max_body_size 10M;
listen 80;
server_name 127.0.0.1;
access_log off;
location /static/ {
expires 30d;
alias /opt/netbox/netbox/static/;
}
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
}
# LDAP configuration against Microsoft Acive Directory
# For more information around LDAP, see https://netbox.readthedocs.io/en/stable/installation/4-ldap/
ldap_config.py: |
import ldap
from django_auth_ldap.config import LDAPSearch, NestedGroupOfNamesType
# Read secret from file
def read_secret(secret_name):
try:
f = open('/run/secrets/' + secret_name, 'r', encoding='utf-8')
except EnvironmentError:
return ''
else:
with f:
return f.readline().strip()
AUTH_LDAP_SERVER_URI = "<LDAP_server_URI" #changeme
AUTH_LDAP_CONNECTION_OPTIONS = {
ldap.OPT_REFERRALS: 0
}
AUTH_LDAP_START_TLS = True
# Service user credentials. This accout will be making all the queries when users attempt to log in
AUTH_LDAP_BIND_DN = "<LDAP_bind_DN>" #changeme
AUTH_LDAP_BIND_PASSWORD = read_secret('auth_ldap_bind_password')
LDAP_IGNORE_CERT_ERRORS = True
# Where to look for users
AUTH_LDAP_USER_SEARCH = LDAPSearch("<LDAP_user_search>") #changeme
AUTH_LDAP_USER_DN_TEMPLATE = None
# Map user attributes to Django attributes
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": "givenName",
"last_name": "sn",
"email": "mail"
}
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("<LDAP_group_search>") #changeme
AUTH_LDAP_GROUP_TYPE = NestedGroupOfNamesType()
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
"is_active": ["<LDAP_group>"], #changeme
"is_staff": ["<LDAP_group>"], #changeme
"is_superuser": ["<LDAP_group>"], #changeme
}
AUTH_LDAP_MIRROR_GROUPS = {"<LDAP_groups_to_mirror>"} #changeme
AUTH_LDAP_FIND_GROUP_PERMS = True
AUTH_LDAP_CACHE_GROUPS = False
AUTH_LDAP_GROUP_CACHE_TIMEOUT = 3600