Re: Secure_cp with regex

thierry thunot <[email protected]>
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
Hello, Thanks for this solution, I was just missing the file_select .... 
sorry for the trivial question ... 

on the other hand, is it possible to copy binary or zip files via native 
cfengine commands on an artifactory. Let me explain we have an artifactory 
which provides binaries. I want my cf-agent cfengine to be able to download 
a binary as soon as it is modified on the artifactory and check its 
consistency and integrity.
thanks again for your help
Le mercredi 23 juin 2021 à 21:19:16 UTC+2, [email protected] a 
écrit :

> Can you reply with at least one example?
>
> I would expect you have something like a files promise with a copy_from 
> body
>
>
> https://docs.cfengine.com/docs/3.15/reference-promise-types-files.html#copy_from
>
> paired with a file_select body to choose your files
>
>
> https://docs.cfengine.com/docs/3.15/reference-promise-types-files.html#file_select
>
> And we have a by_name body in masterfiles in lib/packages.cf
>
> Setting up I do this:
>
> ```
> # touch /var/cfengine/data/client_1_md5_5454eez4r6e4rez46r4ez6.txt
> # touch /var/cfengine/data/client_2_md5_0316046ezaea4654re654.txt
> # touch /var/cfengine/data/client_3_md5_5454eez4r6e4rez46r4ez6.txt
> ```
>
> So I would expect you might try policy like the following. I put it in my 
> services/main.cf just to test.
>
> ```
> bundle agent main
> {
>  files:
>     "/tmp/client_stuff/."
>       create => "true";
>     "/tmp/client_stuff"
>       copy_from => secure_cp("$(sys.workdir)/data", "$(sys.policy_hub)"),
>       depth_search => recurse(inf),
>       file_select => by_name("client_.*_md5_5454eez4r6e4rez46r4ez6.txt");
> }
> ```
>
> Maybe you don't want to serve the files from $(sys.workdir)/data? That is 
> accessible by default in controls/cf_serverd.cf.
>
> ```
>            "$(def.dir_data)/"
>            handle => "server_access_grant_access_data",
>            shortcut => "data",
>            comment => "Grant access to data directory",
>            if => isdir( "$(def.dir_data)/" ),
>            admit => { @(def.acl) };
> ```
>
> So if you wanted to share /tmp/data you would have to add something like
>
> ```
> "/tmp/data"
>   if => isdir("/tmp/data/"),
>   admit => { @(def.acl) };
> ```
>
> Let us know if that helps and what other questions you have.
>
> Cheers,
> Craig Comstock
> CFEngineer/Digger
>
> On Wednesday, June 23, 2021 at 10:35:15 AM UTC-5 [email protected] wrote:
>
>> I am looking for a solution to copy a file in secure_cp, by selecting 
>> files on the cfengine server with a regex....
>>
>> For example:
>> on cfengine sever i have files 
>> client_1_md5_5454eez4r6e4rez46r4ez6.txt
>> client_2_md5_0316046ezaea4654re654.txt
>> client_3_md5_5454eez4r6e4rez46r4ez6.txt
>> ...
>>
>> I want to copy on my client all files corresponding to this regex :
>> client_(.*)_md5_5454eez4r6e4rez46r4ez6.txt
>>
>> I tried multiple solutions without success... :(
>>
>> Is there any solution to do this rules?
>> Thanks for your help
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/4027e2b9-cec1-4155-b8a1-11dd2965669bn%40googlegroups.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.