aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config/default.yaml10
-rw-r--r--config/production.yaml.example10
-rw-r--r--server/initializers/checker-before-init.ts3
-rw-r--r--server/initializers/config.ts10
-rw-r--r--server/initializers/constants.ts8
-rw-r--r--support/docker/production/config/production.yaml10
6 files changed, 46 insertions, 5 deletions
diff --git a/config/default.yaml b/config/default.yaml
index 70b10299d..f8be23d69 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -9,6 +9,16 @@ webserver:
9 hostname: 'localhost' 9 hostname: 'localhost'
10 port: 9000 10 port: 9000
11 11
12rates_limit:
13 login:
14 # 15 attempts in 5 min
15 window: 5 minutes
16 max: 15
17 ask_send_email:
18 # 3 attempts in 5 min
19 window: 5 minutes
20 max: 3
21
12# Proxies to trust to get real client IP 22# Proxies to trust to get real client IP
13# If you run PeerTube just behind a local proxy (nginx), keep 'loopback' 23# If you run PeerTube just behind a local proxy (nginx), keep 'loopback'
14# If you run PeerTube behind a remote proxy, add the proxy IP address (or subnet) 24# If you run PeerTube behind a remote proxy, add the proxy IP address (or subnet)
diff --git a/config/production.yaml.example b/config/production.yaml.example
index 06baaf7d4..f1f0f12d1 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -8,6 +8,16 @@ webserver:
8 hostname: 'example.com' 8 hostname: 'example.com'
9 port: 443 9 port: 443
10 10
11rates_limit:
12 login:
13 # 15 attempts in 5 min
14 window: 5 minutes
15 max: 15
16 ask_send_email:
17 # 3 attempts in 5 min
18 window: 5 minutes
19 max: 3
20
11# Proxies to trust to get real client IP 21# Proxies to trust to get real client IP
12# If you run PeerTube just behind a local proxy (nginx), keep 'loopback' 22# If you run PeerTube just behind a local proxy (nginx), keep 'loopback'
13# If you run PeerTube behind a remote proxy, add the proxy IP address (or subnet) 23# If you run PeerTube behind a remote proxy, add the proxy IP address (or subnet)
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts
index 223ef8078..622ad7d6b 100644
--- a/server/initializers/checker-before-init.ts
+++ b/server/initializers/checker-before-init.ts
@@ -27,7 +27,8 @@ function checkMissedConfig () {
27 'services.twitter.username', 'services.twitter.whitelisted', 27 'services.twitter.username', 'services.twitter.whitelisted',
28 'followers.instance.enabled', 'followers.instance.manual_approval', 28 'followers.instance.enabled', 'followers.instance.manual_approval',
29 'tracker.enabled', 'tracker.private', 'tracker.reject_too_many_announces', 29 'tracker.enabled', 'tracker.private', 'tracker.reject_too_many_announces',
30 'history.videos.max_age', 'views.videos.remote.max_age' 30 'history.videos.max_age', 'views.videos.remote.max_age',
31 'rates_limit.login.window', 'rates_limit.login.max', 'rates_limit.ask_send_email.window', 'rates_limit.ask_send_email.max'
31 ] 32 ]
32 const requiredAlternatives = [ 33 const requiredAlternatives = [
33 [ // set 34 [ // set
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index baf502305..4f77e144d 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -63,6 +63,16 @@ const CONFIG = {
63 HOSTNAME: config.get<string>('webserver.hostname'), 63 HOSTNAME: config.get<string>('webserver.hostname'),
64 PORT: config.get<number>('webserver.port') 64 PORT: config.get<number>('webserver.port')
65 }, 65 },
66 RATES_LIMIT: {
67 LOGIN: {
68 WINDOW_MS: parseDurationToMs(config.get<string>('rates_limit.login.window')),
69 MAX: config.get<number>('rates_limit.login.max')
70 },
71 ASK_SEND_EMAIL: {
72 WINDOW_MS: parseDurationToMs(config.get<string>('rates_limit.ask_send_email.window')),
73 MAX: config.get<number>('rates_limit.ask_send_email.max')
74 }
75 },
66 TRUST_PROXY: config.get<string[]>('trust_proxy'), 76 TRUST_PROXY: config.get<string[]>('trust_proxy'),
67 LOG: { 77 LOG: {
68 LEVEL: config.get<string>('log.level') 78 LEVEL: config.get<string>('log.level')
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 2be364cc8..193bae5b5 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -281,12 +281,12 @@ let CONSTRAINTS_FIELDS = {
281 281
282const RATES_LIMIT = { 282const RATES_LIMIT = {
283 LOGIN: { 283 LOGIN: {
284 WINDOW_MS: 5 * 60 * 1000, // 5 minutes 284 WINDOW_MS: CONFIG.RATES_LIMIT.LOGIN.WINDOW_MS,
285 MAX: 15 // 15 attempts 285 MAX: CONFIG.RATES_LIMIT.LOGIN.MAX
286 }, 286 },
287 ASK_SEND_EMAIL: { 287 ASK_SEND_EMAIL: {
288 WINDOW_MS: 5 * 60 * 1000, // 5 minutes 288 WINDOW_MS: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.WINDOW_MS,
289 MAX: 3 // 3 attempts 289 MAX: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.MAX
290 } 290 }
291} 291}
292 292
diff --git a/support/docker/production/config/production.yaml b/support/docker/production/config/production.yaml
index d585cd73e..ae6bf3982 100644
--- a/support/docker/production/config/production.yaml
+++ b/support/docker/production/config/production.yaml
@@ -8,6 +8,16 @@ webserver:
8 hostname: undefined 8 hostname: undefined
9 port: 443 9 port: 443
10 10
11rates_limit:
12 login:
13 # 15 attempts in 5 min
14 window: 5 minutes
15 max: 15
16 ask_send_email:
17 # 3 attempts in 5 min
18 window: 5 minutes
19 max: 3
20
11# Proxies to trust to get real client IP 21# Proxies to trust to get real client IP
12# If you run PeerTube just behind a local proxy (nginx), keep 'loopback' 22# If you run PeerTube just behind a local proxy (nginx), keep 'loopback'
13# If you run PeerTube behind a remote proxy, add the proxy IP address (or subnet) 23# If you run PeerTube behind a remote proxy, add the proxy IP address (or subnet)