Recently I had to change another user’s password due to a probable typo. Using the login page’s “forgot password” displayed a 500 error. Looking through Kiwi’s dashboard, documentation, and github discussions, it was said that users can only change their own passwords. While I have worked around the issue (unable to change password) by using
docker exec -it kiwi_web /Kiwi/manage.py changepassword userNameHere
, I want to know if the cause for the initial 500 error is due to a settings issue in Kiwi’s common.py file or it is something else entirely.
Tried
https://docs.djangoproject.com/en/2.2/topics/auth/default/
https://kiwitcms.readthedocs.io/en/latest/configuration.html
https://github.com/kiwitcms/Kiwi/issues/610
https://docs.djangoproject.com/en/2.0/topics/email/#quick-example
EMAIL_BACKEND = 'django_ses.SESBackend'
AWS_SES_ACCESS_KEY_ID = 'key'
AWS_SES_SECRET_ACCESS_KEY = 'key'
EMAIL_HOST = ''
EMAIL_PORT = 25
EMAIL_FROM = 'mail'
DEFAULT_FROM_EMAIL = '[email protected]'
EMAIL_SUBJECT_PREFIX = '[Kiwi-TCMS] '
Expected to be able to use password reset aimed towards the user’s set email address.
Actual is the 500 error.
New to this btw.
Thanks in advance.
EDIT:
These logs?:
IP - - [09/Aug/2019:02:52:07 +0000] "GET /accounts/passwordreset/ HTTP/1.1" 200 1944 "https://kiwitcms.domain.com/accounts/login/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"
IP - - [09/Aug/2019:02:52:08 +0000] "GET / HTTP/1.1" 302 - "-" "ELB-HealthChecker/2.0"
IP - - [09/Aug/2019:02:52:08 +0000] "POST /accounts/passwordreset/ HTTP/1.1" 500 8241 "https://kiwitcms.domain.com/accounts/passwordreset/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36"
Additionally, traceback doesnt seem to be working even after product.py’s DEBUG is True. Is this the bug you are referring to?
The question from another angle: Should the password reset function work after installing Kiwi or must I configure it, if so, what is required for config.
EDIT 2:
Are these logs relevant?
Used docker logs container | grep -i error
[Tue Aug 13 06:59:25.408480 2019] [ssl:warn] [pid 8] AH01909: RSA certificate configured for 172.22.0.3:8443 does NOT include an ID which matches the server name
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.22.0.3. Set the 'ServerName' directive globally to suppress this message
[Tue Aug 13 06:59:25.429943 2019] [lbmethod_heartbeat:notice] [pid 8] AH02282: No slotmem from mod_heartmonitor
[Tue Aug 13 06:59:25.430535 2019] [ssl:warn] [pid 8] AH01909: RSA certificate configured for 172.22.0.3:443 does NOT include an ID which matches the server name
[Tue Aug 13 06:59:25.430689 2019] [ssl:warn] [pid 8] AH01909: RSA certificate configured for 172.22.0.3:8443 does NOT include an ID which matches the server name
[Tue Aug 13 06:59:25.433497 2019] [mpm_prefork:notice] [pid 8] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_wsgi/4.6.7 Python/3.6 configured -- resuming normal operations
[Tue Aug 13 06:59:25.433519 2019] [core:notice] [pid 8] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
Ive tested it locally without changing the common and product files so it couldn’t be misconfigured. Between migrating the DB schema and creating the superuser, is there an additional step required to configure the email backend?
EDIT 3:
Finally got the traceback to show following the example from oritgaon at
https://github.com/kiwitcms/Kiwi/issues/631
Traceback:
File “/venv/lib64/python3.6/site-packages/django/core/handlers/exception.py” in inner
34. response = get_response(request)
File “/venv/lib64/python3.6/site-packages/django/core/handlers/base.py” in _get_response
115. response = self.process_exception_by_middleware(e, request)
File “/venv/lib64/python3.6/site-packages/django/core/handlers/base.py” in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/venv/lib64/python3.6/site-packages/django/views/generic/base.py” in view
71. return self.dispatch(request, *args, **kwargs)
File “/venv/lib64/python3.6/site-packages/django/utils/decorators.py” in _wrapper
45. return bound_method(*args, **kwargs)
File “/venv/lib64/python3.6/site-packages/django/utils/decorators.py” in _wrapped_view
142. response = view_func(request, *args, **kwargs)
File “/venv/lib64/python3.6/site-packages/django/contrib/auth/views.py” in dispatch
220. return super().dispatch(*args, **kwargs)
File “/venv/lib64/python3.6/site-packages/django/views/generic/base.py” in dispatch
97. return handler(request, *args, **kwargs)
File “/venv/lib64/python3.6/site-packages/django/views/generic/edit.py” in post
142. return self.form_valid(form)
File “/venv/lib64/python3.6/site-packages/django/contrib/auth/views.py” in form_valid
233. form.save(**opts)
File “/venv/lib64/python3.6/site-packages/tcms/kiwi_auth/forms.py” in save
95. extra_email_context,
File “/venv/lib64/python3.6/site-packages/django/contrib/auth/forms.py” in save
295. email, html_email_template_name=html_email_template_name,
File “/venv/lib64/python3.6/site-packages/django/contrib/auth/forms.py” in send_mail
250. email_message.send()
File “/venv/lib64/python3.6/site-packages/django/core/mail/message.py” in send
291. return self.get_connection(fail_silently).send_messages([self])
File “/venv/lib64/python3.6/site-packages/django/core/mail/backends/smtp.py” in send_messages
103. new_conn_created = self.open()
File “/venv/lib64/python3.6/site-packages/django/core/mail/backends/smtp.py” in open
63. self.connection = self.connection_class(self.host, self.port, **connection_params)
File “/opt/rh/rh-python36/root/usr/lib64/python3.6/smtplib.py” in init
251. (code, msg) = self.connect(host, port)
File “/opt/rh/rh-python36/root/usr/lib64/python3.6/smtplib.py” in connect
336. self.sock = self._get_socket(host, port, self.timeout)
File “/opt/rh/rh-python36/root/usr/lib64/python3.6/smtplib.py” in _get_socket
307. self.source_address)
File “/opt/rh/rh-python36/root/usr/lib64/python3.6/socket.py” in create_connection
724. raise err
File “/opt/rh/rh-python36/root/usr/lib64/python3.6/socket.py” in create_connection
713. sock.connect(sa)
Exception Type: OSError at /accounts/passwordreset/
Exception Value: [Errno 99] Cannot assign requested address
2
Answers
For anyone facing this issue, first go through https://kiwitcms.readthedocs.io/en/latest/installing_docker.html
TO DISPLAY TRACEBACK:
Create local_settings.py under Kiwi dir and type:
DEBUG = True
Save
In docker-compose.yml: Add line below as per https://github.com/kiwitcms/Kiwi/issues/631 to volumes
./local_settings.py:/venv/lib64/python3.6/site-packages/tcms/settings/local_settings.py
Run "docker-compose down" then "docker-compose up -d".
TO ENABLE EMAIL FOR REGISTRATION AND PASSWORD RESET:
In local_settings.py: Add code below.
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = '587'
EMAIL_HOST_USER = 'yourGmailAccountHere'
EMAIL_HOST_PASSWORD = 'yourAppPasswordHere'
EMAIL_USE_TLS = True
Save and recompose.
In summary: My installation of Kiwi required configuration of email settings for the password reset and registration email to work.
FYI I’ve opened a feature request to add a troubleshooting command. You can vote for it here: https://github.com/kiwitcms/Kiwi/issues/1070