# Mailcatcher Testserver ## Mailhog installeren ``` chmod +x install_mailhog_as_service.sh ./install_mailhog_as_service.sh ``` ## Na de installatie ``` systemctl enable mailhog ``` reboot server Nginx configuratie (gebruik template: xxx.BEWAREN.mailcatcher.open2bizz.com.conf) ``` server { listen 8025; server_name 434-mailcatcher.staging.open2bizz.com; # log access_log /var/log/nginx/434.access.log; error_log /var/log/nginx/434.error.log; gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript; gzip on; location / { #kantoor Open2bizz 83.84.200.111 allow 83.84.200.111; allow 83.82.145.237; allow 45.132.40.125; allow 86.93.238.87; allow 80.114.214.241; allow 94.157.36.155; allow 145.131.221.238; deny all; auth_basic "Administrator Area"; auth_basic_user_file /etc/nginx/.htpasswd; proxy_redirect off; proxy_pass http://192.168.78.134:8025; } #error pages error_page 500 501 502 503 504 https://www.open2bizz.tech/503; listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/434-mailcatcher.staging.open2bizz.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/434-mailcatcher.staging.open2bizz.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 ``` In de nginx config file een wachtwoord opnemen: ``` ======================================================== Voorbeeld: In de nginx config file voor omgeving 499 een wachtwoord instellen: ======================================================== auth_basic "Administrator Area"; auth_basic_user_file /etc/nginx/.htpasswd-499; ======================================================== Voor iedere omgeving is op de 401 een aparte .htpasswd aangemaakt in de map /etc/nginx/ Voor alle test-omgevingen in de reeks 402 en 499 is een bestand aangemaakt. Om een nieuw htpasswd te maken (bijvoorbeeld in de 500-reeks) kan het beste een bestaande file gekopieerd worden: cp /etc/nginx/.htpasswd-402 /etc/nginx/.htpasswd-499 Om al de (verborgen) .htpasswd bestanden opvragen: ls -rtla /etc/nginx | grep .htpasswd Een .htpasswd kan bekeken worden met nano, maar je ziet dan alleen de user én het encrypte wachtwoord: nano /etc/nginx/.htpasswd-499 Om een nieuw wachtwoord in te stellen voor de user 'mail' voor omgeving 499: htpasswd /etc/nginx/.htpasswd-499 mail ================================================= Om de wijzigingen toe te passen moet nginx herstart worden: service nginx restart ================================================= ``` ## ODOO: Menu maken voor Mailcatcher Maak een Menu aan met de naam Mailcatcher Hang deze aan de groep 'Internal User' Action: ir.actions.act_url => Thirdparty apps Klik door op 'Thirdparty apps' en verwijs de action URL naar de in nginx opgegeven naam (bijv: https://426-mailcatcher.staging.open2bizz.com/) Zet het target op New Window