Skip to content

Commit 86d5ff7

Browse files
committed
feat: rate-limit /new endpoint to 2 req/s for self-signed mode
Prevents abuse of the account creation endpoint that is now accessible via GET when tls_cert=self. Uses nginx limit_req with burst=5 and nodelay.
1 parent 14fc4e6 commit 86d5ff7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cmdeploy/src/cmdeploy/nginx/nginx.conf.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ stream {
4242
}
4343

4444
http {
45+
{% if config.tls_cert == "self" %}
46+
limit_req_zone $binary_remote_addr zone=newaccount:10m rate=2r/s;
47+
{% endif %}
4548
sendfile on;
4649
tcp_nopush on;
4750

@@ -87,6 +90,8 @@ http {
8790
# which will in turn do a POST request.
8891
return 301 dcaccount:https://{{ config.mail_domain }}/new;
8992
}
93+
{% else %}
94+
limit_req zone=newaccount burst=5 nodelay;
9095
{% endif %}
9196

9297
fastcgi_pass unix:/run/fcgiwrap.socket;

0 commit comments

Comments
 (0)