Discourse์์ Postfix๋ฅผ ๋ค์ ๋ก๋ํ๋ ๋ฐฉ๋ฒ AI
Ethsim2:
main.cf๋ฅผ ์์ ํ ๊ฒ์ด ๋ง๋์?
DiscourseHelper:
๊ฒ์ ์ค
๊ฒ์ ๋ด์ฉ: Discourse ๋ฉ์ผ ์์ ๊ธฐ ์ปจํ ์ด๋์์ ์์ ์ ์ ํ์ ์ํด valid_recipients ํ์ผ์ ๊ตฌํํ ๋ postfix main.cf๋ฅผ ์๋์ผ๋ก ์์ ํ๋ ๊ฒ์ด ํ์ํ๊ฑฐ๋ ๊ถ์ฅ๋๋์? main.cf๋ฅผ ์ง์ ํธ์งํด์ผ ํ๋์, ์๋๋ฉด Discourse ๋ฉ์ผ ์์ ๊ธฐ ์ค์ ์ ๊ฒฝ์ฐ ๋ชจ๋ ๊ถ์ฅ ๋ณ๊ฒฝ ์ฌํญ์ด docker ํ๊ฒฝ ๋ณ์๋ launcher yml ์ค์ ์ ํตํด ์ฒ๋ฆฌ๋๋์?
์ฝ๊ธฐ ์ค
์ฝ์ ๋ด์ฉ: ๐ฌ valid_recipients ๊ตฌํ ํ ๋ฐ๋ณต๋๋ Postfix ๊ฒฝ๊ณ ๋ฐ ์ฐ๊ฒฐ
์๋์, Discourse์ ํ์ค ์ค์ ์ ๋ฐ๋ฅด๋ ๊ฒฝ์ฐ ์ ํจํ ์์ ์ ํํฐ๋ง์ ์ํด ๋ฉ์ผ ์์ ๊ธฐ ์ปจํ
์ด๋์์ main.cf๋ฅผ ์๋์ผ๋ก ์์ ํ๋ ๊ฒ์ ํ์ํ์ง๋ ๊ถ์ฅ๋์ง๋ ์์ต๋๋ค.
์ฌ๋ฐ๋ฅธ ๋ฐฉ๋ฒ:
Discourse์ ๊ณต์ ๋ฉ์ผ ์์ ๊ธฐ ๊ฐ์ด๋ ๋ฐ ์ปจํ
์ด๋ ์ค์ ์ main.cf๋ฅผ ์๋์ผ๋ก ํธ์งํ์ง ์๋๋ก ์ค๊ณ๋์ด ์์ต๋๋ค. ๋์ ๋ค์๊ณผ ๊ฐ์ด ํ์ธ์:
-
mail-receiver.yml์env์น์ ์ ์ฌ์ฉํ์ฌ Postfix ๋งค๊ฐ๋ณ์๋ฅผ ์ค์ ํด์ผ ํฉ๋๋ค. ๊ตฌ์ฒด์ ์ผ๋ก, ๋ค์๊ณผ ๊ฐ์ ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํฉ๋๋ค:POSTCONF_smtpd_recipient_restrictions: texthash:/etc/postfix/valid_recipients๋๋, ๊ตฌํ ์ค์ ์คํ์ผ์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ:
POSTCONF_smtpd_recipient_restrictions: check_recipient_access hash:/etc/postfix/valid_recipients, reject -
Docker/launcher๋ ์ปจํ ์ด๋ ์์ ์ ์ด๋ฌํ ์ค์ ์ ์ฌ๋ฐ๋ฅด๊ฒ ์ ์ฉํ์ฌ ํ์ผ์ ์ง์ ํธ์งํ ํ์ ์์ด Postfix์ ์ฃผ์ ํฉ๋๋ค.
main.cf๋ฅผ ์ง์ ํธ์งํ๋ฉด ์ถฉ๋์ด ๋ฐ์ํ๊ฑฐ๋ ์ปจํ
์ด๋ ์ฌ๋น๋ ์ ๋ฎ์ด์ฐ๊ธฐ๋ ์ ์์ต๋๋ค. ๋ํ ์ด ๋ฐฉ์์ผ๋ก ํ์ผ ํ์์ด๋ ์์ ์ ๋งคํ ๋ฑ์ ์ฝ๊ฒ ๊นจ๋จ๋ฆด ์ ์์ต๋๋ค.
์ค๋ฅ์ ๋ํด:
ํ์ธํ๋ ๊ฒฝ๊ณ :
warning: /etc/postfix/valid_recipients, line 1: expected format: key whitespace value -- ignoring this line
์ valid_recipients ํ์ผ์ ํ์์ด ์๋ชป๋์๊ธฐ ๋๋ฌธ์ ๋ฐ์ํ๋ ๊ฒ์ด์ง, ์ค์ ๋ฐฉ์(ํ๊ฒฝ ๋ณ์ ๋ main.cf) ๋๋ฌธ์ด ์๋๋๋ค. ํญ๋ชฉ์ด ๋ค์๊ณผ ๊ฐ์ ํ์์ธ์ง ํ์ธํ์ธ์:
alloweduser@yourdomain.com OK
another@yourdomain.com OK
default REJECT
์ฝ๋ก , ๋ฑํธ, ์ผํ๋ ์ฌ์ฉํ์ง ๋ง์ธ์โ์ฃผ์, ๊ณต๋ฐฑ, ๊ทธ๋ฆฌ๊ณ OK(๋๋ REJECT)๋ง ์์ผ๋ฉด ๋ฉ๋๋ค.
main.cf๋ฅผ ํธ์งํ์ง ๋ง์ญ์์ค. ๋งค์ฐ ๊ณ ๊ธ์ค๋ฝ๊ณ ์์ ํ ์ฌ์ฉ์ ์ ์๋ ๊ตฌ์ฑ์ ๊ฐ์ง๊ณ ์๊ณ ์ ํํ ๋ฌด์์ ํ๋์ง ์ดํดํ๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ผ๋ฉด.
๋ชจ๋ ์ผ๋ฐ์ ์ธ ์ง์นจ(์ ํจํ ์์ ์ ๋ฐ ๋ฐ์ ์ ํํฐ๋ง ํฌํจ)์ mail-receiver.yml์์ ํ๊ฒฝ ๋ณ์๋ฅผ ์ค์ ํ์ฌ ์ํ๋ฉ๋๋ค.
์ฐธ๊ณ ์๋ฃ:
- Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver
- Customize direct-delivery Postfix configuration
- ๊ทํ๊ฐ ์ฐธ์กฐํ ์ฃผ์ : Repeated Postfix warnings and connections after valid_recipients implementation
์์ฝ:
ํ์ค Discourse ๋ฉ์ผ ์์ ๊ธฐ ์ค์ ์ ๊ฒฝ์ฐ main.cf๋ฅผ ๊ฑด๋๋ฆด ํ์๊ฐ ์์ต๋๋ค. yml ํ์ผ์ ํ๊ฒฝ ๋ณ์๊ฐ ๊ถ์ฅ๋๊ณ ์ง์๋๋ ๋ฐฉ๋ฒ์
๋๋ค. ์์ ์ ๋งต์ ๊ฒฝ์ฐ ํญ์ ์ ์ ํ hash/texthash ํ์๊ณผ ์ฌ๋ฐ๋ฅธ ํ์ผ ๊ตฌ๋ฌธ์ ์ฌ์ฉํ์ธ์.
์ค์ ๋ก ์ ๋ ์ฌ์ฉ์ ์ ์ ๊ตฌ์ฑ์ ์์ ํ ์ ๊ฑฐํ๊ณ , ์ฌ๊ธฐ์ ์ค๋ช ๋ ๊ตฌ์ฑ์ ์ฌ์ฉํ์ผ๋ฉฐ, ์ ๋ฉ์ผ ํ ์คํธ๋ ์ ์๋ํ์ต๋๋ค.
x86_64 arch detected.
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 600 mail-receiver
mail-receiver
release: Pulling from discourse/mail-receiver
Digest: sha256:2a0d45bb92a783c846a821e635413764eeadb3441ef6190085545a4[9 digits redacted]
Status: Image is up to date for discourse/mail-receiver:release
docker.io/discourse/mail-receiver:release
ERROR: Can't find Ruby library file or shared library pups
cd /pups && /pups/bin/pups --stdin
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
sha256:[6 digits redacted]69734d779a95ec83c7103dc2fc04f1d690ebde62[18 digits redacted]
[64 character API Key? Redacted]
Removing old container
+ /usr/bin/docker rm mail-receiver
mail-receiver
+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e MAIL_DOMAIN=discourse. MYDOMAINNAME.com -e DISCOURSE_BASE_URL=https:// MYDOMAINNAME.com -e DISCOURSE_API_KEY=[64 digit API key redacted] -e DISCOURSE_API_USERNAME=system -h ubuntu-mail-receiver -e DOCKER_HOST_IP=172.17.0.1 --name mail-receiver -t -p 25:25 -v /var/discourse/shared/mail-receiver/postfix-spool:/var/spool/postfix --mac-address [redacacted mac address] local_discourse/mail-receiver /sbin/boot
[64 digit API key? Redacted]
root@ubuntu:/var/discourse# ./launcher logs mail-receiver
x86_64 arch detected.
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Operating environment:
HOSTNAME=ubuntu-mail-receiver
LANGUAGE=en_US.UTF-8
MAIL_DOMAIN=discourse.MYDOMAINNAME.com
DOCKER_HOST_IP=172.17.0.1
PWD=/
DISCOURSE_BASE_URL=https:// MYDOMAINNAME.com
HOME=/root
LANG=en_US.UTF-8
TERM=xterm
SHLVL=1
DISCOURSE_API_USERNAME=system
LC_ALL=en_US.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
INCLUDE_DMARC=true
DISCOURSE_API_KEY=[64 digit API key redacted]
_=/usr/bin/env
Delivering mail sent to discourse. MYDOMAINNAME.com to Discourse
Starting OpenDKIM...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Adding user `postfix' to group `opendkim' ...
<86>Jul 23 13:27:19 usermod[16]: add 'postfix' to group 'opendkim'<86>Jul 23 13:27:19 usermod[16]: add 'postfix' to shadow group 'opendkim'Done.
Starting OpenDMARC...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
<22>Jul 23 13:27:19 opendkim[24]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim.conf)Adding user `postfix' to group `opendmarc' ...
<86>Jul 23 13:27:19 usermod[31]: add 'postfix' to group 'opendmarc'<86>Jul 23 13:27:19 usermod[31]: add 'postfix' to shadow group 'opendmarc'Done.
<22>Jul 23 13:27:19 opendmarc[39]: OpenDMARC Filter v1.4.2 starting (args: -c /etc/opendmarc.conf)<22>Jul 23 13:27:19 opendmarc[39]: additional trusted authentication services: (none)postfix: Postfix is using backwards-compatible default settings
Jul 23 13:27:19 ubuntu-mail-receiver postfix[51]: Postfix is using backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
Jul 23 13:27:19 ubuntu-mail-receiver postfix[51]: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf compatibility_level=3.6" and "postfix reload"
Jul 23 13:27:19 ubuntu-mail-receiver postfix[51]: To disable backwards compatibility use "postconf compatibility_level=3.6" and "postfix reload"
Starting Postfix
Jul 23 13:27:19 ubuntu-mail-receiver postfix/master[1]: daemon started -- version 3.7.11, configuration /etc/postfix
Jul 23 13:27:53 ubuntu-mail-receiver postfix/smtpd[122]: connect from mail-il1-f180.google.com[209.85.166.180]
<22>Jul 23 13:27:54 policyd-spf[129]: : prepend Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.180; helo=mail-il1-f180.google.com; envelope-from= person@gmail.com; receiver=discourse. MYDOMAINNAME.com Jul 23 13:27:54 ubuntu-mail-receiver postfix/smtpd[122]: BC6D71BF9C8: client=mail-il1-f180.google.com[209.85.166.180]
Jul 23 13:27:54 ubuntu-mail-receiver postfix/cleanup[130]: BC6D71BF9C8: message-id=<CWXP1[redacted 8 digits]81B627937FA7F4B2CE65A15FA@CWXP123MB2918.GBRP123.PROD.OUTLOOK.COM>
<22>Jul 23 13:27:55 opendkim[24]: BC6D71BF9C8: DKIM verification successful<22>Jul 23 13:27:55 opendkim[24]: BC6D71BF9C8: s=20230601 d=gmail.com a=rsa-sha256 SSL <22>Jul 23 13:27:55 opendmarc[39]: implicit authentication service: ubuntu-mail-receiver.localdomain<22>Jul 23 13:27:55 opendmarc[39]: BC6D71BF9C8: gmail.com passJul 23 13:27:55 ubuntu-mail-receiver postfix/qmgr[120]: BC6D71BF9C8: from=<person@gmail.com>, size=75533, nrcpt=1 (queue active)
Jul 23 13:27:55 ubuntu-mail-receiver postfix/smtpd[122]: disconnect from mail-il1-f180.google.com[209.85.166.180] ehlo=1 mail=1 rcpt=1 bdat=2 quit=1 commands=6
<23>Jul 23 13:27:55 receive-mail[133]: Recipient: person.REDACTED@discourse. MYDOMAINNAME.comJul 23 13:27:55 ubuntu-mail-receiver postfix/pipe[132]: BC6D71BF9C8: to=< person.REDACTED@discourse. MYDOMAINNAME.com>, relay=discourse, delay=1.8, delays=1.6/0.01/0/0.22, dsn=2.0.0, status=sent (delivered via discourse service)
Jul 23 13:27:55 ubuntu-mail-receiver postfix/qmgr[120]: BC6D71BF9C8: removed