Browse Source

Separate encryption module

main
parent
commit
3089674a0c
  1. 104
      modules/encryption.org
  2. 23
      modules/projects.org
  3. 127
      modules/writing.org

104
modules/encryption.org

@ -0,0 +1,104 @@
#+TITLE: Encryption
#+AUTHOR: Christopher James Hayward
#+EMAIL: chris@chrishayward.xyz
#+PROPERTY: header-args:emacs-lisp :tangle encryption.el :comments org
#+PROPERTY: header-args:shell :tangle no
#+PROPERTY: header-args :results silent :eval no-export :comments org
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
My source files encrypted with symmetric key encryption via *GPG*[fn:1]. This enables my workflow of storing my personal notes anywhere, including checked in to a public source repository. Emacs can cache the *GPG*[fn:1] password if you trust your session. *Pinentry*[fn:2] handled within Emacs to remain compatible without the [[file:desktop.org][Desktop]] module.
* Configuring the gpg-agent
:PROPERTIES:
:header-args: :tangle ../config/gpg-agent.conf
:END:
When the *gpg-agent*[fn:1] loads it will read the configuration at ~~/.gnupg/gpg-agent.conf~. Override the default settings to allow Emacs to function as the *Pinentry*[fn:2] application.
#+begin_src conf
allow-emacs-pinentry
allow-loopback-pinentry
#+end_src
** Restarting the gpg-agent
You may need to restart the *gpg-agent*[fn:1] to load the configuration without rebooting.
#+begin_src shell
gpgconf --reload gpg-agent
#+end_src
** Creating a symbolic link
Create the symbolic link to the configuration file
#+begin_src emacs-lisp
(dotfiles/symlink "~/.emacs.d/config/gpg-agent.conf"
"~/.gnupg/gpg-agent.conf")
#+end_src
* Setting up pinentry in Emacs
With the *Pinentry*[fn:2] package for Emacs prompts will now appear in the minibuffer.
#+begin_src emacs-lisp
(use-package pinentry
:custom (epa-file-select-keys 2)
(epa-pinentry-mode 'loopback)
(epa-file-encrypt-to dotfiles/public-key)
(epa-file-cache-passphrase-for-symmetric-encryption t)
:config (pinentry-start))
#+end_src
** Including *.gpg files
Override ~org-agenda-file-regexp~ to include =.org.gpg= files.
#+begin_src emacs-lisp
(unless (string-match-p "\\.gpg" org-agenda-file-regexp)
(setq org-agenda-file-regexp
(replace-regexp-in-string "\\\\\\.org" "\\\\.org\\\\(\\\\.gpg\\\\)?"
org-agenda-file-regexp)))
#+end_src
** Encrypting roam files
Irrelevant without the [[file:writing.org][Writing]] module, encrypt new files from capture templates.
#+begin_src emacs-lisp
(with-eval-after-load 'org-roam
(setq org-roam-encrypt-files t))
#+end_src
* Managing passwords
*Pass*[fn:3] makes managing passwords easy, encrypring them in a file structure and providing easy commands for generating, modify, and copying passwords. *Password-store.el*[fn:4] provides a wrapper for the functionality within Emacs.
#+begin_src emacs-lisp
(use-package password-store
:custom (password-store-dir dotfiles/passwords))
#+end_src
Configure keybindings behind =SPC p=.
+ Copy with =p=
+ Rename with =r=
+ Generate with =g=
#+begin_src emacs-lisp
(dotfiles/leader
"p" '(:ignore t :which-key "Passwords")
"pp" '(password-store-copy :which-key "Copy")
"pr" '(password-store-rename :which-key "Rename")
"pg" '(password-store-generate :which-key "Generate"))
#+end_src
* Resources
[fn:1] https://gnupg.org
[fn:2] https://elpa.gnu.org/packages/pinentry.html
[fn:3] https://passwordstore.org
[fn:4] https://git.zx2c4.com/password-store/tree/contrib/emacs

23
modules/projects.org

@ -82,29 +82,6 @@ Open the container management screen with =SPC k=.
"k" '(docker :which-key "Docker")) "k" '(docker :which-key "Docker"))
#+end_src #+end_src
* Passwords
*Pass*[fn:12] makes managing passwords extremely easy, encrypring them in a file structure and providing easy commands for generating, modify, and copying passwords. *Password-store.el*[fn:13] provides a wrapper for the functionality within Emacs.
#+begin_src emacs-lisp
(use-package password-store
:custom (password-store-dir dotfiles/passwords))
#+end_src
Configure keybindings behind =SPC p=.
+ Copy with =p=
+ Rename with =r=
+ Generate with =g=
#+begin_src emacs-lisp
(dotfiles/leader
"p" '(:ignore t :which-key "Passwords")
"pp" '(password-store-copy :which-key "Copy")
"pr" '(password-store-rename :which-key "Rename")
"pg" '(password-store-generate :which-key "Generate"))
#+end_src
* Management * Management
Configure *Projectile*[fn:11], a project interaction library for Emacs. It provides a nice set of features for operating on a project level without introducing external dependencies. Configure *Projectile*[fn:11], a project interaction library for Emacs. It provides a nice set of features for operating on a project level without introducing external dependencies.

127
modules/writing.org

@ -25,27 +25,6 @@ Make headline stars *super* with *Org superstar mode*[fn:3].
:hook (org-mode . org-superstar-mode)) :hook (org-mode . org-superstar-mode))
#+end_src #+end_src
* Encryption
My source files are encrypted with symmetric key encryption via *GPG*[fn:2]. This enables my workflow of storing my personal notes anywhere, including checked in to a public source repository. Emacs can cache the *GPG*[fn:2] password if you trust your session.
#+begin_src emacs-lisp
(setq epa-file-select-keys 2
epa-file-cache-passphrase-for-symmetric-encryption t
epa-file-encrypt-to dotfiles/public-key)
#+end_src
** Include *.gpg files
Override ~org-agenda-file-regexp~ to include =.org.gpg= files.
#+begin_src emacs-lisp
(unless (string-match-p "\\.gpg" org-agenda-file-regexp)
(setq org-agenda-file-regexp
(replace-regexp-in-string "\\\\\\.org" "\\\\.org\\\\(\\\\.gpg\\\\)?"
org-agenda-file-regexp)))
#+end_src
* Improvements * Improvements
Real time checking and one-shot methods to check and correct common spelling and grammatical errors. Real time checking and one-shot methods to check and correct common spelling and grammatical errors.
@ -84,7 +63,7 @@ Toggle *Writegood* mode with =SPC t w=.
"tw" '(writegood-mode :which-key "Grammar")) "tw" '(writegood-mode :which-key "Grammar"))
#+end_src #+end_src
* Management
* Knowledge base
Download and install *Org roam*[fn:4], a plain text knowledge management system for Emacs built on top of *Org mode*[fn:1]. Download and install *Org roam*[fn:4], a plain text knowledge management system for Emacs built on top of *Org mode*[fn:1].
@ -95,7 +74,6 @@ Download and install *Org roam*[fn:4], a plain text knowledge management system
(use-package org-roam (use-package org-roam
:hook (after-init . org-roam-mode) :hook (after-init . org-roam-mode)
:custom (org-roam-directory org-directory) :custom (org-roam-directory org-directory)
(org-roam-encrypt-files t)
(org-roam-capture-templates '()) (org-roam-capture-templates '())
(org-roam-dailies-capture-templates '())) (org-roam-dailies-capture-templates '()))
#+end_src #+end_src
@ -160,32 +138,7 @@ Place keybindings behind =SPC r d=.
"rdy" '(org-roam-dailies-find-yesterday :which-key "Yesterday")) "rdy" '(org-roam-dailies-find-yesterday :which-key "Yesterday"))
#+end_src #+end_src
* Organization
#+ATTR_ORG: :width 420px
#+ATTR_HTML: :width 420px
#+ATTR_LATEX: :width 420px
[[../docs/images/2021-02-13-example-agenda.gif]]
More capture templates for *Org roam*[fn:4] are defined here in the context of specific domains and topics.
#+begin_src emacs-lisp
(setq org-src-preserve-indentation t)
#+end_src
+ Configure agenda sources
#+begin_src emacs-lisp
(setq org-agenda-files '("~/.emacs.d/"
"~/.emacs.d/docs/"
"~/.emacs.d/docs/courses/"
"~/.emacs.d/docs/daily/"
"~/.emacs.d/docs/notes/"
"~/.emacs.d/docs/posts/"
"~/.emacs.d/docs/slides/"
"~/.emacs.d/hosts/"
"~/.emacs.d/modules/"))
#+end_src
** Capture templates
+ Capture template for generic documents + Capture template for generic documents
@ -204,15 +157,6 @@ More capture templates for *Org roam*[fn:4] are defined here in the context of s
"))) ")))
#+end_src #+end_src
+ Open an agenda buffer with =SPC a=
#+begin_src emacs-lisp
(dotfiles/leader
"a" '(org-agenda :which-key "Agenda"))
#+end_src
** Courses
Custom capture template for courses. Custom capture template for courses.
+ Capture a new buffer with =SPC r c c= + Capture a new buffer with =SPC r c c=
@ -236,66 +180,39 @@ Custom capture template for courses.
"))) ")))
#+end_src #+end_src
** Modules
Capture template for new modules for this project.
** Agenda integration
+ Capture a new buffer with =SPC r c m=
+ Add buffers to agenda files
#+ATTR_ORG: :width 420px
#+ATTR_HTML: :width 420px
#+ATTR_LATEX: :width 420px
[[../docs/images/2021-02-13-example-agenda.gif]]
#+begin_src emacs-lisp
(with-eval-after-load 'org-roam
(add-to-list 'org-agenda-files "~/.emacs.d/modules/")
(add-to-list 'org-roam-capture-templates
'("m" "Module" plain (function org-roam-capture--get-point)
"%?"
:file-name "modules/${slug}"
:unnarrowed t
:head
"
,#+TITLE: ${title}
,#+AUTHOR: Christopher James Hayward
,#+EMAIL: chris@chrishayward.xyz
More capture templates for *Org roam*[fn:4] are defined here in the context of specific domains and topics.
,#+PROPERTY: header-args:emacs-lisp :tangle core.el :comments org
,#+PROPERTY: header-args :results silent :eval no-export :comments org
+ Configure agenda sources
,#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
,#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
")))
#+begin_src emacs-lisp
(setq org-agenda-files '("~/.emacs.d/"
"~/.emacs.d/docs/"
"~/.emacs.d/docs/courses/"
"~/.emacs.d/docs/daily/"
"~/.emacs.d/docs/notes/"
"~/.emacs.d/docs/posts/"
"~/.emacs.d/docs/slides/"
"~/.emacs.d/hosts/"
"~/.emacs.d/modules/"))
#+end_src #+end_src
** Hosts
Capture template for new host machines for this project. This does not cover machines that are controlled via TRAMP / SSH.
+ Capture a new buffer with =SPC r c h=
+ Open an agenda buffer with =SPC a=
#+begin_src emacs-lisp #+begin_src emacs-lisp
(with-eval-after-load 'org-roam
(add-to-list 'org-roam-capture-templates
'("m" "Module" plain (function org-roam-capture--get-point)
"%?"
:file-name "modules/${slug}"
:unnarrowed t
:head
"
,#+TITLE: ${title}
,#+AUTHOR: Christopher James Hayward
,#+EMAIL: chris@chrishayward.xyz
,#+PROPERTY: header-args:emacs-lisp :tangle core.el :comments org
,#+PROPERTY: header-args :results silent :eval no-export :comments org
,#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
,#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
")))
(dotfiles/leader
"a" '(org-agenda :which-key "Agenda"))
#+end_src #+end_src
* Resources * Resources
[fn:1] https://orgmode.org [fn:1] https://orgmode.org
[fn:2] https://gnupg.org
[fn:3] https://github.com/integral-dw/org-superstar-mode [fn:3] https://github.com/integral-dw/org-superstar-mode
[fn:4] https://github.com/org-roam/org-roam [fn:4] https://github.com/org-roam/org-roam
[fn:5] https://github.com/org-roam/org-roam-server [fn:5] https://github.com/org-roam/org-roam-server

Loading…
Cancel
Save