Compare commits

..

4 Commits

Author SHA1 Message Date
Egor Savkin 2ec85bfa16 Move away from automated script
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-08-14 11:08:44 +08:00
Egor Savkin c679f0f38c Postfix instead of nginx streams
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-08-14 11:05:27 +08:00
Egor Savkin e5b216f749 Remove imap and pop3 ports proxy
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-08-14 11:05:27 +08:00
Egor Savkin 196d449a89 Add configuration for the m-labs-intl
Signed-off-by: Egor Savkin <es@m-labs.hk>
2024-08-14 11:05:27 +08:00
5 changed files with 20 additions and 86 deletions

View File

@ -3,15 +3,13 @@ upstream rfq_server {
}
server {
limit_conn addr 5;
root /var/www/m-labs-intl.com/html;
index index.html index.htm index.nginx-debian.html;
server_name m-labs-intl.com;
server_name m-labs-intl.com www.m-labs-intl.com;
location / {
try_files $uri $uri/ =404;
try_files $uri $uri/ =404;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
@ -22,22 +20,8 @@ server {
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_name hooks.m-labs-intl.com;
limit_conn addr 1;
limit_req zone=rfq;
location /rfq {
proxy_pass http://rfq_server/rfq;
@ -51,10 +35,9 @@ server {
}
location / {
return 418;
return 404;
}
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
@ -63,20 +46,15 @@ server {
}
server {
limit_conn addr 1;
if ($host = m-labs-intl.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = www.m-labs-intl.com) {
return 301 https://m-labs-intl.com$request_uri;
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name m-labs-intl.com www.m-labs-intl.com hooks.m-labs-intl.com;
server_name m-labs-intl.com www.m-labs-intl.com;
return 301 https://$host$request_uri;
#return 404; # managed by Certbot
}

View File

@ -33,10 +33,6 @@ http {
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
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
##
@ -63,32 +59,3 @@ http {
include /etc/nginx/conf.d/*.conf;
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;
}
}

View File

@ -1,7 +1,7 @@
# Setup m-labs-intl.com server
```shell
apt install git nginx-full python3 python3.12-venv python3-pip
apt install git nginx-full python3 python3.12-venv python3-pip postfix opendkim opendkim-tools
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
useradd -m rfqserver
@ -51,17 +51,14 @@ certbot --nginx
service nginx restart
ufw default deny
ufw allow from 94.190.212.123
ufw allow from 2001:470:f891:1:5999:5529:5d:f71d
ufw allow from 202.77.7.238
ufw allow from 2001:470:18:390::2
ufw allow "Nginx HTTP"
ufw allow "Nginx HTTPS"
ufw limit OpenSSH
ufw default allow outgoing
ufw limit 25/tcp
ufw limit 587/tcp
ufw show added
ufw enable
cp main.cf /etc/postfix/main.cf
cp virtual /etc/postfix/virtual
postmap /etc/postfix/virtual
cp opendkim /etc/default/opendkim
cp opendkim.conf /etc/opendkim.conf
opendkim-genkey -t -s mail -d m-labs-intl.com
cp mail.private /etc/postfix/dkim.key
service opendkim restart
service postfix restart
```

View File

@ -1173,10 +1173,11 @@ in
enable = true;
localDnsResolver = false; # conflicts with dnsmasq
fqdn = "mail.m-labs.hk";
domains = [ "m-labs.hk" "m-labs.ph" "m-labs-intl.com" "193thz.com" "malloctech.fr" ];
domains = [ "m-labs.hk" "m-labs.ph" "193thz.com" "malloctech.fr" ];
enablePop3 = true;
enablePop3Ssl = true;
certificateScheme = "acme-nginx";
rejectSender = [ "sapcloudsupport@alerts.ondemand.com" ];
} // (import /etc/nixos/secret/email_settings.nix);
services.roundcube = {
enable = true;

View File

@ -1,7 +1,7 @@
$TTL 7200
@ SOA ns.m-labs-intl.com. sb.m-labs.hk. (
2024081402
2024060601
7200
3600
86400
@ -13,17 +13,8 @@ $TTL 7200
A 5.78.86.156
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 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 @
hooks CNAME @