emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Storing database credentials outside an org file
@ 2021-11-01  3:05 Mike Gauland
  2021-11-01  3:33 ` Tim Cross
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Gauland @ 2021-11-01  3:05 UTC (permalink / raw)
  To: emacs-orgmode

I often use an org file to record database queries, using sql source 
blocks. I've been putting the database credentials in the file using 
header-args:sql properties, but I'd prefer to have the credentials saved 
in a separate file for security reasons.

Any ideas on how I could make this work?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Storing database credentials outside an org file
  2021-11-01  3:05 Storing database credentials outside an org file Mike Gauland
@ 2021-11-01  3:33 ` Tim Cross
  2021-11-01  5:54   ` Rob Sargent
  2021-11-02  2:15   ` Mike Gauland
  0 siblings, 2 replies; 5+ messages in thread
From: Tim Cross @ 2021-11-01  3:33 UTC (permalink / raw)
  To: emacs-orgmode


Mike Gauland <mikelygee@gmail.com> writes:

> I often use an org file to record database queries, using sql source blocks.
> I've been putting the database credentials in the file using header-args:sql
> properties, but I'd prefer to have the credentials saved in a separate file for
> security reasons.
>
> Any ideas on how I could make this work?

It probably wouldn't be too hard to use the authinfo.gpg facility via
the auth-source library which is included in Emacs. In fact, I think
sql-mode might already have support for this built in.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Storing database credentials outside an org file
  2021-11-01  3:33 ` Tim Cross
@ 2021-11-01  5:54   ` Rob Sargent
  2021-11-02  2:15   ` Mike Gauland
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Sargent @ 2021-11-01  5:54 UTC (permalink / raw)
  To: Tim Cross; +Cc: emacs-orgmode

Most servers have a plain text file (permissions 004) that let you add name  and pass and db

> On Oct 31, 2021, at 9:51 PM, Tim Cross <theophilusx@gmail.com> wrote:
> 
> 
> Mike Gauland <mikelygee@gmail.com> writes:
> 
>> I often use an org file to record database queries, using sql source blocks.
>> I've been putting the database credentials in the file using header-args:sql
>> properties, but I'd prefer to have the credentials saved in a separate file for
>> security reasons.
>> 
>> Any ideas on how I could make this work?
> 
> It probably wouldn't be too hard to use the authinfo.gpg facility via
> the auth-source library which is included in Emacs. In fact, I think
> sql-mode might already have support for this built in.
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Storing database credentials outside an org file
  2021-11-01  3:33 ` Tim Cross
  2021-11-01  5:54   ` Rob Sargent
@ 2021-11-02  2:15   ` Mike Gauland
  2021-11-07  0:24     ` Thomas S. Dye
  1 sibling, 1 reply; 5+ messages in thread
From: Mike Gauland @ 2021-11-02  2:15 UTC (permalink / raw)
  To: emacs-orgmode

On 1/11/21 4:33 pm, Tim Cross wrote:
> Mike Gauland <mikelygee@gmail.com> writes:
>
>> I often use an org file to record database queries, using sql source blocks.
>> I've been putting the database credentials in the file using header-args:sql
>> properties, but I'd prefer to have the credentials saved in a separate file for
>> security reasons.
>>
>> Any ideas on how I could make this work?
> It probably wouldn't be too hard to use the authinfo.gpg facility via
> the auth-source library which is included in Emacs. In fact, I think
> sql-mode might already have support for this built in.
>
Thanks for the suggestion. I didn't see it on worg, but in ob-sql.el I 
found support for ":dbconnection". I can set up an entry in 
sql-connection-alist, and give the name of the entry to the sql block 
via :dbconnection. Now, my password is safely out of the .org file. As a 
bonus, it is easier to maintain across different org files.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Storing database credentials outside an org file
  2021-11-02  2:15   ` Mike Gauland
@ 2021-11-07  0:24     ` Thomas S. Dye
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2021-11-07  0:24 UTC (permalink / raw)
  To: emacs-orgmode

Aloha Mike,

Mike Gauland <mikelygee@gmail.com> writes:

> On 1/11/21 4:33 pm, Tim Cross wrote:
>> Mike Gauland <mikelygee@gmail.com> writes:
>>
>>> I often use an org file to record database queries, using sql 
>>> source blocks.
>>> I've been putting the database credentials in the file using 
>>> header-args:sql
>>> properties, but I'd prefer to have the credentials saved in a 
>>> separate file for
>>> security reasons.
>>>
>>> Any ideas on how I could make this work?
>> It probably wouldn't be too hard to use the authinfo.gpg 
>> facility via
>> the auth-source library which is included in Emacs. In fact, I 
>> think
>> sql-mode might already have support for this built in.
>>
> Thanks for the suggestion. I didn't see it on worg, but in 
> ob-sql.el I found
> support for ":dbconnection". I can set up an entry in 
> sql-connection-alist, and
> give the name of the entry to the sql block via :dbconnection. 
> Now, my password
> is safely out of the .org file. As a bonus, it is easier to 
> maintain across
> different org files.

The Worg entry should be fixed now.  Thanks for the report.

All the best,
Tom
-- 
Thomas S. Dye
https://tsdye.online/tsdye


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-07  0:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01  3:05 Storing database credentials outside an org file Mike Gauland
2021-11-01  3:33 ` Tim Cross
2021-11-01  5:54   ` Rob Sargent
2021-11-02  2:15   ` Mike Gauland
2021-11-07  0:24     ` Thomas S. Dye

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).