Using .authinfo With Org Code Blocks

As most of you know, I’m a big fan of using literate programming techniques in the context of what might be described as “devops”. The technique boils down to writing an Org file with code blocks that document how you are solving a particular problem. The key is that the code blocks are executable and are what you actually use to solve the problem. Howard Abrams has a really good introduction to the idea in a post and subsequent video.

Magnus Therning has a nice nice post that expands on the same theme. His wrinkle is that the applications he’s interacting with require login credentials. For a long time, he simply kept those credentials as plain text in his Org file but, of course, he realized that was a bad thing.

He solved the problem by putting his credentials in his .authinfo file and accessing them with the auth-source library. He wrote a couple of functions that used the auth-source library to retrieve the necessary credentials. He populated these in a properties block. This is perfect because the source code doesn’t show any secrets but those secrets are made available to the executing code.

I do something similar to retrieve secrets that I don’t want exposed in plain text. The .authinfo file and associated library is a really useful set of tools to enable access to secure applications without exposing the required credentials. Take a look at his post to see how easy it is.

This entry was posted in General and tagged , . Bookmark the permalink.