lemur
lemur copied to clipboard
I can't create a new authority(AttributeError: 'NoneType' object has no attribute 'strip')
Hi all, thank you for creating such a great product.
I'm having trouble now because I can't create a certification authority. When I try to create a new authority, I got a message from lumer. It's Was not created! 'NoneType' object has no attribute 'strip'
like a screenshot.
I checked my lumer.log
file. This message is the relevant information maybe:
{
"asctime": "2021-10-14T15:42:45Z+0000",
"name": "lemur",
"processName": "MainProcess",
"filename": "schema.py",
"funcName": "decorated_function",
"levelname": "ERROR",
"lineno": 161,
"module": "schema",
"threadName": "MainThread",
"message": "'NoneType' object has no attribute 'strip'",
"exc_info": "Traceback (most recent call last):\n File \"/www/lemur/lemur/common/schema.py\", line 158, in decorated_function\n resp = f(*args, **kwargs)\n File \"/www/lemur/lemur/authorities/views.py\", line 230, in post\n return service.create(**data)\n File \"/www/lemur/lemur/authorities/service.py\", line 145, in create\n cert = upload(**kwargs)\n File \"/www/lemur/lemur/certificates/service.py\", line 440, in upload\n cert = Certificate(**kwargs)\n File \"<string>\", line 4, in __init__\n File \"/www/lemur/lib/python3.8/site-packages/sqlalchemy/orm/state.py\", line 433, in _initialize_instance\n manager.dispatch.init_failure(self, args, kwargs)\n File \"/www/lemur/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py\", line 68, in __exit__\n compat.raise_(\n File \"/www/lemur/lib/python3.8/site-packages/sqlalchemy/util/compat.py\", line 182, in raise_\n raise exception\n File \"/www/lemur/lib/python3.8/site-packages/sqlalchemy/orm/state.py\", line 430, in _initialize_instance\n return manager.original_init(*mixed[1:], **kwargs)\n File \"/www/lemur/lemur/certificates/models.py\", line 199, in __init__\n self.body = kwargs[\"body\"].strip()\nAttributeError: 'NoneType' object has no attribute 'strip'",
"timestamp": "2021-10-14T15:42:45Z+0000",
"hostname": "lemur"
}
And beauty exc_info
is here:
Traceback (most recent call last):
File "/www/lemur/lemur/common/schema.py", line 158, in decorated_function
resp = f(*args, **kwargs)
File "/www/lemur/lemur/authorities/views.py", line 230, in post
return service.create(**data)
File "/www/lemur/lemur/authorities/service.py", line 145, in create
cert = upload(**kwargs)
File "/www/lemur/lemur/certificates/service.py", line 440, in upload
cert = Certificate(**kwargs)
File "<string>", line 4, in __init__
File "/www/lemur/lib/python3.8/site-packages/sqlalchemy/orm/state.py", line 433, in _initialize_instance
manager.dispatch.init_failure(self, args, kwargs)
File "/www/lemur/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.raise_(
File "/www/lemur/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/www/lemur/lib/python3.8/site-packages/sqlalchemy/orm/state.py", line 430, in _initialize_instance
return manager.original_init(*mixed[1:], **kwargs)
File "/www/lemur/lemur/certificates/models.py", line 199, in __init__
self.body = kwargs["body"].strip()
AttributeError: 'NoneType' object has no attribute 'strip'
My lemur.conf.py
:
# This is just Python which means you can inherit and tweak settings
import os
_basedir = os.path.abspath(os.path.dirname(__file__))
THREADS_PER_PAGE = 8
# General
# These will need to be set to `True` if you are developing locally
CORS = False
debug = False
# this is the secret key used by flask session management
SECRET_KEY = '<secret>'
# You should consider storing these separately from your config
LEMUR_TOKEN_SECRET = '<token>'
LEMUR_ENCRYPTION_KEYS = '<key>'
# this is the secret used to generate oauth state tokens
OAUTH_STATE_TOKEN_SECRET = b'<token>'
# List of domain regular expressions that non-admin users can issue
LEMUR_ALLOWED_DOMAINS = []
# Mail Server
LEMUR_EMAIL = ''
LEMUR_SECURITY_TEAM_EMAIL = ['[email protected]']
# Certificate Defaults
LEMUR_DEFAULT_COUNTRY = 'JP'
LEMUR_DEFAULT_STATE = 'Tokyo'
LEMUR_DEFAULT_LOCATION = ''
LEMUR_DEFAULT_ORGANIZATION = 'my organization'
LEMUR_DEFAULT_ORGANIZATIONAL_UNIT = ''
# Authentication Providers
ACTIVE_PROVIDERS = []
# Metrics Providers
METRIC_PROVIDERS = []
# Logging
LOG_LEVEL = str(os.environ.get('LOG_LEVEL', 'DEBUG'))
LOG_FILE = str(os.environ.get('LOG_FILE', '/home/lemur/.lemur/lemur.log'))
LOG_UPGRADE_FILE = str(os.environ.get('LOG_FILE', '/home/lemur/.lemur/db_upgrade.log'))
LOG_JSON = True
# Database
# modify this if you are not using a local database
SQLALCHEMY_DATABASE_URI = 'postgresql://lemur:my_secret@localhost:5432/lemur'
# AWS
#LEMUR_INSTANCE_PROFILE = 'Lemur'
# Issuers
# These will be dependent on which 3rd party that Lemur is
# configured to use.
# VERISIGN_URL = ''
# VERISIGN_PEM_PATH = ''
# VERISIGN_FIRST_NAME = ''
# VERISIGN_LAST_NAME = ''
# VERSIGN_EMAIL = ''
Does anyone have a good solution for this? (I am not good at English. If you can't understand my english, please ask me feel free.)
Thanks for reading this far!