{"record":{"id":"e906f3117a69cef9","repo":"Billionmail/BillionMail","slug":"failed-to-read-postfix-master-config-v","errorCode":null,"errorMessage":"failed to read postfix master config: %v","messagePattern":"failed to read postfix master config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/mail_service/certificate.go","lineNumber":164,"sourceCode":"\t// Update Postfix Master configuration\n\tif err := c.SetPostfixMasterSSL(); err != nil {\n\t\treturn err\n\t}\n\n\t// Restart Postfix service\n\tif err := c.restartPostfix(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\n// SetPostfixMasterSSL enables SSL for Postfix Master\nfunc (c *Certificate) SetPostfixMasterSSL() error {\n\t// Read Postfix Master configuration\n\tcontent, err := public.ReadFile(consts.POSTFIX_MASTER_CONF)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read postfix master config: %v\", err)\n\t}\n\n\tcontent, err = gregex.ReplaceString(`\\n*#\\s*-o\\s+smtpd_tls_auth_only=yes`, \"\\n  -o smtpd_tls_auth_only=yes\", content)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to update postfix master config: %v\", err)\n\t}\n\n\tcontent, err = gregex.ReplaceString(`\\n*#\\s*-o\\s+smtpd_tls_wrappermode=yes`, \"\\\\n  -o smtpd_tls_wrappermode=yes\", content)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to update postfix master config: %v\", err)\n\t}\n\n\t// Update Postfix Master configuration\n\tif err := os.WriteFile(c.PostfixMasterConf, []byte(content), 0755); err != nil {\n\t\treturn fmt.Errorf(\"failed to write postfix master config: %v\", err)\n\t}","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/mail_service/certificate.go#L146-L182","documentation":"SetPostfixMasterSSL reads Postfix's master.cf (consts.POSTFIX_MASTER_CONF) via public.ReadFile before uncommenting TLS options. This error wraps the read failure, so the message text is the underlying OS error (e.g. 'no such file or directory' or 'permission denied').","triggerScenarios":"Calling SetPostfixSSL or SetPostfixVMailCert (which call SetPostfixMasterSSL) on a host where the master.cf path is wrong or unreadable.","commonSituations":"Postfix not installed or running inside a different container than the app; nonstandard postfix config directory; app container lacking root/permission to read /etc/postfix/master.cf.","solutions":["Verify POSTFIX_MASTER_CONF points to the actual master.cf location (postconf -h config_directory)","Install postfix or mount the postfix config into the container","Grant read permission (or run as root) for the service reading master.cf","Log the wrapped underlying error to confirm which path failed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"masterCf := consts.POSTFIX_MASTER_CONF\nif _, err := os.Stat(masterCf); err != nil {\n    return fmt.Errorf(\"postfix master.cf not available at %s: %w\", masterCf, err)\n}","typeGuard":null,"tryCatchPattern":"if err := certService.SetPostfixMasterSSL(); err != nil {\n    if strings.Contains(err.Error(), \"failed to read postfix master config\") {\n        log.Errorf(\"master.cf unreadable: %s — is postfix installed and path correct?\", err)\n        return ErrPostfixNotConfigured\n    }\n    return err\n}","preventionTips":["Verify consts.POSTFIX_MASTER_CONF matches the actual postfix config_directory per deployment","Install postfix before enabling TLS automation","Mount postfix configs read-write into the app container"],"tags":["postfix","configuration","file-read","tls"],"backgroundTag":"config-file-not-found","analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}