diff options
-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))) |