Lines 2-28
Link Here
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: $ |
3 |
# $Header: $ |
4 |
|
4 |
|
5 |
inherit toolchain-funcs eutils fixheadtails |
5 |
inherit toolchain-funcs eutils fixheadtails flag-o-matic |
6 |
|
6 |
|
7 |
IUSE="" |
7 |
IUSE="pcre" |
8 |
DESCRIPTION="simscan is a powerful qmail content scanner." |
8 |
DESCRIPTION="simscan is a powerful qmail content scanner." |
9 |
SRC_URI="http://www.inter7.com/simscan/${P}.tar.gz" |
9 |
SRC_URI="http://www.inter7.com/simscan/${P}.tar.gz" |
10 |
HOMEPAGE="http://www.inter7.com/?page=simscan" |
10 |
HOMEPAGE="http://www.inter7.com/?page=simscan" |
11 |
SLOT="0" |
11 |
SLOT="0" |
12 |
LICENSE="GPL-2" |
12 |
LICENSE="GPL-2" |
13 |
KEYWORDS="~x86" |
13 |
KEYWORDS="x86" |
14 |
|
14 |
|
15 |
DEPEND="mail-mta/qmail |
15 |
DEPEND="|| ( mail-mta/qmail-ldap mail-mta/qmail mail-mta/qmail-mysql) |
|
|
16 |
pcre? ( >=dev-libs/libpcre-5.0 ) |
16 |
net-mail/ripmime |
17 |
net-mail/ripmime |
17 |
app-antivirus/clamav |
18 |
app-antivirus/clamav |
18 |
mail-filter/spamassassin" |
19 |
mail-filter/spamassassin" |
19 |
|
20 |
|
|
|
21 |
RDEPEND="${DEPEND}" |
22 |
|
23 |
# Where will simscan unpack mail messages for scanning? |
24 |
simscan_workdir="/var/spool/simscan" |
25 |
|
26 |
# User simscan will run as. "simscan" is the default. |
27 |
simscan_user="simscan" |
28 |
|
29 |
|
30 |
append-flags "-Wl,-z,now" |
31 |
|
20 |
pkg_setup() { |
32 |
pkg_setup() { |
21 |
einfo "Creating user, group and directory..." |
33 |
einfo "Creating user and working directory..." |
22 |
enewgroup simscan |
34 |
enewuser ${simscan_user} -1 /bin/false ${simscan_workdir} clamav |
23 |
enewuser simscan /bin/false /var/spool/simscan simscan |
35 |
pwconv || die |
24 |
diropts -m 755 -o simscan -g simscan |
|
|
25 |
dodir /var/spool/simscan |
26 |
} |
36 |
} |
27 |
|
37 |
|
28 |
src_unpack() { |
38 |
src_unpack() { |
Lines 31-54
Link Here
|
31 |
} |
41 |
} |
32 |
|
42 |
|
33 |
src_compile() { |
43 |
src_compile() { |
34 |
econf --enable-user=simscan --enable-clamav=y \ |
44 |
|
35 |
--enable-clamdscan=`which clamdscan` --enable-per-domain=y \ |
45 |
local myconf |
36 |
--enable-attach=y --enable-spam=y --enable-spam-passthru=y \ |
46 |
|
37 |
--enable-spam-user=n --enable-dropmsg=n --enable-qmaildir=/var/qmail \ |
47 |
# "simscan" is the default user. If you want to change this, please user the |
38 |
--enable-workdir=/var/spool/simscan --enable-spamc=`which spamc` \ |
48 |
# variable above. |
39 |
--enable-received=y --enable-spamassassin-path=`which spamassassin` \ |
49 |
myconf="${myconf} --enable-user=${simscan_user}" |
40 |
--enable-clamavdb-path=`which clamscan` --enable-sigtool-path=`which sigtool` || die "Error: econf failed!" |
50 |
|
|
|
51 |
# Directory where simscan will scan messages. Please edit variable above |
52 |
# to change this value. |
53 |
myconf="${myconf} --enable-workdir=${simscan_workdir}" |
54 |
|
55 |
# If you want to keep SPAM/virus messages in a quarantine, uncomment this: |
56 |
# myconf="${myconf} --enable-quarantinedir=${simscan_workdir}/quarantine" |
57 |
|
58 |
# Scanning attachments is a good idea, eh? |
59 |
myconf="${myconf} --enable-attach=y" |
60 |
|
61 |
# If scanning for attachments, we need ripmime: |
62 |
myconf="${myconf} --enable-ripmime=`which ripmime`" |
63 |
|
64 |
# Allow different configuration rules for different domains. This ebuild |
65 |
# provides a reasonable default "catchall" rule, so leaving this enabled |
66 |
# won't really hurt anything. |
67 |
myconf="${myconf} --enable-per-domain=y" |
68 |
|
69 |
# clamav is enabled by default. Change to "n" and uncomment to disable |
70 |
# myconf="${myconf} --enable-clamav=y" |
71 |
|
72 |
# Tell simscan where the clamdscan binary is. This option does nothing if |
73 |
# clamav is not enabled. |
74 |
myconf="${myconf} --enable-clamdscan=`which clamdscan`" |
75 |
|
76 |
# spamassassin scanning is enabled. Uncomment the 'spamc-args' line |
77 |
# to pass custom arguments to spamc. |
78 |
myconf="${myconf} --enable-spam=y" |
79 |
myconf="${myconf} --enable-spamc=`which spamc`" |
80 |
# myconf="${myconf} --enable-spamc-args="" |
81 |
|
82 |
# By default, this installation will reject (drop) any message with |
83 |
# a spamassassin score > 10 |
84 |
myconf="${myconf} --enable-spam-hits=10" |
85 |
myconf="${myconf} --enable-dropmsg=y" |
86 |
|
87 |
# If you want SPAM/virus messages to go on to their intended user, |
88 |
# uncomment the following line and comment out "spam-hits" and "dropmsg" |
89 |
# above |
90 |
# myconf="${myconf} --enable-spam-passthru |
91 |
|
92 |
# If you want to set up super-funky per-user spam scanning options, read the |
93 |
# docs and change this to "y" |
94 |
myconf="${myconf} --enable-spam-user=n" |
95 |
|
96 |
# Enable regular expression scanning if 'pcre' is in USE |
97 |
myconf="${myconf} `use_enable pcre regex`" |
98 |
|
99 |
# This adds a "Received:" header to scanned e-mail, showing how many scanners/filters |
100 |
# simscan invoked. If you comment this out, you can comment out the path information |
101 |
# below. |
102 |
myconf="${myconf} --enable-received=y" |
103 |
|
104 |
# Path information for 'enable-received' |
105 |
myconf="${myconf} --enable-clamavdb-path=/var/lib/clamav" |
106 |
myconf="${myconf} --enable-sigtool-path=`which sigtool`" |
107 |
|
108 |
myconf="${myconf} --enable-spamassassin-path=`which spamassassin`" |
109 |
|
110 |
econf ${myconf} || die |
41 |
|
111 |
|
42 |
emake || die |
112 |
emake || die |
43 |
} |
113 |
} |
44 |
|
114 |
|
45 |
src_install() { |
115 |
src_install() { |
46 |
|
116 |
|
47 |
insopts -o simscan -g simscan -m 0755 |
117 |
insopts -o simscan -g clamav -m 0755 |
48 |
insinto /var/qmail/bin |
118 |
insinto /var/qmail/bin |
49 |
doins simscanmk |
119 |
doins simscanmk |
50 |
|
120 |
|
51 |
insopts -o simscan -g simscan -m 4755 |
121 |
insopts -o simscan -g clamav -m 4755 |
52 |
insinto /var/qmail/bin |
122 |
insinto /var/qmail/bin |
53 |
doins simscan |
123 |
doins simscan |
54 |
|
124 |
|
Lines 59-82
Link Here
|
59 |
|
129 |
|
60 |
einfo "Setting default configuration..." |
130 |
einfo "Setting default configuration..." |
61 |
touch simcontrol |
131 |
touch simcontrol |
62 |
echo :clam=yes,spam=yes > simcontrol |
132 |
echo ":clam=yes,spam=yes,attach=.scr:.bat:.com:.pif:.exe" > simcontrol |
63 |
insopts -o root -g root -m 644 |
133 |
insopts -o root -g root -m 644 |
64 |
insinto /var/qmail/control |
134 |
insinto /var/qmail/control |
65 |
doins simcontrol |
135 |
doins simcontrol |
66 |
|
136 |
|
67 |
touch ssattach |
137 |
touch ssattach |
68 |
insopts -o root -g root -m 644 |
138 |
insopts -o root -g root -m 644 |
69 |
insinto /var/qmail/control |
139 |
insinto /var/qmail/control |
70 |
doins ssattach |
140 |
doins ssattach |
71 |
} |
141 |
} |
72 |
|
142 |
|
73 |
pkg_postinst () { |
143 |
pkg_preinst() { |
74 |
einfo "to activate simscan, please edit your" |
144 |
einfo "Creating user and directory..." |
|
|
145 |
enewuser simscan -1 /bin/false /var/spool/simscan clamav |
146 |
diropts -m 2775 -o simscan -g clamav |
147 |
dodir ${simscan_workdir} |
148 |
} |
149 |
|
150 |
pkg_postinst() { |
151 |
einfo "To activate simscan, please edit your" |
75 |
einfo "/var/qmail/control/conf-common file and set:" |
152 |
einfo "/var/qmail/control/conf-common file and set:" |
76 |
einfo "export QMAILQUEUE=/var/qmail/bin/simscan" |
153 |
einfo "export QMAILQUEUE=/var/qmail/bin/simscan" |
77 |
einfo "or place it in your tcprules file." |
154 |
einfo "or place it in your tcprules file." |
78 |
|
155 |
echo "" |
79 |
einfo "run /var/qmail/bin/simscanmk -g to build" |
156 |
einfo "Running '/var/qmail/bin/simscanmk' & '/var/qmail/bin/simscanmk -g' to build" |
80 |
einfo "your configuration" |
157 |
einfo "your configuration." |
|
|
158 |
einfo " `/var/qmail/bin/simscanmk` " |
159 |
einfo " `/var/qmail/bin/simscanmk -g`" |
160 |
echo "" |
161 |
ewarn "Simscan has been configured to block the following attachments by default:" |
162 |
ewarn " .scr: Windows screensavers" |
163 |
ewarn " .bat: 'DOS' batch file executables" |
164 |
ewarn " .com: Windows command files" |
165 |
ewarn " .pif: Windows Program Information File" |
166 |
ewarn " .exe: Windows executables" |
167 |
ewarn "Read the documentation and see /var/qmail/control/simcontrol" |
168 |
echo "" |
81 |
} |
169 |
} |
82 |
|
170 |
|
|
|
171 |
pkg_postrm() { |
172 |
|
173 |
for i in `ls /var/qmail/control/sim*` ; do |
174 |
rm -rf ${i} |
175 |
done |
176 |
|
177 |
userdel ${simscan_user} |
178 |
|
179 |
} |