{"id":13929702,"url":"https://github.com/wader/postfix-relay","last_synced_at":"2026-04-06T10:03:20.941Z","repository":{"id":38834311,"uuid":"39300234","full_name":"wader/postfix-relay","owner":"wader","description":"Postfix SMTP relay docker image","archived":false,"fork":false,"pushed_at":"2026-03-17T18:28:25.000Z","size":119,"stargazers_count":159,"open_issues_count":8,"forks_count":41,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-04-03T03:57:43.813Z","etag":null,"topics":["dkim","docker-image","postfix","relay","smtp-server","spf"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/mwader/postfix-relay/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wader.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-07-18T14:08:22.000Z","updated_at":"2026-03-17T18:27:06.000Z","dependencies_parsed_at":"2023-02-09T03:46:22.325Z","dependency_job_id":"18156acf-d407-4907-b0da-ad24d2e967a5","html_url":"https://github.com/wader/postfix-relay","commit_stats":null,"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"purl":"pkg:github/wader/postfix-relay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fpostfix-relay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fpostfix-relay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fpostfix-relay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fpostfix-relay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wader","download_url":"https://codeload.github.com/wader/postfix-relay/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fpostfix-relay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31467985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T08:36:52.050Z","status":"ssl_error","status_checked_at":"2026-04-06T08:36:51.267Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dkim","docker-image","postfix","relay","smtp-server","spf"],"created_at":"2024-08-07T18:02:30.097Z","updated_at":"2026-04-06T10:03:20.901Z","avatar_url":"https://github.com/wader.png","language":"Shell","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"# postfix-relay\nPostfix SMTP relay docker image. Useful for sending email without using an\nexternal SMTP server.\n\nDefault configuration is an open relay that relies on docker networking for\nprotection. So be careful to not expose it publicly.\n\n## Usage\n`docker pull mwader/postfix-relay` or clone/build it yourself. Docker hub image is built for `amd64`, `arm/v7` and `arm64`.\n\n### Postfix variables\n\nPostfix [configuration options](http://www.postfix.org/postconf.5.html) can be set\nusing `POSTFIX_\u003cname\u003e` environment variables. See [Dockerfile](Dockerfile) for default\nconfiguration. You probably want to set `POSTFIX_myhostname` (the FQDN used by 220/HELO).\n\nNote that `POSTFIX_myhostname` will change the postfix option\n[myhostname](http://www.postfix.org/postconf.5.html#myhostname).\n\nYou can modify master.cf using postconf with `POSTFIXMASTER_` variables. All double `__` symbols will be replaced with `/`. For example\n\n### Postfix master.cf variables\n\n```\n- POSTFIXMASTER_submission__inet=submission inet n - y - - smtpd\n```\nwill produce\n\n```\npostconf -Me submission/inet=\"submission inet n - y - - smtpd\"\n```\n\n### Postfix lookup tables\n\nYou can also create multiline [tables](http://www.postfix.org/DATABASE_README.html#types) using `POSTMAP_\u003cfilename\u003e` like this example:\n```\nenvironment:\n  - POSTFIX_transport_maps=hash:/etc/postfix/transport\n  - |\n    POSTMAP_transport=gmail.com smtp\n    mydomain.com relay:[relay1.mydomain.com]:587\n    * relay:[relay2.mydomain.com]:587\n```\nwhich will generate file `/etc/postfix/transport`\n```\ngmail.com smtp\nmydomain.com relay:[relay1.mydomain.com]:587\n* relay:[relay2.mydomain.com]:587\n```\nand run `postmap /etc/postfix/transport`.\n\n### Relay Client Authentication\nThe container includes [Postfix SASL](https://www.postfix.org/SASL_README.html) authentication options that are disabled by default.\n\n#### Example Basic Client PAM Auth\nFirst, create a passwd file.\n\n```\necho \"myuser:\"`docker run --rm mwader/postfix-relay mkpasswd -m sha-512 \"mypassword\"` \u003e\u003e passwd_file\n```\n\nThen mount the passwd file and add the following postfix configs via enviromental variable.\n\n```\nvolumes:\n  - /path/to/passwd_file:/etc/postfix/sasl/sasl_passwds\nenvironment:\n  - SASL_Passwds=/etc/postfix/sasl/sasl_passwds\n  - POSTFIX_smtpd_sasl_auth_enable=yes\n  - POSTFIX_cyrus_sasl_config_path=/etc/postfix/sasl\n  - POSTFIX_smtpd_sasl_security_options=noanonymous\n  - POSTFIX_smtpd_relay_restrictions=permit_sasl_authenticated,reject\n```\n\n### OpenDKIM variables\n\nOpenDKIM [configuration options](http://opendkim.org/opendkim.conf.5.html) can be set\nusing `OPENDKIM_\u003cname\u003e` environment variables. See [Dockerfile](Dockerfile) for default\nconfiguration. For example `OPENDKIM_Canonicalization=relaxed/simple`.\n\n### Using docker run\n```\ndocker run -e POSTFIX_myhostname=smtp.domain.tld mwader/postfix-relay\n```\n\n### Using docker-compose\n```\napp:\n  # use hostname \"smtp\" as SMTP server\n\nsmtp:\n  image: mwader/postfix-relay\n  restart: always\n  environment:\n    - POSTFIX_myhostname=smtp.domain.tld\n    - OPENDKIM_DOMAINS=smtp.domain.tld\n```\n\n### Logging\nBy default container only logs to stdout. If you also wish to log `mail.*` messages to file on persistent volume, you can do something like:\n\n```\nenvironment:\n  ...\n  - RSYSLOG_LOG_TO_FILE=yes\n  - RSYSLOG_TIMESTAMP=yes\nvolumes:\n  - /your_local_path:/var/log/\n```\n\nYou can also forward log output to remote syslog server if you define `RSYSLOG_REMOTE_HOST` variable. It always uses UDP protocol and port `514` as default value,\nport number can be changed to different one with `RSYSLOG_REMOTE_PORT`. Default format of forwarded messages is defined by Rsyslog template `RSYSLOG_ForwardFormat`,\nyou can change it to [another template](https://www.rsyslog.com/doc/v8-stable/configuration/templates.html) (section Reserved Template Names) if you wish with `RSYSLOG_REMOTE_TEMPLATE` variable.\n\n```\nenvironment:\n  ...\n  - RSYSLOG_REMOTE_HOST=my.remote-syslog-server.com\n  - RSYSLOG_REMOTE_PORT=514\n  - RSYSLOG_REMOTE_TEMPLATE=RSYSLOG_ForwardFormat\n```\n\n#### Advanced logging configuration\n\nIf configuration via environment variables is not flexible enough it's possible to configure rsyslog directly: `.conf` files in the `/etc/rsyslog.d` directory will be [sorted alphabetically](https://www.rsyslog.com/doc/v8-stable/rainerscript/include.html#file) and included into the primary configuration.\n\n### Timezone\nWrong timestamps in log can be fixed by setting proper timezone.\nThis parameter is handled by Debian base image.\n\n```\nenvironment:\n  ...\n  - TZ=Europe/Prague\n```\n\n### Known issues\n\n#### I see `key data is not secure: /etc/opendkim/keys can be read or written by other users` error messages.\n\nSome Docker distributions like Docker for Windows and RancherOS seems to handle\nvolume permission in way that does not work with OpenDKIM default behavior of\nensuring safe permissions on private keys.\n\nA workaround is to disable the check using a `OPENDKIM_RequireSafeKeys=no` environment variable.\n\n## SPF\nWhen sending email using your own SMTP server it is probably a good idea\nto setup [SPF](https://en.wikipedia.org/wiki/Sender_Policy_Framework) for the\ndomain you're sending from.\n\n## DKIM\nTo enable [DKIM](https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail),\nspecify a whitespace-separated list of domains in the environment variable\n`OPENDKIM_DOMAINS`. The default DKIM selector is \"mail\", but can be changed to\n\"`\u003cselector\u003e`\" using the syntax `OPENDKIM_DOMAINS=\u003cdomain\u003e=\u003cselector\u003e`.\n\nAt container start, RSA key pairs will be generated for each domain unless the\nfile `/etc/opendkim/keys/\u003cdomain\u003e/\u003cselector\u003e.private` exists. If you want the\nkeys to persist indefinitely, make sure to mount a volume for\n`/etc/opendkim/keys`, otherwise they will be destroyed when the container is\nremoved.\n\nDNS records to configure can be found in the container log or by running `docker exec \u003ccontainer\u003e sh -c 'cat /etc/opendkim/keys/*/*.txt` you should see something like this:\n```bash\n$ docker exec 7996454b5fca sh -c 'cat /etc/opendkim/keys/*/*.txt'\n\nmail._domainkey.smtp.domain.tld. IN\tTXT\t( \"v=DKIM1; h=sha256; k=rsa; \"\n\t  \"p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Dx7wLGPFVaxVQ4TGym/eF89aQ8oMxS9v5BCc26Hij91t2Ci8Fl12DHNVqZoIPGm+9tTIoDVDFEFrlPhMOZl8i4jU9pcFjjaIISaV2+qTa8uV1j3MyByogG8pu4o5Ill7zaySYFsYB++cHJ9pjbFSC42dddCYMfuVgrBsLNrvEi3dLDMjJF5l92Uu8YeswFe26PuHX3Avr261n\"\n\t  \"j5joTnYwat4387VEUyGUnZ0aZxCERi+ndXv2/wMJ0tizq+a9+EgqIb+7lkUc2XciQPNuTujM25GhrQBEKznvHyPA6fHsFheymOuB763QpkmnQQLCxyLygAY9mE/5RY+5Q6J9oDOQIDAQAB\" )  ; ----- DKIM key mail for smtp.domain.tld\n```\n\n## Testing\n\nThis project uses [testcontainers](https://testcontainers.com/) with [pytest](https://docs.pytest.org/) for integration testing.\n\n[Mailpit](https://mailpit.axllent.org/) is also used to simulate a remote SMTP server.\n\n```bash\n# Create and enable python virtual environment\npython -m venv venv\nsource venv/bin/activate\n# Install dependencies\npip install -r tests/requirements.txt\n# Start tests\npytest\n# Exit python virtual environment\ndeactivate\n```\n\n## License\npostfix-relay is licensed under the MIT license. See [LICENSE](LICENSE) for the\nfull license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwader%2Fpostfix-relay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwader%2Fpostfix-relay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwader%2Fpostfix-relay/lists"}