Use stronmgswan starter on freebsd and CentOS

This commit is contained in:
Tube 2023-10-27 14:06:01 +02:00
parent ecaceffca7
commit 07aec23f94
1 changed files with 37 additions and 13 deletions

View File

@ -5,12 +5,30 @@
bundle agent strongswan bundle agent strongswan
{ {
vars: vars:
"ipsec_conf" string => "/etc/ipsec.conf"; freebsd::
"ipsec_secrets" string => "/etc/ipsec.secrets"; "pkgs" slist => {
"service_name" string => "ipsec"; "strongswan"
"pkgs" slist => { };
"strongswan" "ipsec_conf" string => "/usr/local/etc/ipsec.conf";
}; "ipsec_secrets" string => "/usr/local/etc/ipsec.secrets";
"service_name" string => "strongswan";
debian::
"pkgs" slist => {
"strongswan"
};
"ipsec_conf" string => "/etc/ipsec.conf";
"ipsec_secrets" string => "/etc/ipsec.secrets";
"service_name" string => "ipsec";
centos::
"pkgs" slist => {
"strongswan"
};
"ipsec_conf" string => "/etc/strongswan/ipsec.conf";
"ipsec_secrets" string => "/etc/strongswan/ipsec.secrets";
"service_name" string => "strongswan-starter";
} }
@ -18,15 +36,15 @@ vars:
bundle agent install_strongswan(cfg) bundle agent install_strongswan(cfg)
{ {
vars: vars:
"js" string => storejson(@(cfg)); "service_deps" slist => { "strongswan_ipsec_conf_ready", "strongswan_ipsec_secrets_ready" };
freebsd::
"service_deps" slist => { "strongswan_ipsec_conf_ready", "strongswan_ipsec_secrets_ready","strongswan_bsdcfg_ready" };
methods: methods:
"any" usebundle => wmde_install_packages(@(strongswan.pkgs),"strongswan"); "any" usebundle => wmde_install_packages(@(strongswan.pkgs),"strongswan");
"any" usebundle => wmde_service("$(strongswan.service_name)","strongswan_kept","strongswan_repaired"), "any" usebundle => wmde_service("$(strongswan.service_name)","strongswan_kept","strongswan_repaired"),
depends_on => { depends_on => @(service_deps);
"strongswan_ipsec_conf_ready",
"strongswan_ipsec_secrets_ready"
};
files: files:
"$(strongswan.ipsec_conf)" "$(strongswan.ipsec_conf)"
create => "true", create => "true",
@ -46,8 +64,14 @@ files:
classes => if_repaired("strongswan_repaired"), classes => if_repaired("strongswan_repaired"),
edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/strongswan-ipsec.secrets.mustache"; edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/strongswan-ipsec.secrets.mustache";
freebsd::
"/etc/rc.conf.d/strongswan"
create => "true",
content =>"strongswan_interface=stroke
strongswan_enable=\"YES\"
",
handle => "strongswan_bsdcfg_ready";
reports: reports:
} }