diff --git a/back/pialert.py b/back/pialert.py index ebb1dcc5..7b8308f7 100644 --- a/back/pialert.py +++ b/back/pialert.py @@ -458,7 +458,7 @@ def execute_arpscan (pRetries): # arp-scan for larger Networks like /16 # otherwise the system starts multiple processes. the 15min cronjob isn't necessary. # the scan is about 4min on a /16 network - arpscan_args = ['sudo', 'arp-scan', '--ignoredups', '--bandwidth=512k', '--retry=2', SCAN_SUBNETS] + arpscan_args = ['sudo', 'arp-scan', '--ignoredups', '--bandwidth=512k', '--retry=3', SCAN_SUBNETS] # Default arp-scan # arpscan_args = ['sudo', 'arp-scan', SCAN_SUBNETS, '--ignoredups', '--retry=' + str(pRetries)] @@ -1223,11 +1223,11 @@ def email_reporting (): mail_text = mail_text.replace ('', socket.gethostname() ) mail_html = mail_html.replace ('', socket.gethostname() ) - mail_text = mail_text.replace ('', VERSION ) - mail_html = mail_html.replace ('', VERSION ) + # mail_text = mail_text.replace ('', VERSION ) + # mail_html = mail_html.replace ('', VERSION ) - mail_text = mail_text.replace ('', VERSION_DATE ) - mail_html = mail_html.replace ('', VERSION_DATE ) + # mail_text = mail_text.replace ('', VERSION_DATE ) + # mail_html = mail_html.replace ('', VERSION_DATE ) # mail_text = mail_text.replace ('', VERSION_YEAR ) # mail_html = mail_html.replace ('', VERSION_YEAR ) @@ -1474,12 +1474,22 @@ def send_email (pText, pHTML): # Send mail smtp_connection = smtplib.SMTP (SMTP_SERVER, SMTP_PORT) smtp_connection.ehlo() - smtp_connection.starttls() - smtp_connection.ehlo() - smtp_connection.login (SMTP_USER, SMTP_PASS) +# smtp_connection.starttls() +# smtp_connection.ehlo() +# smtp_connection.login (SMTP_USER, SMTP_PASS) + if not SafeParseGlobalBool("SMTP_SKIP_TLS"): + smtp_connection.starttls() + smtp_connection.ehlo() + if not SafeParseGlobalBool("SMTP_SKIP_LOGIN"): + smtp_connection.login (SMTP_USER, SMTP_PASS) smtp_connection.sendmail (REPORT_FROM, REPORT_TO, msg.as_string()) smtp_connection.quit() +#------------------------------------------------------------------------------- +def SafeParseGlobalBool(boolVariable): + if boolVariable in globals(): + return eval(boolVariable) + return False #=============================================================================== # DB diff --git a/config/pialert.conf b/config/pialert.conf index 8b9628e0..7c6f8043 100644 --- a/config/pialert.conf +++ b/config/pialert.conf @@ -18,6 +18,8 @@ SMTP_SERVER = 'smtp.gmail.com' SMTP_PORT = 587 SMTP_USER = 'user@gmail.com' SMTP_PASS = 'password' +SMTP_SKIP_TLS = False +SMTP_SKIP_LOGIN = False REPORT_MAIL = False REPORT_FROM = 'Pi.Alert <' + SMTP_USER +'>'