Pull password from gnome keyring in Julia?

Viewed 82

I’ve looked around but can not find a julia package that will let me pull an encrypted password which is stored in my linux gnome keyring. I use it for keeping scripts that connect to SQL servers, anonymous because I have to distribute them to several group members.

In R, the “keyringer” package has a “decrypt_gk_pw” function that can pull a stored password right from the gnome keyring. Is there anything analogous in Julia or would we have to build it?

2 Answers

https://rdrr.io/cran/keyringr/src/R/decrypt_gk_pw.R

invisible(system(paste("secret-tool lookup ", key_value_pairs, sep=""), intern=TRUE))

so:

> secret-tool store --label=mylabel db mydb user user1
Password: 
> julia -e 'read(`secret-tool lookup db mydb user user1`, String) |> println'
blah

if you need it to go to your clipboard, you can replace the println with clipboard

This is my final solution, and it does work to hide the password, but anyone who knows Julia can simply remove the semicolon at the end, and it will appear, so not exactly what I wanted. I have to circulate this code to colleagues and others. The syntax for the ODBC connection is very specific with respect to “,” and “;” . Thx. J

con3 = ODBC.Connection(
    "Driver=ODBC Driver 17 for SQL Server;
    SERVER=66.66.66.66;
    DATABASE=dbname;
    UID=username;
    PWD=$(read(`secret-tool lookup word1 word2 word3 word4`,String))");
Related