diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-01 23:28:48 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-04-01 23:33:13 -0700 |
commit | e736bb553d404ba03c4e2d4cc58d8d1db9b6a85e (patch) | |
tree | 5b8311edfbff8771db5c8555c08d419bba26fbb0 | |
parent | 2797bf6f6190e2937c43c238f98dc51348054c90 (diff) | |
download | consfigurator-e736bb553d404ba03c4e2d4cc58d8d1db9b6a85e.tar.gz |
add SSH:AUTHORIZED-KEYS
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r-- | consfigurator.asd | 1 | ||||
-rw-r--r-- | src/package.lisp | 5 | ||||
-rw-r--r-- | src/property/ssh.lisp | 29 |
3 files changed, 35 insertions, 0 deletions
diff --git a/consfigurator.asd b/consfigurator.asd index 14b5052..9c00b25 100644 --- a/consfigurator.asd +++ b/consfigurator.asd @@ -35,6 +35,7 @@ (:file "src/property/user") (:file "src/property/git") (:file "src/property/gnupg") + (:file "src/property/ssh") (:file "src/property/sshd") (:file "src/connection/shell-wrap") (:file "src/connection/fork") diff --git a/src/package.lisp b/src/package.lisp index c65421a..63f39af 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -305,6 +305,11 @@ (:local-nicknames (#:file #:consfigurator.property.file)) (:export #:snapshot-extracted)) +(defpackage :consfigurator.property.ssh + (:use #:cl #:consfigurator) + (:local-nicknames (#:file #:consfigurator.property.file)) + (:export #:authorized-keys)) + (defpackage :consfigurator.property.sshd (:use #:cl #:consfigurator) (:local-nicknames (#:re #:cl-ppcre) diff --git a/src/property/ssh.lisp b/src/property/ssh.lisp new file mode 100644 index 0000000..08b7b32 --- /dev/null +++ b/src/property/ssh.lisp @@ -0,0 +1,29 @@ +;;; Consfigurator -- Lisp declarative configuration management system + +;;; Copyright (C) 2021 Sean Whitton <spwhitton@spwhitton.name> + +;;; This file is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3, or (at your option) +;;; any later version. + +;;; This file is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. + +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +(in-package :consfigurator.property.ssh) +(named-readtables:in-readtable :consfigurator) + +(defprop authorized-keys :posix (&rest keys) + "Permits using KEYS to SSH in as the current user." + (:desc (declare (ignore keys)) + (strcat (get-user) " has authorized_keys")) + (:apply + (file:directory-exists ".ssh") + (apply #'file:contains-lines ".ssh/authorized_keys" keys)) + (:unapply + (apply #'file:lacks-lines ".ssh/authorized_keys" keys))) |