If you have a recent enough version of the SQLite3 command line shell: sqlite3 config.db "update table set value=readfile('pubkey.pem') where key='pubkey';" sqlite3 config.db "update table set value=readfile('privkey.pem') where key='privkey';"
or, create a file, called for example, updatekeys.sql containing: update table set value=readfile('pubkey.pem') where key='pubkey'; update table set value=readfile('privkey.pem') where key='privkey'; then run in with: sqlite3 config.db < updatekeys.sql If you want to copy the existing fields to files you can do something like this: select writefile('pubkey.bak', value) from table where key='pubkey'; select writefile('privkey.bak', value) from table where key='privkey'; This is documented in section 6.1 of the CLI page https://www.sqlite.org/cli.html > -----Original Message----- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of Jacob Sylvia > Sent: Sunday, 5 March, 2017 17:39 > To: sqlite-users@mailinglists.sqlite.org > Subject: [sqlite] Need some help running sqlite3 command line > > Howdy all! > > I'm working on getting letsencrypt certificates into my FreeNAS > installation... I can't find anyone who can help me with the last piece, > the sqlite command line piece... > > The reference post is here: > https://forums.freenas.org/index.php?threads/letsencrypt-webgui-ssl-need- > sqlite3-cli-guru.50678/ > > Basically, I cant figure out how to update a text field in the sqlite > config database from the command line... > > The FreeNAS Config file is a sqlite3 database, and the two certificate > entries (the certificate and the private key) are stored in "TEXT" fields > in a specific table. What I need to do, is take the text from the two PEM > certificate/key files, and, via the command line, update the > appropriate fields... I can do "simple" fields, but I can't figure out > how > to do "TEXT" fields, given the fact that the text has line-breaks, etc. > > Any help would be greatly appreciated. > > Thanks!!! > > ~Jake > -- > Jacob D. Sylvia > Jake Sylvia's Consulting > 430 Cole St. > Seekonk, MA 02771 > Cell: (508) - 954 - 2536 > EMail:jacob.syl...@gmail.com > Web: http://www.jacobsylvia.com > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users