Charcoal-SE / metasmoke

Web dashboard for SmokeDetector.
https://metasmoke.erwaysoftware.com
Creative Commons Zero v1.0 Universal
43 stars 34 forks source link

Signing up for the Charcoal Team doesn't work through MS #992

Open makyen opened 9 months ago

makyen commented 9 months ago

The process for signing up for the Charcoal Team is currently broken.

Users with a role other than Flagger can go to this page on MS and get an email which is @channel-verify.charcoal-se.org that they are supposed to enter when signing up for the Charcoal Team. Once they provide that email in the Charcoal Team signup, they are supposed to click the button on that MS page and get the link to the invite confirmation which MS processes out of the invite email.

Unfortunately, the channel-verify.charcoal-se.org domain doesn't resolve, so the process can't be completed through MS (i.e. SO, presumably, tries to send the invite email for the signup, but that email isn't received). The most recent information I have is that the domain configuration needs to be changed by @ArtOfCode-, although I believe @teward may have been granted more access to domain configuration since the last time it was discussed in chat (tail end of that conversation: follow the replies back to see the whole thing; tail of a prior conversation).

Workaround: Team admin manually sending an invite

The current workaround is that the user wanting to sign up for the Charcoal Team needs to get their email address to an admin on the Charcoal Team. Effectively, this means to get the email address to either tripleee or me, Makyen, as we're the Charcoal Team admins who are currently active in Charcoal HQ. The Charcoal Team admin can then manually send a Team invite to the user's email address.

How to get your email to a Charcoal Team admin

Preferably the email address is transmitted to us through a private and secure method. There are at least two options:

  1. Add your email address and a password to your metasmoke account

    To add an email address and password to your MS account, you first have to provide a valid email address on the Account Settings page (in the second email field, which just has a "Save" button; don't mess up, you get only one chance to set it). After saving your email address, you need to sign out from MS, and then go through the "Forgot your password" process, which will send an email to the email address you provided, which is why it needs to be a valid email address. The email will have a "Change my password" link. You then need to go to the URL in that link, enter a password and confirm it. Your email and password will then be an alternate method for you to log into metasmoke.

    You then need to tell tripleee or Makyen that you actually added the email address and that you want an invite to the Charcoal Team sent to you, as a user adding an email address isn't something we're notified about, and an MS admin seeing a user's email address on MS is non-trivial (i.e., it takes going through an uncommonly used process) and isn't something we do without a good reason/explicit request.

  2. Send either tripleee or Makyen a message on Keybase with your email address and why you're sending it to us (i.e., that you want an invite to the Charcoal Team sent to you). Given that Keybase accounts are not automatically associated with SE accounts, you also need to tell us what your SE account is. You will also need to confirm on SE that the Keybase account which sent the message is yours. You can do that by pinging us in a chat message sent from your SE account and saying that you just sent us something on Keybase.

ArtOfCode- commented 9 months ago

The channel-verify MX record is currently set to an AWS inbound SMTP address. If @teward can tell me what it needs to point to instead I can change it over.

teward commented 9 months ago

@ArtOfCode- I have the same DNS edit access after the previous Cloudflare tweaks you gave me access to in order to fix things when DNS is AWOL or Broke (and for LE certs to work).

I have an SMTP server I use for outgoing messages from my network and elsewhere, but need to configure the system to permit that traffic, and possibly update SPF rules. Where does that link need to go now to send the message? I think the problem is that the domain doesn't resolve to Metasmoke or wherever for validation, not just MX. What do we need to restore this signup process? As in, everything - not just MX but in terms of A records as well.

ArtOfCode- commented 9 months ago

It's incoming mail this needs, not outgoing. The user gets given an email address by metasmoke to enter into the Team join box. SO then sends an email to that address, which MS needs to pick up and pull the join link out of for the user to follow. The MX record should be the only thing needed to fix this - it just needs to route those emails from SO somewhere.

makyen commented 9 months ago

I'm unsure what the actual setup was. In the MS code, MS is expecting to get a POST to /channels_receive_email with the email contents wrapped in JSON. The received message is then parsed, in channels#receive_email, and the join confirm link from the email is then stored and presented to the user.

I haven't found the information or config that resulted in the incoming email being put in a POST and sent to MS.

ArtOfCode- commented 9 months ago

I suspect that was AWS SNS receiving the email and generating the POST, hence the AWS MX record.

teward commented 9 months ago

@ArtOfCode- do we want to use AWS SNS? I can probably set up a corresponding subscription if needed, otherwise we'll have to build a customized email endpoint to do that parsing, wrapping, and sending the POST.

teward commented 9 months ago

I'm unsure what the actual setup was. In the MS code, MS is expecting to get a POST to /channels_receive_email with the email contents wrapped in JSON. The received message is then parsed, in channels#receive_email, and the join confirm link from the email is then stored and presented to the user.

I haven't found the information or config that resulted in the incoming email being put in a POST and sent to MS.

Do you have an example of the expected JSON (or rather, what the channel is expecting)? From that, I can create a Python-driven email handler to process messages coming to that location and push accordingly, but only if I have the expected JSON format that emails have to be POSTed to in that format. Assuming we don't go with AWS SNS or similar.

makyen commented 9 months ago

I don't have an example, but I could create one. The code in MS can be changed to accommodate whatever reasonable thing is possible in the new setup. The current code is in receive_email in app/controllers/channels_controller.rb.

The POST Message has at least a mail.destination object.property with the TO address and a content property that has the email message content text, which contains the invite acceptance link.

Ruby/Rails also does a lot transparently, so it's possible that some of the JSON encoding was auto-performed. I'd have to do some investigation to find out what the request.raw_post actually looks like given a known POST.

teward commented 9 months ago

If all we need is message contents for searching, I can pipe anything into an endpoint as raw parsed text, etc. It wouldn't be in JSON unless we know that it needed that but I can probably make a solution that'd roll fast for it based on aiosmtpd and aiohttpd (as the push/post client) but would still need a basic JSON structure. Happy to create the initial SMTP handler component, but we'll need a component in the Ruby to pick it up and process it as needed. So, just let me know what we need and I'll do some development (working on an email server / wrapper around aiosmtpd right now anyways for a separate project so)