Actuarial Outpost
 
Go Back   Actuarial Outpost > Actuarial Discussion Forum > Software & Technology
FlashChat Actuarial Discussion Preliminary Exams CAS/SOA Exams Cyberchat Around the World Suggestions

DW Simpson
Actuarial Jobs

Visit our site for the most up to date jobs for actuaries.

Actuarial Salary Surveys
Property & Casualty, Health, Life, Pension and Non-Tradtional Jobs.

Actuarial Meeting Schedule
Browse this year's meetings and which recruiters will attend.

Contact DW Simpson
Have a question?
Let's talk.
You'll be glad you did.


Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-24-2020, 11:49 AM
Colonel Smoothie's Avatar
Colonel Smoothie Colonel Smoothie is offline
Member
CAS
 
Join Date: Sep 2010
College: Jamba Juice University
Favorite beer: AO Amber Ale
Posts: 49,728
Default Automating something that requires authentication

I want to pull some data on a daily basis from several vendors. This can be automated but I need to input keys from each vendor to authenticate myself.

What's the best way to do this securely? I don't want to put my keys in the code, but I also don't want to type in 10 keys every day at the same time, either.
__________________
Recommended Readings for the EL Actuary || Recommended Readings for the EB Actuary

Quote:
Originally Posted by Wigmeister General View Post
Don't you even think about sending me your resume. I'll turn it into an origami boulder and return it to you.
Reply With Quote
  #2  
Old 01-24-2020, 11:52 AM
Kenny's Avatar
Kenny Kenny is offline
Member
Non-Actuary
 
Join Date: Jan 2003
Posts: 8,279
Default

Can you pull the keys from a password protected file so you only need to enter a single password?
__________________
Play Free Games and Win Real Money
I am a scientist. I am sorry to disappoint you but I have never seen an elf or a troll. But who am I to exclude their existence? - Arni Bjoernsson
You are stupid and evil and do not know you are stupid and evil. ... Dumb students are educated stupid. - timecube.com
Usually while I'm reading, I'm actually thinking about...midgets riding toy horses - Roto


Reply With Quote
  #3  
Old 01-24-2020, 12:08 PM
whoanonstop's Avatar
whoanonstop whoanonstop is offline
Member
Non-Actuary
 
Join Date: Aug 2013
Location: Los Angeles, CA
Studying for Spark / Scala
College: College of William and Mary
Favorite beer: Orange Juice
Posts: 5,916
Blog Entries: 1
Default

Generally done with secret scopes, depending on what system or platform you're using. Most likely you can just search for secrets with respect to that; more generally:

https://docs.python.org/3/library/secrets.html

-Riley
__________________
Reply With Quote
  #4  
Old 01-24-2020, 02:30 PM
examsarehard examsarehard is offline
Member
CAS
 
Join Date: May 2011
Posts: 613
Default

Some services provide an API you can use, but chances are not all of your vendors do. I have also had a vendor change their API which broke my login process, so in general these things can be brittle.

If you just need to login through a web portal you can use some password manager to handle the login for you, then pull your data using whatever token they provide.

If you're bent on using a script, you can save your credentials in Windows credential manager. I'm sure Linux has something similar but I never had to set something like that up.

https://db.rstudio.com/best-practice...g-credentials/
Reply With Quote
  #5  
Old 01-24-2020, 04:45 PM
Meshuga's Avatar
Meshuga Meshuga is offline
Member
Non-Actuary
 
Join Date: Dec 2001
Posts: 13,009
Default

do any of these help?

https://stackoverflow.com/questions/...fuscation-only

i have python scripts stored on the network where anyone can view them but have my passwords stored locally as an environment variable that i call using os.environ['var_name']
__________________
I know I don't talk in my sleep. Someone at work would have told me by now.

Last edited by Meshuga; 01-24-2020 at 05:21 PM..
Reply With Quote
  #6  
Old 01-25-2020, 02:43 PM
Colonel Smoothie's Avatar
Colonel Smoothie Colonel Smoothie is offline
Member
CAS
 
Join Date: Sep 2010
College: Jamba Juice University
Favorite beer: AO Amber Ale
Posts: 49,728
Default

Hey thanks, I ended up using a combination of what everyone suggested. I encrypted all the keys and then generated a master key stored in ~/.bashrc as an environment variable. The script calls the master key which wouldn't work if someone else tried to run it since they don't have access to my ~/.bashrc file. Then I can set this up as a chronjob that runs daily without any intervention on my part.

So...I think it's secure...I hope
__________________
Recommended Readings for the EL Actuary || Recommended Readings for the EB Actuary

Quote:
Originally Posted by Wigmeister General View Post
Don't you even think about sending me your resume. I'll turn it into an origami boulder and return it to you.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT -4. The time now is 06:47 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
*PLEASE NOTE: Posts are not checked for accuracy, and do not
represent the views of the Actuarial Outpost or its sponsors.
Page generated in 0.25623 seconds with 11 queries