1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-25 06:50:55 +01:00

Remove all application-specific reply handler domains

Summary:
Ref T7199. These were a bad idea which got copy-pasted a bunch.

  - There is zero reason to ever set these to different things.
  - Unsurprisingly, I don't know of any install which has them set to different things.

Unless I've completely forgotten about it, this option was not motivated by some obscure business need, it was just a bad decision which didn't catch anyone's attention at the time.

We partially remedied the mistake at some point by introducing `metamta.reply-handler-domain`, which works as a default for all applications, but never cleaned this mess up.

Test Plan: Sent some mail from applications, verified it picked up appropraite reply handler domains.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7199

Differential Revision: https://secure.phabricator.com/D12231
This commit is contained in:
epriestley 2015-03-31 16:48:40 -07:00
parent 0d99c84bd7
commit bad645f1ec
16 changed files with 24 additions and 106 deletions

View file

@ -17,11 +17,6 @@ final class PhabricatorAuditReplyHandler extends PhabricatorMailReplyHandler {
return $this->getDefaultPublicReplyHandlerEmailAddress('C'); return $this->getDefaultPublicReplyHandlerEmailAddress('C');
} }
public function getReplyHandlerDomain() {
return $this->getCustomReplyHandlerDomainIfExists(
'metamta.diffusion.reply-handler-domain');
}
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) { protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
$commit = $this->getMailReceiver(); $commit = $this->getMailReceiver();
$actor = $this->getActor(); $actor = $this->getActor();

View file

@ -159,6 +159,11 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
'option "%s". Use that option to configure which fields are shown.', 'option "%s". Use that option to configure which fields are shown.',
'differential.fields'); 'differential.fields');
$reply_domain_reason = pht(
'Individual application reply handler domains have been removed. '.
'Configure a reply domain with "%s".',
'metamta.reply-handler-domain');
$ancient_config += array( $ancient_config += array(
'phid.external-loaders' => 'phid.external-loaders' =>
pht( pht(
@ -222,6 +227,12 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
'`security.outbound-blacklist`.'), '`security.outbound-blacklist`.'),
'metamta.reply.show-hints' => pht( 'metamta.reply.show-hints' => pht(
'Phabricator no longer shows reply hints in mail.'), 'Phabricator no longer shows reply hints in mail.'),
'metamta.differential.reply-handler-domain' => $reply_domain_reason,
'metamta.diffusion.reply-handler-domain' => $reply_domain_reason,
'metamta.macro.reply-handler-domain' => $reply_domain_reason,
'metamta.maniphest.reply-handler-domain' => $reply_domain_reason,
'metamta.pholio.reply-handler-domain' => $reply_domain_reason,
); );
return $ancient_config; return $ancient_config;

View file

@ -245,9 +245,7 @@ EODOC
'string', 'string',
null) null)
->setLocked(true) ->setLocked(true)
->setDescription(pht( ->setDescription(pht('Domain used for reply email addresses.'))
'Domain used for reply email addresses. Some applications can '.
'override this configuration with a different domain.'))
->addExample('phabricator.example.com', ''), ->addExample('phabricator.example.com', ''),
$this->newOption('metamta.herald.show-hints', 'bool', true) $this->newOption('metamta.herald.show-hints', 'bool', true)
->setBoolOptions( ->setBoolOptions(

View file

@ -244,13 +244,6 @@ final class PhabricatorDifferentialConfigOptions
pht( pht(
"Similar to `differential.days-fresh` but marks stale revisions. ". "Similar to `differential.days-fresh` but marks stale revisions. ".
"If the revision is even older than it is when marked as 'old'.")), "If the revision is even older than it is when marked as 'old'.")),
$this->newOption(
'metamta.differential.reply-handler-domain',
'string',
null)
->setLocked(true)
->setDescription(
pht('Inbound email domain for Differential replies.')),
$this->newOption( $this->newOption(
'metamta.differential.reply-handler', 'metamta.differential.reply-handler',
'class', 'class',

View file

@ -17,11 +17,6 @@ final class DifferentialReplyHandler extends PhabricatorMailReplyHandler {
return $this->getDefaultPublicReplyHandlerEmailAddress('D'); return $this->getDefaultPublicReplyHandlerEmailAddress('D');
} }
public function getReplyHandlerDomain() {
return $this->getCustomReplyHandlerDomainIfExists(
'metamta.differential.reply-handler-domain');
}
public function getSupportedCommands() { public function getSupportedCommands() {
$actions = array( $actions = array(
DifferentialAction::ACTION_COMMENT, DifferentialAction::ACTION_COMMENT,

View file

@ -26,15 +26,6 @@ final class PhabricatorDiffusionConfigOptions
'string', 'string',
'[Diffusion]') '[Diffusion]')
->setDescription(pht('Subject prefix for Diffusion mail.')), ->setDescription(pht('Subject prefix for Diffusion mail.')),
$this->newOption(
'metamta.diffusion.reply-handler-domain',
'string',
null)
->setLocked(true)
->setDescription(
pht(
'See {{metamta.maniphest.reply-handler}}. This does the same '.
'thing, but affects Diffusion.')),
$this->newOption( $this->newOption(
'metamta.diffusion.reply-handler', 'metamta.diffusion.reply-handler',
'class', 'class',

View file

@ -21,10 +21,6 @@ final class PhabricatorMacroConfigOptions
public function getOptions() { public function getOptions() {
return array( return array(
$this->newOption('metamta.macro.reply-handler-domain', 'string', null)
->setLocked(true)
->setDescription(pht(
'As {{metamta.maniphest.reply-handler-domain}}, but affects Macro.')),
$this->newOption('metamta.macro.subject-prefix', 'string', '[Macro]') $this->newOption('metamta.macro.subject-prefix', 'string', '[Macro]')
->setDescription(pht('Subject prefix for Macro email.')), ->setDescription(pht('Subject prefix for Macro email.')),
); );

View file

@ -17,11 +17,6 @@ final class PhabricatorMacroReplyHandler extends PhabricatorMailReplyHandler {
return $this->getDefaultPublicReplyHandlerEmailAddress('MCRO'); return $this->getDefaultPublicReplyHandlerEmailAddress('MCRO');
} }
public function getReplyHandlerDomain() {
return $this->getCustomReplyHandlerDomainIfExists(
'metamta.macro.reply-handler-domain');
}
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) { protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
// TODO: Implement this. // TODO: Implement this.
return null; return null;

View file

@ -272,27 +272,6 @@ EOTEXT
'review and adjust available priorities by using the '. 'review and adjust available priorities by using the '.
'{{maniphest.priorities}} configuration option. The default value '. '{{maniphest.priorities}} configuration option. The default value '.
'(`90`) corresponds to the default "Needs Triage" priority.')), '(`90`) corresponds to the default "Needs Triage" priority.')),
$this->newOption(
'metamta.maniphest.reply-handler-domain',
'string',
null)
->setLocked(true)
->setSummary(pht('Enable replying to tasks via email.'))
->setDescription(
pht(
'You can configure a reply handler domain so that email sent from '.
'Maniphest will have a special "Reply To" address like '.
'"T123+82+af19f@example.com" that allows recipients to reply by '.
'email and interact with tasks. For instructions on configurating '.
'reply handlers, see the article "Configuring Inbound Email" in '.
'the Phabricator documentation. By default, this is set to `null` '.
'and Phabricator will use a generic `noreply@` address or the '.
'address of the acting user instead of a special reply handler '.
'address (see `metamta.default-address`). If you set a domain '.
'here, Phabricator will begin generating private reply handler '.
'addresses. See also `metamta.maniphest.reply-handler` to further '.
'configure behavior. This key should be set to the domain part '.
'after the @, like "example.com".')),
$this->newOption( $this->newOption(
'metamta.maniphest.reply-handler', 'metamta.maniphest.reply-handler',
'class', 'class',

View file

@ -17,11 +17,6 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler {
return $this->getDefaultPublicReplyHandlerEmailAddress('T'); return $this->getDefaultPublicReplyHandlerEmailAddress('T');
} }
public function getReplyHandlerDomain() {
return $this->getCustomReplyHandlerDomainIfExists(
'metamta.maniphest.reply-handler-domain');
}
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) { protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
// NOTE: We'll drop in here on both the "reply to a task" and "create a // NOTE: We'll drop in here on both the "reply to a task" and "create a
// new task" workflows! Make sure you test both if you make changes! // new task" workflows! Make sure you test both if you make changes!

View file

@ -48,19 +48,9 @@ abstract class PhabricatorMailReplyHandler {
abstract public function validateMailReceiver($mail_receiver); abstract public function validateMailReceiver($mail_receiver);
abstract public function getPrivateReplyHandlerEmailAddress( abstract public function getPrivateReplyHandlerEmailAddress(
PhabricatorObjectHandle $handle); PhabricatorObjectHandle $handle);
public function getReplyHandlerDomain() { public function getReplyHandlerDomain() {
return $this->getDefaultReplyHandlerDomain(); return PhabricatorEnv::getEnvConfig('metamta.reply-handler-domain');
}
protected function getCustomReplyHandlerDomainIfExists($config_key) {
$domain = PhabricatorEnv::getEnvConfig($config_key);
if ($domain) {
return $domain;
}
return $this->getDefaultReplyHandlerDomain();
}
private function getDefaultReplyHandlerDomain() {
return PhabricatorEnv::getEnvConfig(
'metamta.reply-handler-domain');
} }
abstract protected function receiveEmail( abstract protected function receiveEmail(
@ -110,9 +100,11 @@ abstract class PhabricatorMailReplyHandler {
if (!PhabricatorEnv::getEnvConfig('metamta.public-replies')) { if (!PhabricatorEnv::getEnvConfig('metamta.public-replies')) {
return false; return false;
} }
if (!$this->getReplyHandlerDomain()) { if (!$this->getReplyHandlerDomain()) {
return false; return false;
} }
return (bool)$this->getPublicReplyHandlerEmailAddress(); return (bool)$this->getPublicReplyHandlerEmailAddress();
} }

View file

@ -16,10 +16,6 @@ final class OwnersPackageReplyHandler extends PhabricatorMailReplyHandler {
return null; return null;
} }
public function getReplyHandlerDomain() {
return null;
}
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) { protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
return; return;
} }

View file

@ -21,12 +21,6 @@ final class PhabricatorPholioConfigOptions
public function getOptions() { public function getOptions() {
return array( return array(
$this->newOption('metamta.pholio.reply-handler-domain', 'string', null)
->setLocked(true)
->setDescription(
pht(
'Like {{metamta.maniphest.reply-handler-domain}}, but affects '.
'Pholio.')),
$this->newOption('metamta.pholio.subject-prefix', 'string', '[Pholio]') $this->newOption('metamta.pholio.subject-prefix', 'string', '[Pholio]')
->setDescription(pht('Subject prefix for Pholio email.')), ->setDescription(pht('Subject prefix for Pholio email.')),
); );

View file

@ -17,11 +17,6 @@ final class PholioReplyHandler extends PhabricatorMailReplyHandler {
return $this->getDefaultPublicReplyHandlerEmailAddress('M'); return $this->getDefaultPublicReplyHandlerEmailAddress('M');
} }
public function getReplyHandlerDomain() {
return $this->getCustomReplyHandlerDomainIfExists(
'metamta.pholio.reply-handler-domain');
}
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) { protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
// TODO: Implement this. // TODO: Implement this.
return null; return null;

View file

@ -12,10 +12,6 @@ final class PhabricatorRepositoryPushReplyHandler
return null; return null;
} }
public function getReplyHandlerDomain() {
return null;
}
protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) { protected function receiveEmail(PhabricatorMetaMTAReceivedMail $mail) {
return; return;
} }

View file

@ -135,24 +135,21 @@ To use SendGrid, you need a SendGrid account with access to the "Parse API" for
inbound email. Provided you have such an account, configure it like this: inbound email. Provided you have such an account, configure it like this:
- Configure an MX record according to SendGrid's instructions, i.e. add - Configure an MX record according to SendGrid's instructions, i.e. add
##phabricator.example.com MX 10 mx.sendgrid.net.## or similar. `phabricator.example.com MX 10 mx.sendgrid.net.` or similar.
- Go to the "Parse Incoming Emails" page on SendGrid - Go to the "Parse Incoming Emails" page on SendGrid
(<http://sendgrid.com/developer/reply>) and add the domain as the (<http://sendgrid.com/developer/reply>) and add the domain as the
"Hostname". "Hostname".
- Add the URL ##https://phabricator.example.com/mail/sendgrid/## as the "Url", - Add the URL `https://phabricator.example.com/mail/sendgrid/` as the "Url",
using your domain (and HTTP instead of HTTPS if you are not configured with using your domain (and HTTP instead of HTTPS if you are not configured with
SSL). SSL).
- If you get an error that the hostname "can't be located or verified", it - If you get an error that the hostname "can't be located or verified", it
means your MX record is either incorrectly configured or hasn't propagated means your MX record is either incorrectly configured or hasn't propagated
yet. yet.
- Set ##metamta.maniphest.reply-handler-domain## and/or - Set `metamta.reply-handler-domain` to `phabricator.example.com`"
##metamta.differential.reply-handler-domain## to (whatever you configured the MX record for).
"##phabricator.example.com##" (whatever you configured the MX record for),
depending on whether you want to support email replies for Maniphest,
Differential, or both.
That's it! If everything is working properly you should be able to send email That's it! If everything is working properly you should be able to send email
to ##anything@phabricator.example.com## and it should appear in to `anything@phabricator.example.com` and it should appear in
`bin/mail list-inbound` within a few seconds. `bin/mail list-inbound` within a few seconds.
= Local MTA: Installing Mailparse = = Local MTA: Installing Mailparse =
@ -211,12 +208,12 @@ this script into `/etc/smrsh/`:
sudo ln -s /path/to/phabricator/scripts/mail/mail_handler.php /etc/smrsh/ sudo ln -s /path/to/phabricator/scripts/mail/mail_handler.php /etc/smrsh/
Finally, edit ##/etc/mail/virtusertable## and add an entry like this: Finally, edit `/etc/mail/virtusertable` and add an entry like this:
@yourdomain.com phabricator@localhost @yourdomain.com phabricator@localhost
That will forward all mail to @yourdomain.com to the Phabricator processing That will forward all mail to @yourdomain.com to the Phabricator processing
script. Run ##sudo /etc/mail/make## or similar and then restart sendmail with script. Run `sudo /etc/mail/make` or similar and then restart sendmail with
`sudo /etc/init.d/sendmail restart`. `sudo /etc/init.d/sendmail restart`.
= Local MTA: Configuring Lamson = = Local MTA: Configuring Lamson =
@ -232,7 +229,7 @@ To get started, follow the provided instructions
(<http://lamsonproject.org/docs/getting_started.html>) to set up an instance. (<http://lamsonproject.org/docs/getting_started.html>) to set up an instance.
One likely deployment issue is that binding to port 25 requires root One likely deployment issue is that binding to port 25 requires root
privileges. Lamson is capable of starting as root then dropping privileges, but privileges. Lamson is capable of starting as root then dropping privileges, but
you must supply ##-uid## and ##-gid## arguments to do so, as demonstrated by you must supply `-uid` and `-gid` arguments to do so, as demonstrated by
Step 8 in Lamson's deployment tutorial (located here: Step 8 in Lamson's deployment tutorial (located here:
<http://lamsonproject.org/docs/deploying_oneshotblog.html>). <http://lamsonproject.org/docs/deploying_oneshotblog.html>).