You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.0 KiB

  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2019 Danny Milosavljevic <dannym@scratchpost.org>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. (define-module (gnu services auditd)
  19. #:use-module (gnu services)
  20. #:use-module (gnu services configuration)
  21. #:use-module (gnu services base)
  22. #:use-module (gnu services shepherd)
  23. #:use-module (gnu packages admin)
  24. #:use-module (guix records)
  25. #:use-module (guix gexp)
  26. #:use-module (guix packages)
  27. #:export (auditd-configuration
  28. auditd-service-type))
  29. ; /etc/audit/audit.rules
  30. (define-configuration auditd-configuration
  31. (audit
  32. (package audit)
  33. "Audit package."))
  34. (define (auditd-shepherd-service config)
  35. (let* ((audit (auditd-configuration-audit config)))
  36. (list (shepherd-service
  37. (documentation "Auditd allows you to audit file system accesses.")
  38. (provision '(auditd))
  39. (start #~(make-forkexec-constructor
  40. (list (string-append #$audit "/sbin/auditd"))))
  41. (stop #~(make-kill-destructor))))))
  42. (define auditd-service-type
  43. (service-type (name 'auditd)
  44. (description "Allows auditing file system accesses.")
  45. (extensions
  46. (list
  47. (service-extension shepherd-root-service-type
  48. auditd-shepherd-service)))
  49. (default-value (auditd-configuration))))