###前提・実現したいこと
現在、Mastodonを構築中です。
先程、postfixについてご質問した後でございますが質問させて頂きます。
マストドンにメールを送らせようしましたが、失敗します。
###発生している問題・エラーメッセージ
Sidekiq画面にて
Net::SMTPFatalError: 550 5.7.1 Relaying denied
###.env.production
編集した部分です
~省略~ # E-mail configuration # Note: Mailgun and SparkPost (https://sparkpo.st/smtp) each have good free tiers # If you want to use an SMTP server without authentication (e.g local Postfix relay) # then set SMTP_AUTH_METHOD to 'none' and *comment* SMTP_LOGIN and SMTP_PASSWORD. # Leaving them blank is not enough for authentication method 'none'. SMTP_SERVER=tk2-230-24926.vs.sakura.ne.jp SMTP_PORT=25 SMTP_LOGIN= SMTP_PASSWORD= SMTP_FROM_ADDRESS=root@utbs.info #SMTP_DOMAIN= # defaults to LOCAL_DOMAIN SMTP_DELIVERY_METHOD=smtp # delivery method can also be sendmail SMTP_AUTH_METHOD=plain SMTP_OPENSSL_VERIFY_MODE=none SMTP_ENABLE_STARTTLS_AUTO=true ~省略~
###config/environments/production.rb
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true config.action_controller.asset_host = ENV['CDN_HOST'] if ENV.key?('CDN_HOST') # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = Uglifier.new(mangle: false) # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Allow to specify public IP of reverse proxy if it's needed config.action_dispatch.trusted_proxies = [IPAddr.new(ENV['TRUSTED_PROXY_IP'])] unless ENV['TRUSTED_PROXY_IP'].blank? # By default, use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info').to_sym # Prepend all log lines with the following tags. config.log_tags = [:request_id] # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # Parse and split the REDIS_URL if passed (used with hosting platforms such as Heroku). # Set ENV variables because they are used elsewhere. if ENV['REDIS_URL'] redis_url = URI.parse(ENV['REDIS_URL']) ENV['REDIS_HOST'] = redis_url.host ENV['REDIS_PORT'] = redis_url.port.to_s ENV['REDIS_PASSWORD'] = redis_url.password db_num = redis_url.path[1..-1] ENV['REDIS_DB'] = db_num if db_num.present? end # Use a different cache store in production. config.cache_store = :redis_store, { host: ENV.fetch('REDIS_HOST') { 'localhost' }, port: ENV.fetch('REDIS_PORT') { 6379 }, password: ENV.fetch('REDIS_PASSWORD') { false }, db: ENV.fetch('REDIS_DB') { 0 }, namespace: 'cache', expires_in: 10.minutes, } # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Better log formatting config.lograge.enabled = true # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false config.action_mailer.perform_caching = false # E-mails config.action_mailer.smtp_settings = { :port => ENV['SMTP_PORT'], :address => ENV['SMTP_SERVER'], # :user_name => ENV['SMTP_LOGIN'].presence, # :password => ENV['SMTP_PASSWORD'].presence, :domain => ENV['SMTP_DOMAIN'] || ENV['LOCAL_DOMAIN'], :authentication => ENV['SMTP_AUTH_METHOD'] == 'none' ? nil : ENV['SMTP_AUTH_METHOD'] || :plain, :openssl_verify_mode => ENV['SMTP_OPENSSL_VERIFY_MODE'], :enable_starttls_auto => ENV['SMTP_ENABLE_STARTTLS_AUTO'] || true, } config.action_mailer.delivery_method = ENV.fetch('SMTP_DELIVERY_METHOD', 'smtp').to_sym config.react.variant = :production config.to_prepare do StatsD.backend = StatsD::Instrument::Backends::NullBackend.new if ENV['STATSD_ADDR'].blank? Sidekiq::Logging.logger.level = Logger::WARN end config.action_dispatch.default_headers = { 'Server' => 'Mastodon', 'X-Frame-Options' => 'DENY', 'X-Content-Type-Options' => 'nosniff', 'X-XSS-Protection' => '1; mode=block', } end
###試したこと
下記のサイトを参考にしました
http://qiita.com/ymchn/items/1df8453fd2c8ceb8ad71
http://scriptlife.hacca.jp/contents/programming/2017/04/26/post-2278/
###補足情報(言語/FW/ツール等のバージョンなど)
CentOS7
postfix
Mastodon
###追記
postfixの設定を見直しを行った所
[root@tk2-230-24926 mastodon]# systemctl status postfix.service ● postfix.service - Postfix Mail Transport Agent Loaded: loaded (/usr/lib/systemd/system/postfix.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since 水 2017-05-24 21:28:42 JST; 26s ago Process: 28007 ExecStop=/usr/sbin/postfix stop (code=exited, status=1/FAILURE) Process: 28281 ExecStart=/usr/sbin/postfix start (code=exited, status=1/FAILURE) Process: 28279 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS) Process: 28275 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS) Main PID: 23625 (code=killed, signal=TERM) 5月 24 21:28:40 tk2-230-24926.vs.sakura.ne.jp systemd[1]: Starting Postfix Mail Transport Agent... 5月 24 21:28:40 tk2-230-24926.vs.sakura.ne.jp postfix/postfix-script[28351]: starting the Postfix mail system 5月 24 21:28:40 tk2-230-24926.vs.sakura.ne.jp postfix/master[28353]: fatal: open lock file /var/lib/postfix/master.lock: unable to set exclusive lock: Resource temporarily unavailable 5月 24 21:28:41 tk2-230-24926.vs.sakura.ne.jp postfix/master[28352]: fatal: daemon initialization failure 5月 24 21:28:42 tk2-230-24926.vs.sakura.ne.jp postfix/postfix-script[28354]: fatal: mail system startup failed 5月 24 21:28:42 tk2-230-24926.vs.sakura.ne.jp systemd[1]: postfix.service: control process exited, code=exited status=1 5月 24 21:28:42 tk2-230-24926.vs.sakura.ne.jp systemd[1]: Failed to start Postfix Mail Transport Agent. 5月 24 21:28:42 tk2-230-24926.vs.sakura.ne.jp systemd[1]: Unit postfix.service entered failed state. 5月 24 21:28:42 tk2-230-24926.vs.sakura.ne.jp systemd[1]: postfix.service failed.
[root@tk2-230-24926 mastodon]# postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 home_mailbox = Maildir/ html_directory = no inet_interfaces = all inet_protocols = all mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man message_size_limit = 10485760 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mydomain = utbs.info myhostname = tk2-230-24926.vs.sakura.ne.jp mynetworks = tk2-230-24926.vs.sakura.ne.jp myorigin = $mydomain newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES relayhost = $mydomain sample_directory = /usr/share/doc/postfix-2.10.1/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination smtpd_sasl_auth_enable = yes unknown_local_recipient_reject_code = 550

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/24 11:58
2017/05/24 12:04
2017/05/24 12:13
2017/05/24 12:17
2017/05/24 12:24
2017/05/24 12:29
2017/05/24 12:33
2017/05/24 12:43
2017/05/24 12:50
2017/05/24 12:50
2017/05/24 12:51
2017/05/24 12:55
2017/05/24 13:07
2017/05/24 13:15
2017/05/24 13:20
2017/05/24 13:23
2017/05/24 13:38
2017/05/24 14:16
2017/05/24 14:19
2017/05/24 14:26
2017/05/24 14:33
2017/05/24 14:41
2017/05/24 14:49
2017/05/24 14:59
2017/05/24 15:19
2017/05/24 15:39