Raikia / FiercePhish

FiercePhish is a full-fledged phishing framework to manage all phishing engagements. It allows you to track separate phishing campaigns, schedule sending of emails, and much more.
https://github.com/Raikia/FiercePhish/wiki
GNU General Public License v3.0
1.31k stars 249 forks source link

{SendEmail} Cancelling email due to failed sending attempt. Check the log for the errors! #39

Closed ziflar closed 7 years ago

ziflar commented 7 years ago

thkx for this good job. i've installed FiercePhish on ubuntu 16.04 with no error's. i've added mailgun domaine and api key to Email Settings. i try to use the send option but no message have sent . i have this error :

{SendEmail} Cancelling email due to failed sending attempt. Check the log for the errors! Last 200 lines of /var/log/mail.log=Empty log file i've just started apache2-mysql-postfix-and mailservice there is any other service's to start also with apache2 -mysql-mailservice ,??? i have on the Email log : status=sent ,but i receive no message just for information; mailgun work good with curl and php please do a wiki page to explain how to start using FiercePhish thx to replay @+

Raikia commented 7 years ago

Make sure supervisor is running:

service supervisor start

Make sure your mailgun settings are correct.

Please attach all logs listed here. Also make sure the email task is actually running by checking:

ps aux | grep php

ziflar commented 7 years ago

@Raikia thx for replay i have edited a bash script to run all service mentionned on your install.sh for mailgun:

domain = sandboxblabalablalalalllalalalallala.mailgun.org
API Key = key-5609366ccdadadadadadadadadadad

all mailgun details are token from : here

ps aux | grep php root 12372 0.0 1.5 313580 30744 ? Ss 22:10 0:00 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf) www-data 12374 0.0 0.3 313580 7580 ? S 22:10 0:00 php-fpm: pool www www-data 12375 0.0 0.3 313580 7580 ? S 22:10 0:00 php-fpm: pool www www-data 13468 0.1 1.5 243732 31216 ? S 22:22 0:00 /usr/bin/php /var/www/fiercephish/artisan queue:work --queue=operation,email,campaign_email,default --tries 1 --timeout=86100 www-data 13469 0.1 1.5 243732 31204 ? S 22:22 0:00 /usr/bin/php /var/www/fiercephish/artisan queue:work --queue=operation,email,campaign_email,default --tries 1 --timeout=86100 www-data 13470 0.1 1.4 243732 29992 ? S 22:22 0:00 /usr/bin/php /var/www/fiercephish/artisan queue:work --queue=operation,email,campaign_email,default --tries 1 --timeout=86100 www-data 13471 0.1 1.5 243732 31012 ? S 22:22 0:00 /usr/bin/php /var/www/fiercephish/artisan queue:work --queue=operation,email,campaign_email,default --tries 1 --timeout=86100 www-data 13472 0.1 1.5 243732 31084 ? S 22:22 0:00 /usr/bin/php /var/www/fiercephish/artisan queue:work --queue=operation,email,campaign_email,default --tries 1 --timeout=86100 www-data 13473 0.1 1.5 243732 31012 ? S 22:22 0:00 /usr/bin/php /var/www/fiercephish/artisan queue:work --queue=operation,email,campaign_email,default --tries 1 --timeout=86100 www-data 13474 0.1 1.5 243732 31144 ? S 22:22 0:00 /usr/bin/php /var/www/fiercephish/artisan queue:work --queue=operation,email,campaign_email,default --tries 1 --timeout=86100 www-data 13475 0.1 1.5 243732 31084 ? S 22:22 0:00 /usr/bin/php /var/www/fiercephish/artisan queue:work --queue=operation,email,campaign_email,default --tries 1 --timeout=86100 www-data 13476 0.1 1.4 243732 29924 ? S 22:22 0:00 /usr/bin/php /var/www/fiercephish/artisan queue:work --queue=operation,email,campaign_email,default --tries 1 --timeout=86100 www-data 13477 0.1 1.5 243732 31028 ? S 22:22 0:00 /usr/bin/php /var/www/fiercephish/artisan queue:work --queue=operation,email,campaign_email,default --tries 1 --timeout=86100 root 21385 0.0 0.0 14268 968 pts/18 S+ 22:28 0:00 grep --color=auto php

## LOGS

Last 200 lines of /var/log/apache2/access_fiercephish.log MY_PUBLIC_IP - - [09/Mar/2017:22:31:48 +0000] "GET /vendor/ckeditor/lang/fr.js?t=H0CF HTTP/1.1" 200 5121 "http://MY_PUBLIC_IP/emails/simple" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"

Last 200 lines of /var/log/apache2/error_fiercephish.log Empty log file

Last 200 lines of /var/log/mail.log Mar 9 22:23:42 ziflar dovecot: master: Dovecot v2.2.22 (fe789d2) starting up without any protocols (core dumps disabled) Mar 9 22:23:42 ziflar dovecot: ssl-params: Generating SSL parameters Mar 9 22:23:44 ziflar dovecot: ssl-params: SSL parameters regeneration completed Mar 9 22:23:51 ziflar postfix[20485]: Postfix is running with backwards-compatible default settings Mar 9 22:23:51 ziflar postfix[20485]: See http://www.postfix.org/COMPATIBILITY_README.html for details Mar 9 22:23:51 ziflar postfix[20485]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload" Mar 9 22:23:51 ziflar postfix/master[20530]: daemon started -- version 3.1.0, configuration /etc/postfix Mar 9 22:23:53 ziflar opendkim[20656]: OpenDKIM Filter v2.10.3 starting (args: -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid -p local:/var/run/opendkim/opendkim.sock) Mar 9 22:23:54 ziflar dovecot: master: Warning: Killed with signal 15 (by pid=20720 uid=0 code=kill) Mar 9 22:23:54 ziflar dovecot: master: Dovecot v2.2.22 (fe789d2) starting up for imap (core dumps disabled) Mar 9 22:23:59 ziflar postfix[20819]: Postfix is running with backwards-compatible default settings Mar 9 22:23:59 ziflar postfix[20819]: See http://www.postfix.org/COMPATIBILITY_README.html for details Mar 9 22:23:59 ziflar postfix[20819]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload" Mar 9 22:23:59 ziflar postfix/postfix-script[20826]: stopping the Postfix mail system Mar 9 22:23:59 ziflar postfix/master[20530]: terminating on signal 15 Mar 9 22:23:59 ziflar postfix[20830]: Postfix is running with backwards-compatible default settings Mar 9 22:23:59 ziflar postfix[20830]: See http://www.postfix.org/COMPATIBILITY_README.html for details Mar 9 22:23:59 ziflar postfix[20830]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload" Mar 9 22:23:59 ziflar postfix/postfix-script[20887]: warning: group or other writable: /usr/lib/postfix/./libpostfix-global.so.1 Mar 9 22:23:59 ziflar postfix/postfix-script[20888]: warning: group or other writable: /usr/lib/postfix/./libpostfix-tls.so.1 Mar 9 22:23:59 ziflar postfix/postfix-script[20889]: warning: group or other writable: /usr/lib/postfix/./libpostfix-dns.so.1 Mar 9 22:23:59 ziflar postfix/postfix-script[20890]: warning: group or other writable: /usr/lib/postfix/./sbin/lmtp Mar 9 22:23:59 ziflar postfix/postfix-script[20891]: warning: group or other writable: /usr/lib/postfix/./libpostfix-master.so.1 Mar 9 22:23:59 ziflar postfix/postfix-script[20892]: warning: group or other writable: /usr/lib/postfix/./libpostfix-util.so.1 Mar 9 22:23:59 ziflar postfix/postfix-script[20893]: warning: group or other writable: /usr/lib/postfix/sbin/./lmtp Mar 9 22:23:59 ziflar postfix/postfix-script[20935]: starting the Postfix mail system Mar 9 22:23:59 ziflar postfix/master[20937]: daemon started -- version 3.1.0, configuration /etc/postfix Mar 9 22:23:59 ziflar postfix[20940]: Postfix is running with backwards-compatible default settings Mar 9 22:23:59 ziflar postfix[20940]: See http://www.postfix.org/COMPATIBILITY_README.html for details Mar 9 22:23:59 ziflar postfix[20940]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload" Mar 9 22:23:59 ziflar postfix/postfix-script[20946]: stopping the Postfix mail system Mar 9 22:23:59 ziflar postfix/master[20937]: terminating on signal 15 Mar 9 22:23:59 ziflar postfix[20949]: Postfix is running with backwards-compatible default settings Mar 9 22:23:59 ziflar postfix[20949]: See http://www.postfix.org/COMPATIBILITY_README.html for details Mar 9 22:23:59 ziflar postfix[20949]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload" Mar 9 22:24:00 ziflar postfix/postfix-script[21005]: warning: group or other writable: /usr/lib/postfix/./libpostfix-global.so.1 Mar 9 22:24:00 ziflar postfix/postfix-script[21006]: warning: group or other writable: /usr/lib/postfix/./libpostfix-tls.so.1 Mar 9 22:24:00 ziflar postfix/postfix-script[21007]: warning: group or other writable: /usr/lib/postfix/./libpostfix-dns.so.1 Mar 9 22:24:00 ziflar postfix/postfix-script[21008]: warning: group or other writable: /usr/lib/postfix/./sbin/lmtp Mar 9 22:24:00 ziflar postfix/postfix-script[21009]: warning: group or other writable: /usr/lib/postfix/./libpostfix-master.so.1 Mar 9 22:24:00 ziflar postfix/postfix-script[21010]: warning: group or other writable: /usr/lib/postfix/./libpostfix-util.so.1 Mar 9 22:24:00 ziflar postfix/postfix-script[21011]: warning: group or other writable: /usr/lib/postfix/sbin/./lmtp Mar 9 22:24:00 ziflar postfix/postfix-script[21053]: starting the Postfix mail system Mar 9 22:24:00 ziflar postfix/master[21055]: daemon started -- version 3.1.0, configuration /etc/postfix Mar 9 22:24:00 ziflar dovecot: master: Warning: Killed with signal 15 (by pid=21066 uid=0 code=kill) Mar 9 22:24:00 ziflar dovecot: master: Dovecot v2.2.22 (fe789d2) starting up for imap (core dumps disabled) Mar 9 22:24:03 ziflar opendkim[20656]: OpenDKIM Filter: mi_stop=1 Mar 9 22:24:03 ziflar opendkim[20656]: OpenDKIM Filter v2.10.3 terminating with status 0, errno = 0 Mar 9 22:24:03 ziflar opendkim[21113]: OpenDKIM Filter v2.10.3 starting (args: -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid -p local:/var/run/opendkim/opendkim.sock) Mar 9 22:25:02 ziflar dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=21152, secured, session=<AX5Xt1NKyIt/AAAB> Mar 9 22:25:02 ziflar dovecot: imap(fiercephish): Logged out in=38 out=747 Mar 9 22:26:01 ziflar dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=21185, secured, session=<oerhulNKzot/AAAB> Mar 9 22:26:01 ziflar dovecot: imap(fiercephish): Logged out in=38 out=747 Mar 9 22:27:01 ziflar dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=21235, secured, session=<sFBxvlNK1It/AAAB> Mar 9 22:27:01 ziflar dovecot: imap(fiercephish): Logged out in=38 out=747 Mar 9 22:28:02 ziflar dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=21373, secured, session=<50QZwlNKgIx/AAAB> Mar 9 22:28:02 ziflar dovecot: imap(fiercephish): Logged out in=38 out=747 Mar 9 22:29:01 ziflar dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=21401, secured, session=<CNucxVNKRI1/AAAB> Mar 9 22:29:01 ziflar dovecot: imap(fiercephish): Logged out in=38 out=747 Mar 9 22:30:01 ziflar dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=21424, secured, session=<luAryVNK+I1/AAAB> Mar 9 22:30:01 ziflar dovecot: imap(fiercephish): Logged out in=38 out=747 Mar 9 22:31:02 ziflar dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=21453, secured, session=<1V/LzFNKjI5/AAAB> Mar 9 22:31:02 ziflar dovecot: imap(fiercephish): Logged out in=38 out=747 Mar 9 22:32:02 ziflar dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=21643, secured, session=<PHxc0FNKbo9/AAAB> Mar 9 22:32:02 ziflar dovecot: imap(fiercephish): Logged out in=38 out=747 Mar 9 22:33:01 ziflar dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=21680, secured, session=<UiLt01NK7o9/AAAB> Mar 9 22:33:01 ziflar dovecot: imap(fiercephish): Logged out in=38 out=747 Mar 9 22:34:01 ziflar dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=21739, secured, session=<Sa5911NKipB/AAAB> Mar 9 22:34:01 ziflar dovecot: imap(fiercephish): Logged out in=38 out=747

Last 200 lines of /var/www/fiercephish/storage/logs/laravel.log Empty log file

Last 200 lines of Activity Log [03/09/2017 - 22:34:09] {SendEmail} Sent an email (simple send) to "MY_email@gmail.com" (email ID 1) [03/09/2017 - 22:34:09] {SendEmail} Cancelling email due to failed sending attempt. Check the log for the errors! [03/09/2017 - 22:34:09] !!!! ERROR !!!! - {SendEmail} Failed to send an email (simple send) to "MY_email@gmail.com" (email ID 1) (try #1) [03/09/2017 - 22:34:08] {Email} Queued to send an email (simple send) to "MY_email@gmail.com" (admin) [03/09/2017 - 22:31:35] {Settings} Application configuration has been edited (admin) [03/09/2017 - 22:31:06] {Settings} Application configuration has been edited (admin) [03/09/2017 - 22:22:15] {Settings} Added a new user named "admin" (via artisan)

Log Information Logs this will show:

/var/log/apache2/access_fiercephish.log
/var/log/apache2/error_fiercephish.log
/var/log/mail.log
/var/log/dovecot.log   (Invalid file permissions or file does not exist!)
/var/www/fiercephish/storage/logs/laravel.log
FiercePhish Activity Log

Email Metadata Sender Name tata Sender Email tatat@suppdeco.net Receiver Name mamam Receiver Email MY_email@gmail.com UUID
Status Sent Associated Campaign None Planned Send At Mar 9, 2017 @ 10:34:09 pm Sent At Mar 9, 2017 @ 10:34:09 pm Created At Mar 9, 2017 @ 10:34:08 pm Updated At Mar 9, 2017 @ 10:34:09 pm all service are runing open port to USE My public ip 80- 25- 587- 143 any help

Raikia commented 7 years ago

Ok, so it looks like Mailgun is refusing to send the email to that email account. If you use the sandbox mailgun email service, you have to specifically authorize recipients for it otherwise it will be rejected.

img

I assume you haven't done that and that's why it's being rejected.

Please read this: https://help.mailgun.com/hc/en-us/articles/217531258

ziflar commented 7 years ago

@Raikia i have first tried to use mailgun with curl and php script to send like this ; curl -s --user 'api:YOUR_API_KEY' \ https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages \ -F from='Excited User YOU@YOUR_DOMAIN_NAME' \ -F to='foo@example.com' \ -F cc='bar@example.com' \ -F bcc='baz@example.com' \ -F subject='Hello' \ -F text='Testing some Mailgun awesomness!' \ --form-string html='<html>HTML version of the body</html>' the first thing to do if you want to send with html string is to send an autorization to receiver. My_email@gmail.com is autorized to receive message from my domain mailgun this step is done ,because i've tested mailgun to send html string with curl and php script. and it's good to receive text and html message. thx

edit: if this is the problem why i don't have any thing related to this in mailgun logs from here:

https://app.mailgun.com/app/logs the message sent from Fiercefish is not coming to mailgun server .so there is no Logs related to message sent from Fiercefish in https://app.mailgun.com/app/logs.

i have also tested my gmail credentiels to use gmail smtp and i have always the some problem's i don't receive any message . smtp gmail work perfect with python ... script

ziflar commented 7 years ago

@Raikia please try to test it with mailgun and Gmail smtp and edit have you tried with a purchased domain.?? How to do with port 25 blocked by every ISP ?? can i change postfix config to use submission port (587)?

burakubosu commented 7 years ago

Maybe is the same problem i have

[2017-03-16 19:00:40] Processed: App\Jobs\SendEmail
Error: Address in mailbox given [] does not comply with RFC 2822, 3.6.2.
Raikia commented 7 years ago

@burakubosu please check: https://github.com/Raikia/FiercePhish/issues/36#issuecomment-283185171

@ziflar I'm having a difficult time reproducing this problem you are experiencing. Can you sanitize your ".env" file from sensitive information and provide that maybe? :-/

leoiii5 commented 7 years ago

i have the same problem can you fix plz i test sendmail from terminal and the email is in my inbox but wen i send email in fierce i receive nothing i have smtp

leoiii5 commented 7 years ago

the whole problem is the time i live in africa and the times is in chicago the last try i change the time zone and hoope the email is in the box thank you

ziflar commented 7 years ago

@leoiii5 i've tested this way with no result. i've changed the time to my time zone but always the same problem @+

Raikia commented 7 years ago

@ziflar I'm having a difficult time reproducing this problem you are experiencing. Can you sanitize your ".env" file from sensitive information and provide that maybe? :-/

I'm still waiting on your ".env" file so I can continue debugging this.

ziflar commented 7 years ago

@Raikia ok i'm not on ubuntu PC As soon as I have the ability to connect from ubuntu I would post you my ".env" . It would be in a short time. I'm so sorry my friend

ziflar commented 7 years ago

@Raikia here my".env"

If you edit this file, it is imperative that you run:

php artisan config:cache

############################ ####### App Settings ####### ############################

Application environment (default: master)

APP_ENV=master

Debugging mode (default: false)

APP_DEBUG=false

Application Logging level

APP_LOG_LEVEL=debug

Application Timezone (default: America/Chicago)

APP_TIMEZONE=Changed_to_my_time_zone(Europe/City)

Application encryption key

Generate this with "php artisan key:generate"

Then run: "php artisan config:cache"

APP_KEY=base64:bababababbbggdgdggggdgda=

Application URL (default: http://localhost)

APP_URL=http://127.0.0.1:80

Application Name, no need to change this (default: FiercePhish)

APP_NAME=FiercePhish

-------------------------------------------------------------------------------

############################## ####### Proxy Settings ####### ##############################

Root URL prefix for the proxy. (default: null)

This is useful if FiercePhish is behind a proxy or loadbalancer

Example: https://firephish.example.com/

PROXY_URL=null

Schema to use for the proxy. (default null)

This is useful if FiercePhish is behind a HTTPS proxy or loadbalancer

Options: null https http

PROXY_SCHEMA=null

-------------------------------------------------------------------------------

################################# ####### Database Settings ####### #################################

Database type (default: mysql)

DB_CONNECTION=mysql

Database host (default: 127.0.0.1)

DB_HOST=127.0.0.1

Database port (default: 3306)

DB_PORT=3306

Database username (default: root)

DB_USERNAME=fiercephish

Database password

DB_PASSWORD=My_db_password

Database name (default: fiercephish)

DB_DATABASE=fiercephish

-------------------------------------------------------------------------------

##############################

Service settings

##############################

Cache driver (this shouldn't really change) (default: file)

CACHE_DRIVER=file

Session driver (this shouldn't really change) (default: file)

SESSION_DRIVER=file

Broadcast driver (this shouldn't really change) (default: log)

BROADCAST_DRIVER=log

Queue drvier (this shouldn't really change) (default: database)

QUEUE_DRIVER=database

Redis hostname (this is unused currently) (default: 127.0.0.1)

REDIS_HOST=127.0.0.1

Redis password (this is unused currently) (default: null)

REDIS_PASSWORD=null

Redis port (this is unused currently) (default: 6379)

REDIS_PORT=6379

Pusher App ID (this is unused currently) (default: null)

PUSHER_APP_ID=null

Pusher key (this is unused currently) (default: null)

PUSHER_APP_KEY=null

Pusher secret (this is unused currently) (default: null)

PUSHER_APP_SECRET=null

-------------------------------------------------------------------------------

############################# ####### Mail settings ####### #############################

Mail driver to use (default: smtp)

Options: stmp mailgun

MAIL_DRIVER=mailgun

SMTP hostname (default: 127.0.0.1)

MAIL_HOST=127.0.0.1

SMTP port (default: 25)

MAIL_PORT=25

SMTP username (default: null)

MAIL_USERNAME=

SMTP password (default: null)

MAIL_PASSWORD=

SMTP connection encryption (default: null)

Options: null tls

MAIL_ENCRYPTION=

Mailgun domain (default: null)

MAILGUN_DOMAIN=sandboxgdrdgsgsrdbf543256677778643.mailgun.org(my mailgun_sandbox)

Mailgun secret key (default: null)

MAILGUN_SECRET=key-453216Ucc6dbc6xxxxxxxxxxxxxxx(my mailgun_api_key)

-------------------------------------------------------------------------------

#################################### ####### FiercePhish Settings ####### ####################################

Prefix for FiercePhish instance (default: null)

Example: if this is "test/this", access FiercePhish by browsing

to http://IP/test/this

URI_PREFIX=

Test mode for email sending (default: false)

If this is "true", emails will not actually be sent

TEST_EMAIL_JOB=false

Imap host for inbox feature (default: null)

IMAP_HOST=127.0.0.1

Imap port for inbox feature (default: 143)

IMAP_PORT=143

Imap username for inbox feature (default: fiercephish)

Currently unused

IMAP_USERNAME=fiercephish

Imap password for inbox feature (default: null)

Currently unused

IMAP_PASSWORD=FYBfFxxxxxxxxxxxxxxxxxxxxxxxxx

Email to BCC on all emails sent out (default: null)

This is helpful if you want to see all emails actually

being sent and want a log of it.

MAIL_BCC_ALL=

-------------------------------------------------------------------------------

################################# ####### Advanced Settings ####### #################################

This enables Analytics to see how much FiercePhish is actually being used. By

being able to see how much this project is being used, I can dedicate time to

specific features and it encourages development. All information is anonymized

and no sensitive data is ever sent. However, if you would like to disable this,

change below to "false". It is much appreciated to keep it enabled, however.

(default: true)

ANALYTICS=true

Raikia commented 7 years ago

Ok, I've reproduced the bug. Sorry for the delay, a fix will be pushed shortly

Raikia commented 7 years ago

Fix has been pushed. You can update by using the "./update.sh" script.

This was a combination of the bug identified in #36 and a bug with reporting emails as being sent instead of failed. I also added more logging so when it says "check the logs", there is actually a log to check!

Sorry it took me a while to get to this, but you should be good to go. Respond back here if you still have the issue and I will re-open the issue ticket.

ziflar commented 7 years ago

@Raikia Hi now it's ok with mailgun and Gmail smtp . there is a problem with ./update.sh . please edit the install.sh on line 352