How can I send an email from Apache superset? - apache-superset

I'm facing Authentication unsuccessful error when I try to send mail from Apache Superset.
I checked the document's SMTP integration chapter:https://apache-superset.readthedocs.io/en/latest/installation.html
I changed SMTP_PASSWORD parameter and I entered password manually in my config.py file like SMTP_PASSWORD = "'xxx!!'" (I added '' because my password includes special character like '!'. Also, I tried SMTP_PASSWORD="xx!!" but also I'm getting error.
smtplib.SMTPAuthenticationError: (535, b'5.7.3 Authentication unsuccessful')
I can login with my SMTP user via browser (Exchange). Could you please help me to solve this issue?
Apache Superset version: 1.3.2
Python version:3.8
OS version: RHEL 8
Thanks

You might be able to poke at this by checking your SMTP connection from inside your Superset instance.
From where your Superset instance should be sending the emails, start a Python script and try:
import smtplib
server = smtplib.SMTP('smtpservername.yourdomain', yourportnumber)
If that command fails or hangs indefinitely, you know there's a connection problem. You might try connecting to the GMail SMTP server or another known-to-work set of credentials and seeing if that works to narrow it down.
For instance, if running Superset with docker-compose you would enter the worker container with docker exec -it superset_worker /bin/bash, run python, and try this there.
My scheduled reports were failing and doing this helped me isolate a cause: my Superset instance could not connect to the target unauthenticated SMTP server.

Related

Browser error during django + SSL connection with local server

I have a problem during adding facebook login button to my website at localhost.
I've already add mysite.com to hosts file and installed django-extensions, werkzeug, pyOpenSSL. By running command python manage.py runserver_plus --cert-file cert.crt my own-made sertificate was created. I imported this certificate to Trusted Chrome sertificates but safe connection doesn't establish. When i pass https://example.com:8000/account/login/ I hit an error NET::ERR_CERT_COMMON_NAME_INVALID,
Failed to confirm that this is the server example.com. Its safety certificate refers to *. The server may be configured incorrectly or someone is trying to intercept your data.
Please help me to solve this.

Access Django App on AWS ec2 host

This issue might seem very trivial but please try to suggest a solution for this if possible.
I have deployed a django App on AWS ec2 host and I am able to run the following command successfully.
(venv)[ec2-user#ip-xxx-xx-xx-xx abc]$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
January 03, 2016 - 13:15:31
Django version 1.7.1, using settings 'abc.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
But I am not able to access http://127.0.0.1:8000/ from the browser.
On googling it's suggesting to use nginx or gunicorn. I am not sure if nginx, gunicorn etc. are to be used for this.
Can someone please let me know how can this be accessed from browser ?
Thanks,
You need to open HTTP port in AWS instance menu.(all ports except ssh closed in AWS)
Go to your console.aws.amazon.com, then pick your instance and go to last menu item "security groups". It lauch wizard, click on "Inbound" in bottom menu, then "edit", and add HTTP or any port what you want :)
And be sure you using your public AWS IP, to open in browser
Add some screen for you, hope it help:
In order to archive this all you need to do 3 simple steps.
Go to the EC2 Console and open up the security group of your instance. go to inbound tab.
click Edit and then press add rule...add entry with type of Custom TCP Rule and port 8000..
Go to your Django project,your app and open up the settings.py script. List your IPv4 address in the allowed_hosts section.. Ex : ALLOWED_HOSTS=['public IPv4']'
Now in the console run command python manage.py runserver 0.0.0.0:8000...
Open any web browser(from any device) and open the link 'public IPv4':8000
No need any app servers like Apache, NginX..
#Baterson is right. You should open port 8000 for your server first.
Official document is here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html . It is highly detailed.

Python 2.7: Cannot connect to SFTP server using Auth key

I have to connect to a remote sftp server to upload some files using python 2.7. i have been given a username, password and the authentication key file. when i execute this code:
srv= pysftp.Connection(host='54.172.33.121',username='xxx',password='xxx',private_key='c:\SFTPKey\hajjcoreit.ppk')
i get this error:
BadAuthenticationType: ('Bad authentication type', [u'publickey']) (allowed_types=[u'publickey'])
i can access the server through winSCP though.
Edits in your code
You probably have done something wrong with the hostname. As the proper syntax for pysftp is as
import pysftp
sftp = pysftp.Connection('hostname', username='me', password='secret')
#
# ... do sftp operations
#
sftp.close() # close your connection to hostname
so now this is what you do,
srv=pysftp.Connection('sftp.54.172.33.121',username='xxx',password='xxx',private_key='c:\SFTPKey\hajjcoreit.ppk')
so you won't get any error.Also cross check with the filezilla that the link, uid and password are correct.

Cloudfoundry's cf login yields a "connection refused" error message

I am experiencing issues with the latest bosh-lite virtual box machine. See here.
I have just downloaded the Vagrantfile and done a
vagrant up
Then a:
cf login -u admin -a 192.168.50.4 -p admin
But it give me a:
API endpoint: 192.168.50.4
FAILED
connection refused
Can anyone please help?
Get address of haproxy by logging to it (bosh ssh, then ifconfig). Use address of haproxy as api endpoint.

Django - Development server all ports forbidden

I am get a little crazy with Django development server
Since yesterday, i got the following message:
0 errors found January 17, 2014 - 17:49:31
Django version 1.6.1, using settings 'applibs.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Error: You don't have permission to access that port.
And this, independently from the port i use...i tried with 8081, 8082 and so on.
I must have changed something but i can't figure out what exactly
Any help would be welcomed
thanks
EDIT: Reason Found!
I finally understand the reason for such problem and it has nothing to do with the ports as it initially seems to be.
Indeed, i am initiating a logger in Wsgi.py as shown below
logging.basicConfig(level=logging.DEBUG,format='%(asctime)s \t %(name)s \t %(levelname)s \t %(message)s', datefmt='%Y-%m-%d %H:%M:%S',filename=os.path.join(settings.BASE_DIR,'applibs.log'))
All traces are logged in a file called applibs.log
If the file does not exist, it is automatically created.
If i run the development server, the file will be created with the current user as owner and group.
If i run a production server (ie. apache), the file will be created with the apache user (www-data) as owner and group.
In any case, the file is created with write access only to the user.
So what happened?
I ran the application on a production server. The file was created with user www-data.
Then when i tried to run the application in development server, the application was trying to access the same file (which has already been created) with the current user and so the access is refused.
Et voila :)