lemur icon indicating copy to clipboard operation
lemur copied to clipboard

Importing all certificates from AWS

Open johnakash opened this issue 10 years ago • 8 comments

Hi Team,

We are having around 300+ certificates on our infra and we would like to use Lemur to manage them. Could you please let us know how can we perform bulk import?

Now we are using venafi for managing the SSLs. Could you please let us know how to perform bulk import?

Is it possible to perform a network scan to identify the SSL certs on our AWS infra?

johnakash avatar Mar 28 '16 09:03 johnakash

I am not sure how you would migrate from Venafi to Lemur. But if all of your certificates are in AWS Lemur does have the ability to pull down and track existing certificates.

Assuming Lemur has been installed and given the correct IAM roles (see here).

You would then add a 'source' in Lemur that with the account or accounts your wish to sync.

After which you will need to run the lemur sync_sources command. This can be a one time import or you can put the command in a cron to be run on a interval. (docs)

I believe Venafi does have an API, if you wanted to migrate certificates from Venafi to Lemur you might have to write a source plugin. See here for the docs on how to write a plugin and here for an example of the AWS source plugin. It's fairly straightforward.

kevgliss avatar Mar 28 '16 16:03 kevgliss

Hi kevgliss,

Thanks for the quick response. The assume role is already in place but unfortunately the SSL certificates are not seems to be pulling down. Could you please let us know how can we debug more to identify the issue?

johnakash avatar Mar 28 '16 19:03 johnakash

Hi kevgliss,

Thanks for the quick response. The assume role is already in place but unfortunately the SSL certificates are not seems to be pulling down. Could you please let us know how can we debug more to identify the issue?

johnakash avatar Mar 28 '16 19:03 johnakash

What happens when you run lemur sync -list? Anything in the logs look interesting?

kevgliss avatar Mar 28 '16 22:03 kevgliss

Hi kevgliss,

While we are running lemur sync -list we are getting an error and the same is mentioned below,

lemur sync -list usage: lemur [-c CONFIG] [-?] {show_urls,shell,provision_elb,sync_sources,create_user,rotate_elbs,lock,check_revoked,db,init,runserver,start,unlock,create_role,notify,clean,publish_verisign_units,rolling,create_config} ... lemur: error: invalid choice: 'sync' (choose from u'show_urls', 'shell', u'provision_elb', 'sync_sources', u'create_user', u'rotate_elbs', 'lock', 'check_revoked', u'db', u'init', u'runserver', u'start', 'unlock', u'create_role', 'notify', u'clean', 'publish_verisign_units', u'rolling', 'create_config')

But while we are running lemur sync_sources we are getting the below response,

/www/lemur/local/lib/python2.7/site-packages/flask_sqlalchemy/init.py:800: UserWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning. warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning.') Active Label Description True 1-aws 1 accout SSL certs! True 2-aws 2 AWS! True 3-aws 3 for test!

johnakash avatar Mar 29 '16 06:03 johnakash

Apologies, I thought that command got renamed. (looks like the docs drifted from the code a bit). What do you get when running lemur sync_sources -s 1-aws? That should attempt to sync up that source. You can also sync multiple sources by comma seperating the sources e.g. lemur sync_sources -s 1-aws,2-aws,3-aws

kevgliss avatar Mar 29 '16 17:03 kevgliss

Hi Kevgliss,

I am apologizing for the delay caused on the response. Please find the output of the command below,

lemur sync_sources -s 1-aws /www/lemur/local/lib/python2.7/site-packages/flask_sqlalchemy/init.py:800: UserWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning. warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning.') [+] Staring to sync sources: 1-aws! Traceback (most recent call last): File "/www/lemur/bin/lemur", line 9, in load_entry_point('lemur', 'console_scripts', 'lemur')() File "/www/lemur/lemur/manage.py", line 848, in main manager.run() File "/www/lemur/local/lib/python2.7/site-packages/flask_script/init.py", line 412, in run result = self.handle(sys.argv[0], sys.argv[1:]) File "/www/lemur/local/lib/python2.7/site-packages/flask_script/init.py", line 383, in handle res = handle(_args, *_config) File "/www/lemur/local/lib/python2.7/site-packages/flask_script/commands.py", line 216, in call return self.run(_args, *_kwargs) File "/www/lemur/lemur/manage.py", line 223, in sync_sources sync(labels=labels) File "/www/lemur/lemur/sources/service.py", line 87, in sync sync_create(certificate, source) File "/www/lemur/lemur/sources/service.py", line 41, in sync_create cert = cert_service.import_certificate(**certificate) File "/www/lemur/lemur/certificates/service.py", line 179, in import_certificate cert.owner = kwargs.get('owner', current_app.config.get('LEMUR_SECURITY_TEAM_EMAIL')[0]) IndexError: list index out of range

But while executing the command on those accounts in which there is not SSL configured is showing the response shown below, _ lemur sync_sources -s 2-aws /www/lemur/local/lib/python2.7/site-packages/flask_sqlalchemy/init.py:800: UserWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning. warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning.') [!] Unable to acquire file lock on /tmp/.lemur_lock, is there another sync running? [+] Staring to sync sources: 2-aws! [+] Finished syncing sources. Run Time: 10.8733239174

johnakash avatar Apr 05 '16 09:04 johnakash

I would check in your config that LEMUR_SECURITY_TEAM_EMAIL is set. This is used as the owner of imported certificates as Lemur doesn't know who the owner is.

We could possibly update the docs to be explicit about what values you need to replace/add.

Or perhaps/additionally we can modify the create_config command to ask for these values and insert them into the config.

kevgliss avatar Apr 05 '16 16:04 kevgliss