Compare commits
8 Commits
2ec85bfa16
...
4bbf162a87
Author | SHA1 | Date |
---|---|---|
Egor Savkin | 4bbf162a87 | |
Egor Savkin | 164c0f021c | |
Egor Savkin | e60896c288 | |
Egor Savkin | f9985dc2c1 | |
Egor Savkin | 8355672611 | |
Sébastien Bourdeauducq | 5d132565e6 | |
Sébastien Bourdeauducq | 97ca7ea3ce | |
Sébastien Bourdeauducq | e24c167f8b |
|
@ -3,13 +3,15 @@ upstream rfq_server {
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
limit_conn addr 5;
|
||||||
|
|
||||||
root /var/www/m-labs-intl.com/html;
|
root /var/www/m-labs-intl.com/html;
|
||||||
index index.html index.htm index.nginx-debian.html;
|
index index.html index.htm index.nginx-debian.html;
|
||||||
|
|
||||||
server_name m-labs-intl.com www.m-labs-intl.com;
|
server_name m-labs-intl.com;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ =404;
|
try_files $uri $uri/ =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
listen [::]:443 ssl ipv6only=on; # managed by Certbot
|
listen [::]:443 ssl ipv6only=on; # managed by Certbot
|
||||||
|
@ -20,8 +22,22 @@ server {
|
||||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
server_name www.m-labs-intl.com;
|
||||||
|
return 301 https://m-labs-intl.com$request_uri;
|
||||||
|
|
||||||
|
listen [::]:443 ssl; # managed by Certbot
|
||||||
|
listen 443 ssl; # managed by Certbot
|
||||||
|
ssl_certificate /etc/letsencrypt/live/m-labs-intl.com/fullchain.pem; # managed by Certbot
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/m-labs-intl.com/privkey.pem; # managed by Certbot
|
||||||
|
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||||
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
server_name hooks.m-labs-intl.com;
|
server_name hooks.m-labs-intl.com;
|
||||||
|
limit_conn addr 1;
|
||||||
|
limit_req zone=rfq;
|
||||||
|
|
||||||
location /rfq {
|
location /rfq {
|
||||||
proxy_pass http://rfq_server/rfq;
|
proxy_pass http://rfq_server/rfq;
|
||||||
|
@ -35,9 +51,10 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
return 404;
|
return 418;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listen [::]:443 ssl; # managed by Certbot
|
||||||
listen 443 ssl; # managed by Certbot
|
listen 443 ssl; # managed by Certbot
|
||||||
ssl_certificate /etc/letsencrypt/live/m-labs-intl.com/fullchain.pem; # managed by Certbot
|
ssl_certificate /etc/letsencrypt/live/m-labs-intl.com/fullchain.pem; # managed by Certbot
|
||||||
ssl_certificate_key /etc/letsencrypt/live/m-labs-intl.com/privkey.pem; # managed by Certbot
|
ssl_certificate_key /etc/letsencrypt/live/m-labs-intl.com/privkey.pem; # managed by Certbot
|
||||||
|
@ -46,15 +63,20 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
if ($host = www.m-labs-intl.com) {
|
limit_conn addr 1;
|
||||||
|
if ($host = m-labs-intl.com) {
|
||||||
return 301 https://$host$request_uri;
|
return 301 https://$host$request_uri;
|
||||||
} # managed by Certbot
|
} # managed by Certbot
|
||||||
|
|
||||||
|
|
||||||
|
if ($host = www.m-labs-intl.com) {
|
||||||
|
return 301 https://m-labs-intl.com$request_uri;
|
||||||
|
} # managed by Certbot
|
||||||
|
|
||||||
|
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
|
|
||||||
server_name m-labs-intl.com www.m-labs-intl.com;
|
server_name m-labs-intl.com www.m-labs-intl.com hooks.m-labs-intl.com;
|
||||||
return 301 https://$host$request_uri;
|
return 301 https://$host$request_uri;
|
||||||
#return 404; # managed by Certbot
|
|
||||||
}
|
}
|
|
@ -33,6 +33,10 @@ http {
|
||||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
|
||||||
ssl_prefer_server_ciphers on;
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
# Rate limiting
|
||||||
|
limit_conn_zone $binary_remote_addr zone=addr:10m;
|
||||||
|
limit_req_zone $binary_remote_addr zone=rfq:10m rate=5r/m;
|
||||||
|
|
||||||
##
|
##
|
||||||
# Logging Settings
|
# Logging Settings
|
||||||
##
|
##
|
||||||
|
@ -59,3 +63,32 @@ http {
|
||||||
include /etc/nginx/conf.d/*.conf;
|
include /etc/nginx/conf.d/*.conf;
|
||||||
include /etc/nginx/sites-enabled/*;
|
include /etc/nginx/sites-enabled/*;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
stream {
|
||||||
|
limit_conn_zone $binary_remote_addr zone=mail:10m;
|
||||||
|
# Upstream mail servers
|
||||||
|
upstream smtp_backend {
|
||||||
|
server mail.m-labs.hk:25;
|
||||||
|
}
|
||||||
|
|
||||||
|
upstream submission_backend {
|
||||||
|
server mail.m-labs.hk:587;
|
||||||
|
}
|
||||||
|
|
||||||
|
# SMTP
|
||||||
|
server {
|
||||||
|
listen 25;
|
||||||
|
proxy_pass smtp_backend;
|
||||||
|
proxy_protocol on;
|
||||||
|
limit_conn mail 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Submission (Authenticated SMTP)
|
||||||
|
server {
|
||||||
|
listen 587;
|
||||||
|
proxy_pass submission_backend;
|
||||||
|
proxy_protocol on;
|
||||||
|
limit_conn mail 5;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
# Setup m-labs-intl.com server
|
# Setup m-labs-intl.com server
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
apt install git nginx-full python3 python3.12-venv python3-pip postfix opendkim opendkim-tools
|
apt install git nginx-full python3 python3.12-venv python3-pip
|
||||||
snap install --classic certbot
|
snap install --classic certbot
|
||||||
ln -s /snap/bin/certbot /usr/bin/certbot
|
ln -s /snap/bin/certbot /usr/bin/certbot
|
||||||
useradd -m rfqserver
|
useradd -m rfqserver
|
||||||
|
@ -51,14 +51,17 @@ certbot --nginx
|
||||||
|
|
||||||
service nginx restart
|
service nginx restart
|
||||||
|
|
||||||
cp main.cf /etc/postfix/main.cf
|
ufw default deny
|
||||||
cp virtual /etc/postfix/virtual
|
ufw allow from 94.190.212.123
|
||||||
postmap /etc/postfix/virtual
|
ufw allow from 2001:470:f891:1:5999:5529:5d:f71d
|
||||||
|
ufw allow from 202.77.7.238
|
||||||
cp opendkim /etc/default/opendkim
|
ufw allow from 2001:470:18:390::2
|
||||||
cp opendkim.conf /etc/opendkim.conf
|
ufw allow "Nginx HTTP"
|
||||||
opendkim-genkey -t -s mail -d m-labs-intl.com
|
ufw allow "Nginx HTTPS"
|
||||||
cp mail.private /etc/postfix/dkim.key
|
ufw limit OpenSSH
|
||||||
service opendkim restart
|
ufw default allow outgoing
|
||||||
service postfix restart
|
ufw limit 25/tcp
|
||||||
|
ufw limit 587/tcp
|
||||||
|
ufw show added
|
||||||
|
ufw enable
|
||||||
```
|
```
|
|
@ -1173,11 +1173,10 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
localDnsResolver = false; # conflicts with dnsmasq
|
localDnsResolver = false; # conflicts with dnsmasq
|
||||||
fqdn = "mail.m-labs.hk";
|
fqdn = "mail.m-labs.hk";
|
||||||
domains = [ "m-labs.hk" "m-labs.ph" "193thz.com" "malloctech.fr" ];
|
domains = [ "m-labs.hk" "m-labs.ph" "m-labs-intl.com" "193thz.com" "malloctech.fr" ];
|
||||||
enablePop3 = true;
|
enablePop3 = true;
|
||||||
enablePop3Ssl = true;
|
enablePop3Ssl = true;
|
||||||
certificateScheme = "acme-nginx";
|
certificateScheme = "acme-nginx";
|
||||||
rejectSender = [ "sapcloudsupport@alerts.ondemand.com" ];
|
|
||||||
} // (import /etc/nixos/secret/email_settings.nix);
|
} // (import /etc/nixos/secret/email_settings.nix);
|
||||||
services.roundcube = {
|
services.roundcube = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
$TTL 7200
|
$TTL 7200
|
||||||
|
|
||||||
@ SOA ns.m-labs-intl.com. sb.m-labs.hk. (
|
@ SOA ns.m-labs-intl.com. sb.m-labs.hk. (
|
||||||
2024060601
|
2024081402
|
||||||
7200
|
7200
|
||||||
3600
|
3600
|
||||||
86400
|
86400
|
||||||
|
@ -13,8 +13,17 @@ $TTL 7200
|
||||||
|
|
||||||
A 5.78.86.156
|
A 5.78.86.156
|
||||||
AAAA 2a01:4ff:1f0:83de::1
|
AAAA 2a01:4ff:1f0:83de::1
|
||||||
|
MX 10 mail.m-labs-intl.com.
|
||||||
|
TXT "v=spf1 mx -all"
|
||||||
|
TXT "google-site-verification=BlQd5_5wWW7calKC7bZA0GdoxR8-zj4gwJEg9sGJ3l8"
|
||||||
|
|
||||||
ns A 94.190.212.123
|
ns A 94.190.212.123
|
||||||
ns AAAA 2001:470:18:390::2
|
ns AAAA 2001:470:18:390::2
|
||||||
|
|
||||||
|
mail A 5.78.86.156
|
||||||
|
mail AAAA 2a01:4ff:1f0:83de::1
|
||||||
|
mail._domainkey IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJVPuhSGXghO7ib8Em/Se3jfCCIJK5g4zn5pGZ3/e0I0f+zGHMuvwpjkAKf6eSmo/AAXEaco28pDi3qE5xfV512AJsORCfPoPFyNhLsj/qtri6hc5KVSWW0Ja3MSFBINDCaX78c7PXPY+3jJJGpwSBDLjdxj9AQwtfiCVlH4qE/QIDAQAB"
|
||||||
|
_dmarc TXT "v=DMARC1; p=none"
|
||||||
|
|
||||||
www CNAME @
|
www CNAME @
|
||||||
|
hooks CNAME @
|
||||||
|
|
Loading…
Reference in New Issue