"David Flood" <[EMAIL PROTECTED]> writes: > My first question is how many files like tmdarc are there > i.e. tmdarc is the system wide equivalent of ~/.tmda/config
The only two configuration files that TMDA knows about are /etc/tmdarc and ~/.tmda/config. Every other file name/path is configurable in either /etc/tmdarc or ~/.tmda/config. It doesn't matter in which file you put the configuration, as long as you remember that /etc/tmdarc applies to everyone, so putting a specific user's path in there won't work very well. > is there any equivalent to ~/.tmda/lists/incoming and outgoing? FILTER_INCOMING and FILTER_OUTGOING are the configuration variables for these files. The default paths of ~/.tmda/filters/incoming and ~/.tmda/filters/outgoing are just that -- defaults. If you want system-wide filters, say in /etc/tmda/filters, put the following lines in /etc/tmdarc. FILTER_INCOMING = "/etc/tmda/filters/incoming" FILTER_OUTGOING = "/etc/tmda/filters/outgoing" Now every user uses the two filters listed above and no others. If you want users to be able to customize their filters, use the 'include' statement in the global filters to include, optionally, a user's custom filter. For example, in /etc/tmda/filters/incoming you might have something like this: from-file -autodbm /etc/tmda/lists/global_blacklist drop from-file -autodbm /etc/tmda/lists/global_whitelist accept # allow users to add their own rules here. include -optional ~/.tmda/filters/incoming So the ~/.tmda/filters/incoming file doesn't have to exist for any user, but if it does, it will be read and inserted into the main filter in place of the 'include' line. If you don't want users to include filters but do want them to be able to customize their own whitelists and black lists, you could do something like this: # allow users to add their own blacklisted addresses here. from-file -autodbm -optional ~/.tmda/lists/blacklist drop # allow users to add their own whitelisted addresses here. from-file -autodbm -optional ~/.tmda/lists/whitelist accept from-file -autodbm /etc/tmda/lists/global_blacklist drop from-file -autodbm /etc/tmda/lists/global_whitelist accept Again, everything but /etc/tmdarc and ~/.tmda/config are configurable and ~/.tmda/config doesn't have to exist. > If so are they documented anywhere? The reason I ask this is the > more rules I can get into files that I control the less chance there > is of users breaking their own setup by meddling with their setup > files. There's really no documentation other than for each of the variables that you can set in the configuration files: http://tmda.net/config-vars.html > The second question is can I and if so how do I use the username parameter from > within tmdarc? I've tried it with the following files containing: > > ~support/mail/.tmda/config: > username = "support" This line creates a Python variable called 'username'. TMDA knows nothing about this variable. It is not the same thing as USERNAME, which TMDA does understand. The configuration files are actually Python code and Python is case-sensitive. Additionally, USERNAME is rarely used. Specifically, it is used for outgoing mail if the message has no From: header field. This is extremely unusual; nearly all client software includes a From: field. It is also used for TMDA's SQL support, in order to provide a consistent base address for each run of TMDA. If you're not using the SQL support, you can ignore this use. > /etc/tmdarc: > CONFIRM_APPEND = os.path.expanduser("/export/spare/${username}/mail/.tmda/list > s/whitelist") The os.path.expanduser() function is a Python function to convert a pathname beginning with '~' to the actual home directory of the user running the program. If the path doesn't begin with '~', there is no need to call os.path.expanduser(). Given the variable that you've defined, you could write the above line in Python like this: CONFIRM_APPEND = os.path.join("/export/spare", username, "mail/.tmda/lists/whitelist") If you really want to have set USERNAME, you can substitute that for username. It will work the same. > I've also tried > > CONFIRM_APPEND = > os.path.expanduser('/export/spare/${username}/mail/.tmda/lists/whitelist') Python has rules about how to continue lines of source code. If you have a left parenthesis on one line (like my example just above), you can continue naturally onto the next line(s) until the matching right parenthesis. Your second try breaks the line after the '=', so you would need a '\' at the end of the first line in order to continue the logical source line to the next physical line. This is an exact copy of your example with the backslash added -- remember, though, that os.path.expanduser() is doing nothing here. CONFIRM_APPEND = \ os.path.expanduser('/export/spare/${username}/mail/.tmda/lists/whitelist') > and > > CONFIRM_APPEND = > os.path.expanduser("/export/spare/"+${username}+"/mail/.tmda/lists/whitelist") Same problems as the previous two. You need the backslash to continue the line, os.path.expanduser() isn't doing anything and, since you're actually writing Python code, there is no need to use shell syntax (${username}) to specify a variable; in fact, it's not legal Python code. The '+' *does* work for string concatenation, however, so a working version of this example would look like this. CONFIRM_APPEND = "/export/spare/" + username + "/mail/.tmda/lists/whitelist" (I added whitespace around the '+'. Not necessary, but more readable). Hopefully the above makes sense. :) Feel free to ask for clarification if you need it. Tim _____________________________________________ tmda-users mailing list ([EMAIL PROTECTED]) http://tmda.net/lists/listinfo/tmda-users
