aboutsummaryrefslogtreecommitdiff
path: root/src/property
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-02-10 11:58:14 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-02-10 12:16:32 -0700
commit3a037315b8cb60d8c6da94ba6db7123292592fa1 (patch)
tree6c89a1e2f64b98180c3ef2c67276d208f8ca42aa /src/property
parent8be015008b3e876be37e64179be2ff0a7198c5f9 (diff)
downloadconsfigurator-3a037315b8cb60d8c6da94ba6db7123292592fa1.tar.gz
add FIREWALLD:ZONE-HAS-SOURCE
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property')
-rw-r--r--src/property/firewalld.lisp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/property/firewalld.lisp b/src/property/firewalld.lisp
index ee69cb5..6c6f337 100644
--- a/src/property/firewalld.lisp
+++ b/src/property/firewalld.lisp
@@ -228,6 +228,22 @@ only FIREWALLD:DEFAULT-ZONE."
:check `(,#?"--zone=${zone}" ,#?"--query-interface=${interface}")
:apply `(,#?"--zone=${zone}" ,#?"--remove-interface=${interface}"))))
+(defproplist zone-has-source :posix (zone source)
+ (:desc #?"firewalld zone ${zone} has source ${source}")
+ (with-unapply
+ (installed)
+ (has-zone zone)
+ (%firewall-cmd
+ t :file #?"zones/${zone}.xml" :warning "ZONE_ALREADY_SET"
+ :check `(,#?"--zone=${zone}" ,#?"--query-source=${source}")
+ :apply `(,#?"--zone=${zone}" ,#?"--add-source=${source}"))
+ :unapply
+ (%firewall-cmd
+ t :file #?"zones/${zone}.xml" :warning "UNKNOWN_SOURCE"
+ :complement-check t
+ :check `(,#?"--zone=${zone}" ,#?"--query-source=${source}")
+ :apply `(,#?"--zone=${zone}" ,#?"--remove-source=${source}"))))
+
(defproplist zone-has-service :posix (zone service)
(:desc #?"firewalld zone ${zone} has service ${service}")
(with-unapply