Connecting GoPhish with Office365
Operational challenges of setting of Office365 SMTP with GoPhish

Enable SMTP

1
$UserCredential = Get-Credential
2
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
3
Import-PSSession $Session -DisableNameChecking
4
Take a look if it is True: Get-TransportConfig (if there is True set to false)
5
Set-TransportConfig -SmtpClientAuthenticationDisabled $false
6
Take a look again if it works: Get-TransportConfig
7
Remove-PSSession $Session
Copied!
Use the Administrator account (Generally the one which was used to create office365 account) to enable SMTP. I have seen that newer accounts already have this setting enabled by default. If your account is not working try this out.
UPDATE 01/02/2021
If above doesn't work for you. Try the following code. Credits Jonathan Cheung
1
Import-Module ExchangeOnlineManagement
2
Connect-ExchangeOnline -UserPrincipalName [email protected] -ShowProgress $true
3
Set-TransportConfig -SmtpClientAuthenticationDisabled $false
Copied!

Add Connector

Add Connector to Exchange Admin
You will need to provide you GoPhish External IP to add this connector. The connector properties are From: Organization Mail Server , To: Office365, and then you need to add your External GoPhish IP

Whitelist your External GoPhish IP

Go to exchange admin center (https://admin.exchange.microsoft.com/#/homepage ) and click on Classic Exchange Admin at the bottom of the side menu.
Click on Connection -> Protection Filter > Connection Filtering
Here you need to Whitelist your external Exchange IP
Whitelist your External GoPhish IP
You should be good to go now. Enter your creds inside Gophish and send a Test Email.

Credit

Connect with me

Last modified 8mo ago