chiark / gitweb /
Remove more urcm-isms
[modbot-ulm.git] / stump / etc / modenv.INO
1 #!/bin/bash
2 ###
3 #
4 # MAIN CONFIGURATION FILE
5 #
6 # ### Administrators of STUMP robomoderator systems:
7 #
8 # set environment variables according to config of your site. 
9 # this script is normally invoked from procmail, as a wrapper
10 # to real moderation scripts. Follow the instructions.
11 #
12
13 #######################################################################
14 # this is the root directory where moderation software & config
15 # resides. Make sure that sendmail is in the PATH.
16 # (most likely it is in /usr/lib/sendmail).
17 #
18
19 MNG_ROOT=%BASEDIR%/stump
20 exec >>%BASEDIR%/errs 2>&1
21
22 printf "============ %s" "$*"
23 date
24
25 export MNG_ROOT BASEDIR
26
27 # Add bin and local/bin to PATH
28 PATH=$MNG_ROOT/bin:$MNG_ROOT/local/bin:$MNG_ROOT/etc:$PATH:/usr/sbin
29 PATH=$PATH:/usr/local/bin:/bin:/usr/bin:/usr/sbin:$HOME/bin
30 export PATH
31
32 #######################################################################
33 # Name of moderated group. Put the name of your group in here.
34 #
35
36 NEWSGROUP="%GROUP%"; export NEWSGROUP
37
38 #######################################################################
39 # Email handling and mangling
40
41 MAILOUT_RECVACK_FORMAIL_ARGS='
42         -I Bcc:%OURUSER%+%ABBREV%-internal-log+mailout@%DOMAIN%
43 '
44 MAILOUT_ACCEPTACK_FORMAIL_ARGS='
45         -I Bcc:%OURUSER%+mtm-internal-log+mailout@%DOMAIN%
46 '
47 MAILOUT_REJECT_FORMAIL_ARGS='
48         -I Bcc:%OURUSER%+%ABBREV%-internal-log+mailout@%DOMAIN%
49         -I Bcc:%OURUSER%+%ABBREV%-internal-reject-copy@%DOMAIN%
50 '
51
52 sanitise_and_quote_email () {
53         perl -pe '
54                 s/ %OURUSER% \+ [-+/0-9a-z]* \@
55                    (\Q %DOMAIN% | %SLIMYDOMAIN \E) \b
56                  /%OURUSER%+?\@$1/igx
57                         unless m/^$/..0;
58                 s/^/> /;
59                 ' "$@"
60 }
61
62 #######################################################################
63 # STUMP enforces limitations on the maximum number of newsgroups
64 # used in Newsgroups: header line. The default value is 5. I
65 # You can change this value. If you do not want to enforce limitations 
66 # on crossposting, set MAX_CROSSPOSTS to 1000.
67
68 MAX_CROSSPOSTS=1
69 export MAX_CROSSPOSTS
70
71
72 ######################################################################
73 # Do you really want to use PGP? PGP (Pretty Good Privacy) is a 
74 # program that allows you (among other things) digitally sign messages
75 # and check digital signatures.
76 #
77 # It can make certain transactions more non-repudiable and secure.
78 # however, for most newsgroups the benefits of security are not as
79 # important and many users prefer not to use PGP. 
80 #
81 # Those users may set PGP to "none" (lowercase). 
82 #
83 # This ENTIRELY DISABLES use of PGP. That also disables PGPMoose, a 
84 # program that relies on PGP to digitally sign all approvals. 
85 # PGP Moose can help you combat forged approvals.
86 #
87 # My suggestion is, if you are not comfortable with PGP and have other
88 # things on your plate, set PGP to "none" and set it up later when
89 # time permits. Get other stuff working first.
90 #
91 # Alternatively, you could set PGP to the path to the actual PGP executable,
92 # as in:
93 #
94 # PGP=/usr/local/bin/pgp262
95 #
96 # Note that STUMP _requires_ pgp v. 2.6.2.
97 #
98
99 PGP="gpg"
100 export PGP
101
102 ######################################################################
103 # for pmapp - digital signing
104
105 ######################################################################
106 # PGP key names.
107 # PMUSER must be exactly as the PGP key named in the keyring
108 # Refer to the online documentation on how to create PGP keys.
109 #
110 # *IF* you do not plan to use PGP at all, define it like this:
111 # PMUSER_APPROVAL="SCRM Moderators <scrm-board@algebra.com>"
112 # and make sure that PMAPP is defined as "cat".
113 #
114 # this MUST be dfined EVEN if PGP is set to "none".
115 # This goes into your Approved: field.
116 PMUSER_APPROVAL="%GROUP% approval key <%MODEMAIL%>"
117 export PMUSER_APPROVAL
118
119 ######################################################################
120 # type in the passphrase for PGP Moose (passphrase for the Approval Key
121 # named right above that you generated)
122 # ONLY if pgp moose is used
123 #
124 # (in turn, PGP Moose is used only if PGP is NOT set to "none")
125 #
126 PMPASSWORD=""
127 export PMPASSWORD
128
129 ######################################################################
130 #
131 # PMAPP is the name of the PGP Moose signing program. If you do not
132 # want to use it, define PMAPP as "cat", like this: 
133 # PMAPP="cat"; export PMAPP
134 #
135 # otherwise, use "pmapp":
136 # PMAPP="pmapp"; export PMAPP
137 #
138 # NOTE!!! PMApp is disabled if PGP is set to "none"!
139 #
140
141 PMAPP="pmapp"; export PMAPP
142
143 ######################################################################
144 #
145 # DECISION_ADDRESS is the address for approved AND rejected submissions
146 # Used by ModScape subsystem only.
147 #
148 #DECISION_ADDRESS=scrm-approved@algebra.com
149 #export DECISION_ADDRESS
150
151 ######################################################################
152 # put a munged address for your group here. It should best resolve to
153 # a devnulled address, since a lot of rejections/acks will bounce
154 # and there is no need for a human being to see the bounces.
155 #
156 MUNGED_ADDRESS=%OURUSER%+%ABBREV%-bounces@%DOMAIN%
157 export MUNGED_ADDRESS
158
159
160 ######################################################################
161 # Where to submit ready and signed articles
162 # You do not need this if you set RNEWS (below) to sendmail, as
163 # instructed.
164 #IHAVE_SERVER=news.uu.net; export IHAVE_SERVER
165
166 ######################################################################
167 # Path: suffix for news
168 # Put something similar here, it is not a very important value.
169 #
170 PATH_SUFFIX="%GROUP%-moderators!robomod!not-for-mail"; export PATH_SUFFIX
171
172 ######################################################################
173 # Do we want to work in paranoid PGP mode? YES or NO
174 #
175 # NOTE: it means more work for the maintainer
176 #
177 # I suggest STRONGLY that you should set it to NO!!!!!!!!!!
178 #
179 # This is disabled If PGP is set to "none".
180 #
181 STUMP_PARANOID_PGP=NO
182 export STUMP_PARANOID_PGP
183
184 ######################################################################
185 # reachable email address of a real person who is responsible
186 # for maintaining the robomoderator.
187 #
188 ADMIN=%ADMIN%; export ADMIN
189
190 ######################################################################
191 # Address of the moderator's board (little private mailing list
192 # for moderators only) where posters can send their complaints about the
193 # moderation policy.
194 #
195 BOARD=%MODEMAIL%; export BOARD
196
197 ######################################################################
198 # address for the no-ack requests.
199 NOACK=%OURUSER%+%ABBREV%-noack@chiark.greenend.org.uk
200 export NOACK
201
202 ######################################################################
203 # Official address for submissions to the newsgroup.
204 #
205 SUBMIT=%OURUSER%+%ABBREV%+%KEYSUBMIT%@chiark.greenend.org.uk; export SUBMIT
206
207 ###################################################################### Flags
208 #
209 # ATTENTION!!! Flags must be YES or NO, in capital letters.
210 #
211
212 ######################################################################
213 # set this flag to YES if you want to REQUIRE all preapproved
214 # posters to use PGP to sign their messages. Typically you
215 # do not want to do it, unless your group has
216 # been SEVERELY invaded by malicious forgers.
217 #
218 # disabled if PGP is set to "none"
219 #
220 WHITELIST_MUST_SIGN=NO; export WHITELIST_MUST_SIGN
221
222 ########################################################## where is your rnews
223 # find out where is rnews program in your system - there may be
224 # several ones called `rnews'. Yours must be setuid or setgid, 
225 # typically.
226 #
227 # Below are several variants of defining RNEWS. The simplest one involves
228 # use of my mail2news gateway for STUMP users.
229 #
230 # Use this one if you want to use my gateway -- SIMPLEST way to do it.
231 # RNEWS="sendmail -f devnull@stump.algebra.com news-gateway@stump.algebra.com"
232 #
233 # Note that the -f flag is used to prevent any antispamming system from
234 # rejecting email to the news gateway.
235 #
236 # Use this only if you want to use your own rnews -- a pain in the
237 # neck if you do not know well how news servers work.
238 # RNEWS="/usr/lib/news/rnews -h $IHAVE_SERVER -S $IHAVE_SERVER "
239 #
240 # OR may be something like this if you have inews only:
241 # [you may have problems with "hostname" on bsd-derived systems]
242 #RNEWS="/usr/lib/news/inews -h "; export RNEWS
243 RNEWS="%BASEDIR%/inews"
244
245 #RNEWS="sendmail -f devnull@stump.algebra.com news-gateway@stump.algebra.com"
246 export RNEWS
247
248 # ATTENTION!!!
249 # MORE ABOUT RNEWS/INEWS: unfortunately, these programs differ on many
250 # systems. Some of the BSD-derived systems have "broken" inews and rnews
251 # that does not like another program "hostname".
252 #
253 # If you see error messages about "hostname" in ~/Mail/from, you should 
254 # either disregard them, or use the "hostname" shell script provided in 
255 # stump/etc. Do the following: 
256 #
257 # cd $HOME/stump/etc
258 # mv hostname.REPLACEMENT hostname
259 #
260 # Edit "hostname" and set your host name and fully qualified hostname.
261 #
262
263 ############################################################ Internal vars
264 #
265 # Do NOT change this section
266 #
267
268 if [ "$PGP" = "none" ] ; then
269   PMAPP=cat
270   export PMAPP
271 fi
272
273 #######################################################################
274 # Directory for temp files. This directory must NOT be writable by general
275 # public, for security reasons. I suggest keeping this intact.
276 #
277
278 TMP=$MNG_ROOT/tmp; export TMP
279
280 BEGIN_PGP_SIGNED_MESSAGE="-----BEGIN PGP SIGNED MESSAGE-----"
281 BOT_SUBJECT_PREFIX="KEGHF894ND50MJ"
282
283 export BEGIN_PGP_SIGNED_MESSAGE BOT_SUBJECT_PREFIX
284
285
286 ################################################################# Invocation
287 #
288 # DO NOT EDIT
289 #
290 # I use `antivirus' program as additional protection from all sorts
291 # of attempts to exploit bugs in moderation programs. Antivirus replaces
292 # all suspicious characters by '_' and splits too long lines.
293 #
294
295 if [ "x$1" != "x" ]; then
296   umask 077
297   antivirus | decodeBase64 | "$@"
298 fi