From c4c6aa2294bd31a3aed8edd0ac91ad658b2b86fc Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Thu, 28 Dec 2023 00:23:55 +0700 Subject: [PATCH] add new notes, fix gh-pages --- .drone.gh-pages.yml | 2 - .../Common things with docker-mailserver.md | 87 +++++++++++++++++++ ...hook deps changes with useWhatsChanged.md} | 2 - 3 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 content/Docker/Common things with docker-mailserver.md rename content/Frontend/React/{useWhatsChanged.md => Detect hook deps changes with useWhatsChanged.md} (87%) diff --git a/.drone.gh-pages.yml b/.drone.gh-pages.yml index ff7fd84..0a037eb 100644 --- a/.drone.gh-pages.yml +++ b/.drone.gh-pages.yml @@ -19,8 +19,6 @@ steps: image: plugins/gh-pages settings: target_branch: gh-pages - ssh_key: - from_secret: global_ssh_key username: from_secret: github_username password: diff --git a/content/Docker/Common things with docker-mailserver.md b/content/Docker/Common things with docker-mailserver.md new file mode 100644 index 0000000..6e5324f --- /dev/null +++ b/content/Docker/Common things with docker-mailserver.md @@ -0,0 +1,87 @@ +## 1. docker-mailserver SSL alert number 42 + + I was getting following error after setting up TLS certificates in docker-mailserver after setting it up with `letsencrypt`: + +``` +TLS handshaking: SSL_accept() failed: error:14094412:SSL routines:ssl3_read_bytes:sslv3 alert bad certificate: SSL alert number 42 +``` + +The problem was caused by two reasons +### 1.1. Letsencrypt and wildcard domains + +My `MX` domain was `example.com`, bu `letsencrypt` have been set up with wildcard certificate on `*.example.com`. + +So, specifying `SSL_MODE=letsencrypt` made it searching for `/etc/letsencrypt/mail.example.com`, when it was just `/etc/letsencrypt/example.com` + +**SOLUTION**: + +Change .env file to: + +- `SSL_MODE=manual` +- `SSL_KEY_PATH=/etc/letsencrypt/example.com/fullchain.pem` +- `SSL_KEY_PATH=/etc/letsencrypt/example.com/privkey.pem` + +Don't forget to modify `docker-compose` volumes and pass certs from host filesystem. Note: they're not `mail.example.com`, they're just `example.com`. + +This [ticket](https://github.com/docker-mailserver/docker-mailserver/issues/1607) describes it well. + +### 1.2. Docker was using internal hostname of docker-mailserver + +Internal hostname for `docker-mailserver` was just `mail`, and other container tried to send emails to `mail:25`. + +**SOLUTION:** change internal hostname in your app settings to actual, specified in your certificates and MX record. + +### 2. docker-mailserver not listening on 25 port (SMTP) + +Solution was to add quotes in your docker compose, just like that: + +```yaml + ports: + - "25:25" +``` + +This [ticket](https://github.com/docker-mailserver/docker-mailserver/issues/684#issuecomment-322029794) solved it + +### 3. Connect to docker-mailserver from other docker-compose + +I've had `mailserver/compose.yaml` and `application/compose.yaml` and needed to connect `application` to `mailserver`. + +```yaml +// application/compose.yaml +app: + networks: + - shared +networks: + shared: + driver: bridge +``` + +```yaml +/// mailserver/compose.yaml +mail: + networks: + - "application_shared" +networks: + application_shared: + external: true +``` + +### 4. How to convert DKIM mail.txt to DNS record + +My `mail.txt` was like: + +``` +mail._domainkey IN TXT ( "v=DKIM1; h=sha256; k=rsa; " + "p=sOmEJuNkLiKeRaNdOmOrLikeThat" + "eVeNmOrERANdOmStuFf" ) ; ----- DKIM key mail for example.com +``` + +**SOLUTION**: concatenate all strings inside round brackets: + +``` +v=DKIM1; h=sha256; k=rsa; p=sOmEJuNkLiKeRaNdOmOrLikeThateVeNmOrERANdOmStuFf +``` + +And add them as a `TXT` record on my DNS provider control panel under `mail._domainkey` record. + +Solution was right in [official documentation](https://docker-mailserver.github.io/docker-mailserver/edge/config/best-practices/dkim_dmarc_spf/#dkim-dns), just hidden a little bit. \ No newline at end of file diff --git a/content/Frontend/React/useWhatsChanged.md b/content/Frontend/React/Detect hook deps changes with useWhatsChanged.md similarity index 87% rename from content/Frontend/React/useWhatsChanged.md rename to content/Frontend/React/Detect hook deps changes with useWhatsChanged.md index f48f473..d74c086 100644 --- a/content/Frontend/React/useWhatsChanged.md +++ b/content/Frontend/React/Detect hook deps changes with useWhatsChanged.md @@ -5,7 +5,6 @@ import { useEffect, useRef } from 'react'; * tell you, which one changed after rerender. * Use `prefix` to distinguish props of different components. */ -// eslint-disable-next-line import/no-unused-modules export const useWhatsChanged = ( props: Record, prefix = '', @@ -18,7 +17,6 @@ export const useWhatsChanged = ( !Object.prototype.hasOwnProperty.call(prevProps.current, key) || prevProps.current[key] !== value ) { - // eslint-disable-next-line no-console console.log(`${prefix} ${key} has changed`); } });