Find Formatted address by IP address using Keycloak - keycloak

Description
I'm using Keycloak and I need to send E-Mail to users whenever their login fails, about the failure. Per default, these email does contain an IP Address.
Problematic
I need to include the formatted address comming from this IP address, but I don't know the SPI to use to re-implement emails.
Idea
I've come across this plugin from maxmind which can be used to implement a Keycloak SPI.

After some digging, I found this FreeMarkerEmailTemplateProvider and I've just extended it.

Related

How to setup noreply#<domain> google Cloud Composer?

I am trying to use sendGrid with Google Cloud Composer and providing SENDGRID_MAIL_FROM value noreply-composer#domain (noreply-composer#gmail.com), while running the airflow dag receiving error 403: Forbidden
. I did some research and got to know that from should be verified in the sender list. But if I just want to send alert mail with noreply user, this username physically doesn't exist and can not be verified.
Does anybody know workaround for the same, so I can send the mail with noreply username?
Elaborating more to my comment, according to SendGrid documentation pages, each sender identity should be verified using either Domain Authentication or Single Sender Verification. Based on the intro of Single Sender Verification as of most common use case restriction:
You can send only from the address you verify rather than any address
on an authenticated domain.
With said this, you might have to validate email account ownership for each FROM email address entry.
Domain Authentication will probably help to overcome the above mentioned limitation, however it requires to edit DNS records of the domain provider name resolution service:
You can send from any email address on your authenticated domain.
After adding CNAME, TEXT or MX particular records to your DNS service, they need to be validated in SendGrid UI.
I encourage you to check out the relevant tutorial to give more essential outcome.

Email server to receive email from any account within domain and ideally alias

I'm currently testing some complicated functionality in a web app that involves multiple accounts within the app; each with its own unique email address. I have a few temp gmail accounts that I'm using for this purpose, but keep having to update email addresses in the database to something else for some accounts in order to reuse email addresses. It gets meesy very quickly.
My question is; is there a way I can setup an email server on my VPS (Ubuntu 16.04) that is able to accept all email addresses on a given domain without me having to define each one in advance? Ie; I'd like to be able to make up email addresses as I go; test1#mydomain.com, test2#mydomain.com, etc, and have the server receive AND store any incoming emails to those addresses. Emails include account verifications, notifications, etc, and I need to know what is being sent to each participant at each point in each workflow as I test.
Ideally I'd like some way to view all of these emails on the domain regardless of address. Perhaps setting up an alias using some kind of wildcard so that all incoming email go to a single address that I can configure in my email client on my dev machine.
Consider rewriting envelope recipient x#subdomain.example.net to handler+x#example.net
AFAIR sendmail, postfix and exim support such rewrites. AFAIR all three support passing +detail as parameter to procmail script (to ~handler/.procmailrc as $1).
WARNING: test handling message to multiple special recipients.
Post which specific SMTP/MTA server do you use if you want more hints.
Gmail also supports plussed addresses BUT you get reliable hint about original recipient only for message to single special/plussed recipient.
After a lot of research and messing about with different configurations, I found the best solution for me was PostFix with Dovecot.
I was able to set up virtual mailboxes in PostFix with virtual_mailbox_maps pointing to a file that contained this; #mydomain.com mydomain.com/catchall/
This allows mail to any email address within the domain to go to one mailbox. The mydomain.com/catchall/ is a location on the server where the mailbox is located. By convention, the domain is used in the path. Useful if you are hosting email on multiple domains. Dovecot supports variables in the config which allows you to point it to the correct mailbox.
I also found that the PostFix main.cf file must have mydestination = localhost for this configuration to work.
the following posts helped me getting this up and running;
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-postfix-e-mail-server-with-dovecot
https://www.digitalocean.com/community/tutorials/how-to-install-and-setup-postfix-on-ubuntu-14-04

Find email IMAP incoming/outgoing server ip and port

My organization has own email id and can be accessed through web-browser. Now I want to setup IMAP in Gmail app in android. This requires specific incoming/outgoing server ip, port, security certificate. However, to my surprise "Mail.ru" app automatically recognizes everything (I just need to provide my email id and pass) and works perfectly (both in the organization network or outside world). These informations are also required to setup email in thunderbird. Is there any way to know this, like tracing packet, or any other way?
N.B: Nadmin don't want to share these info. This page does not help much.
Many email clients support some kind of Autodiscovery, where based on the domain name certain well-known URLs are tried in an attempt to download an XML document containing information about the SMTP and IMAP settings applicable for that domain.
Here is some Microsoft documentation about it:
https://technet.microsoft.com/en-us/library/cc511507.aspx
See also:
https://serverfault.com/questions/172326/how-to-configure-email-autoconfiguration-for-a-domain

How to specify the ip address SendGrid uses to send Webhook Events from

Is there a way to specify the ip address SendGrid uses or identify the ip address or range that they use to send Webhook Event responses?
I need to restrict a server to only those external calls.
There's no way to do this and it's unlikely to be a sustainable strategy since the number of servers and their address is going to change. You might be able to do a rDNS lookup. But the easiest way might be to implement basic auth over https as described here https://sendgrid.com/docs/API_Reference/Webhooks/event.html#-Setup

How to find ip address of email sender of yahoo mail or gmail?

How to find ip address of email sender of yahoo mail or gmail?
Just a thought - If you are looking for the IP in order to track down a spammer or something similar - better report the email address directly to yahoo or gmail.
One more issue is that if the IP used to send the mail is/was dynamic, it can possibly help you only aproximately geo-locate the sender, nothing more.
There is a technique that sometimes works, and it's a well-known trick used by spammers.
Reply to the email with an HTML email that includes an image hosted by a server you control, with a unique query string in the URL. If the person opens the email AND displays images, your image will load. You can see which IP address loaded the image, and match that with the email address where you sent the image. Of course, even if this works it will give you the IP address where they read your message, not the one from which they sent the first email. This trick is the main reason that email programs check before they load images now.
You could also sue them, get a subpeona and force Google or Yahoo to get the IP address from their logs.
Looking at the mail headers, you can see who sent it and the host IP, but sender IP addresses aren't included in the header.
You need to look into the mail header which is where you can find the ip address.
Edit: Funny that this was the correct answer but was the only one that got a negative vote. You can go to this link to find out more http://aruljohn.com/info/howtofindipaddress/#gmail and to use some scripts that will make it easier for you. But in short, the IP address can usually be found in the header. Reading the header is different for every email provider so you will have to read to find out how. Some email services such as Google will never share the sender IP. But I've heard that if a sender uses a mail client such as Thunderbird, that the IP can always be tracked, haven't tested it yet though. Good luck!
It's quite easy to track the IP address.
And to track address of sender first we need to retrieve IP address is the sender from the mail and then convert that IP address in location with help of no of websites which offer this feature.
It's a different process for both Yahoo and gmail and putting whole steps will take around 70 lines so I an just putting it's link I found on a website
http://www.rybersoft.com/2016/04/how-to-find-location-of-email-sender.html