Smtp server configuration error on privacyIDEA 3.04

Hi! I’m having errors when trying to configure smtp to get the token value.
500 internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application. can you help me? Thanks

Hi and welcome to the community.

You need to check the privacyidea log (usually located in /var/log/privacyidea/privacyidea.log) for an error. Otherwise we won’t be able to tell what went wrong.

Thanks for the answer. The email is Ok! How do I enable and disable a token with privacyIDEA API? Thanks.

Have a look here:

Hi plettich, thanks. It worked!
How do I create a client
(.Net C #) to integrate with
privacyIDEA by consuming the API?
I am accessing the resources using the Postman tool.

We do have an SDK for Java:


but it is still work in progress.

Here is an older post on using the API:

What is more feasible with a .net background and an Oracle database. Do you have an integration suggestion?

main features I need: Enable and Disable a token
Validate OTP
Reset OTP Token
Verify Activated Token integrating with privacyIDEA server through a .Net client and backgroud, is it possible?

Yes. This is all in the token endpoint documentation @plettich mentioned earlier.

After all the webui you see is a single page application to the REST API.
So everything is possible in the API.

Hey @Alane_Freitas how did you resolve the internal server error?

1 Like

Hi,

Please help we got an 500 internal error when trying send email test.
Below is the log:
[2024-04-27 12:04:26,533][13581][140078124156672][ERROR][privacyidea.app:1891] Exception on /smtpserver/send_test_email [POST]
Traceback (most recent call last):
File “/opt/privacyidea/lib/python2.7/site-packages/flask/app.py”, line 2446, in wsgi_app
response = self.full_dispatch_request()
File “/opt/privacyidea/lib/python2.7/site-packages/flask/app.py”, line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/opt/privacyidea/lib/python2.7/site-packages/flask/app.py”, line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/opt/privacyidea/lib/python2.7/site-packages/flask/app.py”, line 1949, in full_dispatch_request
rv = self.dispatch_request()
File “/opt/privacyidea/lib/python2.7/site-packages/flask/app.py”, line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File “/opt/privacyidea/lib/python2.7/site-packages/privacyidea/api/lib/prepolicy.py”, line 151, in policy_wrapper
return wrapped_function(*args, **kwds)
File “/opt/privacyidea/lib/python2.7/site-packages/privacyidea/lib/log.py”, line 155, in log_wrapper
return func(*args, **kwds)
File “/opt/privacyidea/lib/python2.7/site-packages/privacyidea/api/smtpserver.py”, line 158, in test
u"The configuration {} is working.".format(identifier))
File “/opt/privacyidea/lib/python2.7/site-packages/privacyidea/lib/smtpserver.py”, line 157, in send_or_enqueue_email
return send(config, recipient, subject, body, sender, reply_to, mimetype)
File “/opt/privacyidea/lib/python2.7/site-packages/privacyidea/lib/smtpserver.py”, line 108, in test_email
timeout=config.get(‘timeout’, TIMEOUT))
File “/usr/lib64/python2.7/smtplib.py”, line 255, in init
(code, msg) = self.connect(host, port)
File “/usr/lib64/python2.7/smtplib.py”, line 315, in connect
self.sock = self._get_socket(host, port, self.timeout)
File “/usr/lib64/python2.7/smtplib.py”, line 290, in _get_socket
return socket.create_connection((host, port), timeout)
File “/usr/lib64/python2.7/socket.py”, line 571, in create_connection
raise err
error: [Errno 13] Permission denied
[2024-04-27 12:04:34,012][13581][140078140942080][ERROR][privacyidea.app:1891] Exception on /smtpserver/send_test_email [POST]
Traceback (most recent call last):

please advice how to resolve it. Thanks in advance

Regards,
Jhony

set the selinux to disable

Hi

I am new here and i have smtp config problem. can you help me.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/privacyidea/lib/python3.10/site-packages/flask/app.py”, line 1511, in wsgi_app
response = self.full_dispatch_request()
File “/opt/privacyidea/lib/python3.10/site-packages/flask/app.py”, line 919, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/opt/privacyidea/lib/python3.10/site-packages/flask/app.py”, line 917, in full_dispatch_request
rv = self.dispatch_request()
File “/opt/privacyidea/lib/python3.10/site-packages/flask/app.py”, line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File “/opt/privacyidea/lib/python3.10/site-packages/privacyidea/api/lib/prepolicy.py”, line 172, in policy_wrapper
return wrapped_function(*args, **kwds)
File “/opt/privacyidea/lib/python3.10/site-packages/privacyidea/lib/log.py”, line 174, in log_wrapper
return func(*args, **kwds)
File “/opt/privacyidea/lib/python3.10/site-packages/privacyidea/api/smtpserver.py”, line 136, in test
r = send_or_enqueue_email(s, recipient,
File “/opt/privacyidea/lib/python3.10/site-packages/privacyidea/lib/smtpserver.py”, line 160, in send_or_enqueue_email
return send(config, recipient, subject, body, sender, reply_to, mimetype)
File “/opt/privacyidea/lib/python3.10/site-packages/privacyidea/lib/smtpserver.py”, line 114, in test_email
mail = smtplib.SMTP(smtp_url.hostname,
File “/usr/lib/python3.10/smtplib.py”, line 255, in init
(code, msg) = self.connect(host, port)
File “/usr/lib/python3.10/smtplib.py”, line 343, in connect
(code, msg) = self.getreply()
File “/usr/lib/python3.10/smtplib.py”, line 401, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed: "
smtplib.SMTPServerDisconnected: Connection unexpectedly closed: timed out

Hi @eric and welcome,

it looks like the privacyIDEA machine is unable to connect to the mail-server:

Please verify that a connection to the mail-server is possible from the privacyIDEA machine.