sieve and multiple ACTIVE scripts - email

Is there a reason the email filter sieve can only activate one single script?
> list
"mailinglists.sieve"
"spam.sieve" ACTIVE
> activate mailinglists.sieve
> list
"mailinglists.sieve" ACTIVE
"spam.sieve"
>
I can't see the logic here ... I am doing something wrong?

Most email sieve servers want one "main" sieve script to run. Since the order of running sieve commands matters, you'd need to have some method to specify what order the files should execute in.
So, the standard way to handle this is with the "include" extension, defined in RFC 6609. You can have one main sieve script, and include your other sieve scripts as needed. The server administrator can also define "global" scripts that can be included by any user, such as with Dovecot Pigeonhole's sieve_global_dir configuration line.
Example usage from the RFC:
require ["include"];
include :personal "always_allow";
include :global "spam_tests";
include :personal "spam_tests";
include :personal "mailing_lists";

To add a bit to the answer, if you're looking to configure multiple sequential sieve scripts for Dovecot then you may use sieve_beforeX= and sieve_afterX= parameters as described here: https://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration#Executing_Multiple_Scripts_Sequentially
For example:
sieve_before = /usr/local/lib/dovecot/sieve/spam.sieve
sieve_before2 = /usr/local/lib/dovecot/sieve/ham.sieve
sieve_before3 = /usr/local/lib/dovecot/sieve/check.sieve
sieve_after = /usr/local/lib/dovecot/sieve/move.sieve
sieve_after2 = /usr/local/lib/dovecot/sieve/flag.sieve

Related

How to add user/ADGroup to a policy in GPO using Powershell script

I had search around the internet and only found how to use Carbon module to edit Local Policy. But I need to edit Group Policy actually
Picture Want to do the same thing as the picture but using script (GPO)
GPO name and ID
Unfortunately, the short answer is still you can't.
Group policy objects are kind of a mess with:
The policy objects: \\domain.com\sysvol\policies\{GPO-GUID}\
Each require PolicyDefinition files, which can be custom-created: \\domain.com\sysvol\policies\PolicyDefinitions\*.admx
Which in turn each require a matching localized language definition: \\domain.com\sysvol\policies\PolicyDefinitions\en-US\*.adml
Either use the group policy management mmc tool, or find the registry keys that correspond to the gpo settings you want, and change them via powershell.

Azure DevOps - Can we reuse the value of a key in the same variable group?

I have lots of URL values and their keys. But there is no way to batch import the variables and the "value" controls are also not text boxes in the Variables Group page to perform chrome browser extensions assisted find and replace.
If this is possible, what is the syntax to refer to the key?
As in, I have a variable App.URL : www.contoso.com.
I am using the key to substitute value in my next variable like this Login.URL : $(App.URL)\Login and this doesn't work.
GitHub link : https://github.com/MicrosoftDocs/vsts-docs/issues/3902#issuecomment-489694654
This isn't currently available, not sure if it will be. Can you create a task early in your pipeline that sets the variables you need in subsequent tasks/steps? This gives you more control as you can store the script along with your source. You could then use a pipeline variable for the environment you're in and let your script use that to set values appropriately.
See Set variables in scripts in the MS docs.
If it's not possible to re-architect your app to concatenate the url strings in the application, what the previous commenter said about creating a simple script to do that for you would be the way to go. Ie:
#!/bin/bash
#full login url
fullLoginUrl=$APP.URL\$LOGINSUFFIX
echo "##vso[task.setvariable variable=Login.URL]$fullLoginUrl
Otherwise, perhaps playing around with the run time vs compile time variables in YAML pipelines might be worth trying.
https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#understand-variable-syntax

Using global variables in a ps1

I can't seem to find good enough solution to my problem. Is there a good way of grouping variables in some kind of file so that multiple scripts could access them?
I've been doing some work with Desired State Configuration but the work that needs to be done cannot be efficiently implemented that way. The point is to install Azure Build Agent on a server and then to configure it. There are some variables that really should not be inside a script file just copypasted like Personal Access Token. I just want to be able to easily change it without the need to go inside every script that would be using it. In DSC you can just make a .psd1 file and access the variables like for example AllNodes.NodeName. The config file invocation and parameters look like this:
.\config.cmd --unattended --url $myUrl --auth PAT --token $myToken --pool default --agent "$env:COMPUTERNAME" --acceptTeeEula --work $workDir'
I want to make the variable $myToken accessible from outside file for better security and having a centralized place from where I can change values. $myUrl is also important to have access to due to it changing with new update to Build Agent.
Thank you in advance for your effort. If anything is not clear please let me know.
I have two very different answers to your question, although either one of them may miss your point.
First, it's possible to define veriables inside your profile script. Most people only use the profile script to define a library of functions or classes. But a variable can be made global the same way.
I have a variable named $myps that identifies the folder where I keep my PS scripts (in subfolders).
When I start a session I generally switch to this directory (oops, I called it a folder above.
The second way involde storing values of variables in a CSV file, while the names are stored in the CSV header.i then have a quickie little comandlet that steps through a CSV file, record by record, generating different expansions of a template each time through.
These values are not quite global, but they can be used in more than one context.
Thank you for the help. Those are very useful solutions in some cases, but I dug a bit deeper and found solution that suits my purpose. Basically if you have a psd1 file suited for DSC use you can also access its content via normal ps1 file. For example:
NonNodeData =
#{
Pat = 'somePAT'
}
Let's say this section of a psd1 file called ENV.psd1 is on your local machine in C:/Configuration
To access the content of this file you have to make a variable inside your script and use Import-PowerShellDataFile like so:
$configData = Import-PowerShellDataFile -Path "C:\Configuration\ENV.psd1"
And now you are free to use anything stored inside ENV.psd1. For example if I want to extract my PAT from config file to be able to store it in a variable in the script:
$myPat = $configData.NonNodeData.Pat
Thanks to that I can just pass $myPat as a parameter when invoking config.cmd like so:
.\config.cmd --unattended --auth PAT --token $myPat
Keeping my code cleaner and easier for any future updates.

Export AD structure from specific OU, then re-create structure in new domain

I've researched and found the way to export our active directory information for our application is like this:
csvde -d OU=MyAppsOU,DC=dot,DC=testdmz,DC=lan
-f C:\temp\addump_ou.csv -r (objectClass=organizationalUnit)
Now, I've read that to do an import from that file, you just have to add the -i option to the line like this:
csvde -i -d OU=MyAppsOU-New,DC=dot,DC=newdmz,DC=lan
-f C:\temp\addump_ou.csv -r (objectClass=organizationalUnit)
Obviously, I'm very scared to try this as I don't want to blow away anything. My questions are:
Does specifying the OU=MyAppsOU-New create the new OU structure with that specific name? (I'm just trying to be 100% positive)
Does specifying the different domain name (newdmz) just update all of the data in the file to contain the new domains name?
or
Do I need to modify the exported csv file to change the domain name (testdmz) to what the new domain name will be (newdmz)?
Is there a different way I should be doing this?
I just want to re-create the OU structure without groups, roles (which are groups) and users. I will probably do those in a different process because we have different usernames for test and production.
Wow ! lost of question here, but according to me not enougth.
Begining by the end. CSVE.EXE is really not the exact tool I would use. As a Directorie developper I prefer LDIFDE.EXE, because it generates LDIF (LDAP data Interchange Format) which is more standard and more readable. You can also have a look to tools like ADAMSync.EXE that allow to synchronize two directories in AD world (but it's a big hammer for whant you want to do here)
Now choosing LDIFDE.EXE you will see that LDIF format is almost importable as is, but you nned to remove operational attributes (system attributes) from the file. The best way is to take them during the rxport. So you will use -L to only export the attributes you need or -O option to omit operational attributes.
To import in another domain, you will use -C option to change original domain part (DC=dot,DC=testdmz,DC=lan) by the new domain part.
Try it before in a virtual machine.

How to make some NAnt tasks quiet?

I am using MailLogger to send a message about a failed/successful release. I would like to make the mail body simple and easy to read. How can I suppress output for some particular tasks?
Another option would be to use the xmllogger instead of the maillogger, to output an xml file which can then be processed using a xslt stylesheet. Use the stylesheet to filter out information you don't need. If you want it to be mailed to your inbox you could use the mail task from nant and include the transformed file as an attachment or if you transformed it to txt/html you could also use it to fill the body.
Would it be too simple if you'd call nant with the -quiet switch?
EDIT: and for the tasks whose output you are interested in you can set the verbose attribute to true.