summaryrefslogtreecommitdiffabout
path: root/etc/wydawca.rc
blob: 0cca6442eedf47dd5272a4caa60b036441a65ad8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
/* A sample configuration file for Wydawca
   Copyright (C) 2007, 2009-2011, 2017 Sergey Poznyakoff

   Wydawca is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the Free
   Software Foundation; either version 3 of the License, or (at your option)
   any later version.

   Wydawca is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with wydawca. If not, see <http://www.gnu.org/licenses/>. */

/* Configure logging via syslog.
 * For more info, run `info wydawca syslog'.
 */	
syslog {
  facility local1;
  tag wydawca;
  print-priority yes;
}

/* Enable statistics output at the end of the run.
 * For more info, run `info wydawca statistics'.
 */
statistics all;

/* Remove any stray files that are more than an hour old. */
file-sweep-time "1 hour";

/* Set default umask. */
umask 022;

/* Set the name of the tar binary. This is optional.
 * See `info wydawca archivation', for more info.
 */	 
tar-program "/bin/tar";

/* Configure SQL databases.
   See `info wydawca sql'.
 */
sql default {
  host "localhost:/tmp/mysql.sock";
  database "savane";
  user "savane";
  password "guessme";
}

/* Configure dictionaries. 
 * Run `info wydawca dictionaries', for the detailed description of these.
 * The provided ones use Savane database structure.
 */

dictionary project-owner {
  type sql;
  params (default);
  query   "SELECT user.email, user.realname "
	  "FROM user,user_group,groups "
	  "WHERE user_group.user_id=user.user_id "
	  "AND user_group.group_id=groups.group_id "
	  "AND user_group.admin_flags = 'A' "
	  "AND groups.unix_group_name='${project}'";
}


/* Only project admins are allowed to make uploads. */	
dictionary project-uploader {
  type sql;
  query "SELECT user.user_name,user.realname,user.email,user.gpg_key "
        "FROM user,user_group,groups "
        "WHERE user_group.user_id=user.user_id "
        "AND user_group.group_id=groups.group_id "
        "AND user_group.admin_flags = 'A' "
        "AND groups.unix_group_name='${project}' "
        "AND user.gpg_key is not NULL";
  params (default);
}
	
/* Configure email notifications
 * See `info wydawca notification', for a description.
 */

admin-address "root@localhost";
from-address "wydawca@localhost";

# See `info wydawca statreports'.
mail-statistics {
  statistics all;
  message <<EOT
Subject: Wydawca stats

This is to notify you that the run of wydawca on ${date}
caused the following results:

errors ............................. ${stat:errors}               
warning ............................ ${stat:warnings}             
bad signatures ..................... ${stat:bad_signatures}       
access violation attempts .......... ${stat:access_violations}    
complete triplets .................. ${stat:complete_triplets}    
incomplete triplets ................ ${stat:incomplete_triplets}  
bad triplets ....................... ${stat:bad_triplets}         
expired triplets ................... ${stat:expired_triplets}     
triplet successes .................. ${stat:triplet_success}      
files uploaded ..................... ${stat:uploads}              
files archived ..................... ${stat:archives}             
symlinks created ................... ${stat:symlinks}             
symlinks removed ................... ${stat:rmsymlinks}           

Regards,
Wydawca
EOT;
}

# See `info wydawca event'.

# Notify the user about successful uploads
notify-event {
  event success;
  message <<EOT
To: ${email:user}
Subject: Upload of ${project} successful

Upload of ${project} to ${dir} finished successfully. Files uploaded:

${triplet:upload}$-

Regards,
Wydawca
The Project Submission Robot
EOT;
}

# Notify project admin about a successful upload.
notify-event {
  event success;
  message <<EOT
To: ${email:owner}
Subject: Upload of ${project} successful

${user:real-name} (${user:email}) successfully uploaded files
for ${project} to ${dir}. Files uploaded:

${triplet:upload}$-

Regards,
Wydawca
The Project Submission Robot
EOT;
}

/* Notify project admin, if someone non authorized attempted to upload some
 * files for the project they run.
 */
notify-event {
  event bad-ownership;
  message <<EOT
To: ${email:owner}
Subject: Suspicious upload of ${project}

Someone not authorized to make releases for ${project}
has attempted to upload the following files to ${dir}:

${triplet:full}$-

This upload has been ignored and the files removed. The person who attempted
the upload was ${user:real-name}, user name ${user:name}, email ${user:email}.
If you think this is an error and wish this user to be authorized to make
releases for ${project}, please contact <puszcza-hackers@gnu.org.ua>.
Otherwise, let us know so we could undertake appropriate measures.

Regards,
Wydawca
The Project Submission Robot
EOT;
}

/* Notify the project admin, if submitted directive signature did not match
 * any of the submitter records.
 */
notify-event {
  event bad-directive-signature;
  message <<EOT
To: ${email:owner}
Subject: Suspicious upload of ${project}

${user:real-name} (${user:email}) has tried to make a release
for ${project}. However, the signature of the directive file was wrong,
which looks suspicious. The person uploaded the following files:

${triplet:full}$-

This upload has been ignored and the files removed.

Regards,
Wydawca
The Project Submission Robot
EOT;
}

/* Notify the user (submitter), if the detached signature did not match
 * his record.
 * It may be a good idea not to notify users about such events, just to
 * stay on a safe side. Notifying project admins (see below) should be quite
 * enough.
 */
notify-event {
  event bad-detached-signature;
  message <<EOT
To: ${email:user}
Subject: Suspicious upload of ${project}

Someone (apparently you), has tried to make a release for ${project}.
However, the detached signature signature was wrong, which looks
suspicious. The person uploaded the following files:

${triplet:full}$-

This upload has been ignored and the files removed. If it was you who
attempted this upload, please make sure you use the right PGP key and
try again. If not, please let us know as soon as possible, so we can
track down the person trying to make believe he is you.

Regards,
Wydawca
The Project Submission Robot
EOT;
}

/* Notify the project admin, if submitted detached signature did not match
 * submitter record.
 */
notify-event {
  event bad-detached-signature;
  message <<EOT
To: ${email:owner}
Subject: Suspicious upload of ${project}

${user:real-name} (${user:email}) has tried to make a release
for ${project}. However, the detached signature file was wrong,
which looks suspicious. The person uploaded the following files:

${triplet:full}$-

This upload has been ignored and the files removed.

Regards,
Wydawca
The Project Submission Robot
EOT;
}

/* Notify both the submitter and the project owner about uploads
 * that did not pass distribution verification (see check-script below).
 * The X-Wydawca-Uploader header supplies additional information for the
 * project owner about the user who did the upload.
 */
notify-event {
  event check-failure;
  message <<EOT
To: ${email:user}
Cc: ${email:owner}
Subject: ${triplet:dist} rejected
X-Wydawca-Uploader: "${user:real-name}" (${user:name}) <${user:email}>

Your upload of ${triplet:dist} has been rejected by the distribution
verification procedure with the following diagnostics:

${check:diagn}$-

Please fix the tarball and resubmit.

Regards,
Wydawca
The Project Submission Robot
EOT;
}

/* Make sure the distributed tarball does not contain security vulnerabilities
 * CVE-2012-3386 and CVE-2009-4029. Reject it, if it does.
 * See `info wydawca verification', for a description of check-script.
 *
 * Note: this script relies on GNU tar and grep.
 */
check-script <<EOT
case ${WYDAWCA_DIST_FILE} in
*.tar|*.tar.*)
  if tar -xOf ${WYDAWCA_DIST_FILE} --occurrence=1 \
       --wildcards --no-wildcards-match-slash '*/Makefile.in' | \
     grep -q 'chmod a+w'; then
    fmt <<_EOF_
Some of the Makefile.in's in ${WYDAWCA_DIST_FILE} contain a locally
exploitable race condition (see CVE-2012-3386[1], for more details).

Please, rebuild your package using Automake v. 1.11.6 / 1.12.2
or newer and resubmit.
_EOF_
    cat <<_EOF_
--
[1] https://security-tracker.debian.org/tracker/CVE-2012-3386
_EOF_
    exit 1
  fi
  if tar -xOf ${WYDAWCA_DIST_FILE} --occurrence=1 \
      --wildcards --no-wildcards-match-slash '*/Makefile.in' | \
      grep -q 'perm -777'; then
    fmt <<_EOF_
The top-level Makefile.in in ${WYDAWCA_DIST_FILE} changes mode of
all the directories below the build tree to 777 before creating the tarball.
This constitutes a security hole (see CVE-2009-4029[1], for more details).

Please, rebuild the package using a newer Automake (at least v. 1.11.1)
and resubmit.
_EOF_
    cat <<_EOF_
--
[1] http://article.gmane.org/gmane.comp.sysutils.autotools.announce/131
_EOF_
    exit 1
  fi
  ;;
*)
  ;;
esac
exit 0
EOT;

/* Configure distribution spools.
 * A spool defines where to look for input triplets, and where to
 * copy uploaded files.
 *
 * See `info wydawca spool', for a detailed explanation.
 */

spool download {
  url ftp://your.domain.net; 
  source "/home/ftp/incoming/ftp";
  destination "/home/ftp/gnu";
  archive directory {
    name "/var/spool/archive";
    backup numbered;
  }
}

# End of configuration file

Return to:

Send suggestions and report system problems to the System administrator.