|
Lines 35-46
Link Here
|
| 35 |
<author title="Editor"> |
35 |
<author title="Editor"> |
| 36 |
<mail link="klasikahl@gentoo.org">Zack Gilburd</mail> |
36 |
<mail link="klasikahl@gentoo.org">Zack Gilburd</mail> |
| 37 |
</author> |
37 |
</author> |
| 38 |
<author title="Editor"><!-- dmargoli@speed.seas.upenn.edu --> |
|
|
| 39 |
Dan Margolis |
| 40 |
</author> |
| 41 |
|
38 |
|
| 42 |
<abstract> |
39 |
<abstract> |
| 43 |
This is a step-by-step guide for hardening Gentoo Linux. |
40 |
This guide is step-by-step guide for hardening Gentoo Linux. |
| 44 |
</abstract> |
41 |
</abstract> |
| 45 |
|
42 |
|
| 46 |
<license/> |
43 |
<license/> |
|
Lines 119-138
Link Here
|
| 119 |
<body> |
116 |
<body> |
| 120 |
|
117 |
|
| 121 |
<p> |
118 |
<p> |
| 122 |
No matter how many safeguards you implement, they can all be easily circumvented |
119 |
No matter how many safeguards you implement, all can easily be circumvented if |
| 123 |
by an attacker with physical access to your computer. Despite this, there are |
120 |
the attacker can gain physical access to your box. Make sure your hardware is |
| 124 |
atleast some measures that can be taken to provide a degree of security against |
121 |
not casually accessible. For example, you may want to place your box |
| 125 |
anattacker with physical access to your machine. Putting your hardware in a |
122 |
in a locked server closet. Locking cases is a good idea too. For the highest |
| 126 |
lockedcloset prevents an attacker from simply unplugging it and carting it |
123 |
level of security set your BIOS to restrict booting to your hard drive only. |
| 127 |
off. Locking your computer's case is also a good idea, to make sure that a |
124 |
Disable booting from the floppy and CD-ROM drives. For the paranoid, enabling |
| 128 |
attacker cannot simply walk away with your hard drive. To prevent an attacker |
125 |
the BIOS password is a good idea. BIOS passwords are also a good idea for |
| 129 |
from booting from another disk, nicely circumventing your permissions and login |
126 |
laptop users. |
| 130 |
restrictions, try setting the hard drive as the first boot device in your BIOS, |
|
|
| 131 |
and setting a BIOS password. It is also important to set a LILO or GRUB boot |
| 132 |
password, to prevent a malicious user from booting into single-user mode and |
| 133 |
gaining complete access to your system. This is covered in more detail in |
| 134 |
Chapter 3, under <uri link="#passwording_GRUB">Setting a GRUB password</uri> |
| 135 |
and <uri link="#passwording_LILO">Setting a LILO password</uri>. |
| 136 |
</p> |
127 |
</p> |
| 137 |
|
128 |
|
| 138 |
</body> |
129 |
</body> |
|
Lines 140-156
Link Here
|
| 140 |
<section> |
131 |
<section> |
| 141 |
<title>Daemon/Service Planning</title> |
132 |
<title>Daemon/Service Planning</title> |
| 142 |
<body> |
133 |
<body> |
|
|
134 |
|
| 143 |
<p> |
135 |
<p> |
| 144 |
Start by documenting what services this machine should run. This will help you |
136 |
Document what services the machine should run or is supposed to run. This will |
| 145 |
compose a better partition scheme for your system, and allow you to better plan |
137 |
help you compose a better partition scheme for the system. It can also make |
| 146 |
your security measures. Of course, this is unnecessary if the machine serves a |
138 |
your intrusion detection strategy much easier. Of course you should not document |
| 147 |
single simple purpose, such as a desktop, or a dedicated firewall. In those |
139 |
this if you only have one or a few computers and you are the only one using |
| 148 |
cases, you should not be running <e>any</e> services, except perhaps sshd. |
140 |
them e.g. if the computer is going to act as a firewall it should not run |
|
|
141 |
<e>any</e> services except perhaps sshd. |
| 149 |
</p> |
142 |
</p> |
|
|
143 |
|
| 150 |
<p> |
144 |
<p> |
| 151 |
This list can also be used to aid system administration. By keeping a current |
145 |
Document this and the current version of sshd - it will help you keep track of |
| 152 |
list of version information, you will find it much easier to keep everything up |
146 |
which system to upgrade in case someone finds a security hole in sshd. This |
| 153 |
to date if a remote vulnerability is discovered in one of your daemons. |
147 |
will also aid in determining who should have access to the system. |
| 154 |
</p> |
148 |
</p> |
| 155 |
|
149 |
|
| 156 |
</body> |
150 |
</body> |
|
Lines 160-186
Link Here
|
| 160 |
<body> |
154 |
<body> |
| 161 |
|
155 |
|
| 162 |
<p> |
156 |
<p> |
| 163 |
Partitioning rules: |
157 |
Golden rules: |
| 164 |
</p> |
158 |
</p> |
| 165 |
|
159 |
|
| 166 |
<ul> |
160 |
<ul> |
| 167 |
<li> |
161 |
<li> |
| 168 |
Any directory tree a user should be able to write to (e.g. <path>/home</path>, |
162 |
Any directory tree a user should be able to write to (<path>/home</path> and |
| 169 |
<path>/tmp</path>) should be on a seperate partition and use disk quotas. This |
163 |
<path>/tmp</path> <path>/var</path>), should be on a separate partition and |
| 170 |
reduces the risk of a user filling up your whole filesystem. Portage |
164 |
use disk quotas. Portage uses <path>/var/tmp</path> to compile files so that |
| 171 |
uses <path>/var/tmp</path> to compile files, so that partition should be large. |
165 |
partition should be large. This reduces the risk of a user filling up your |
|
|
166 |
<path>/</path> mount point. |
| 172 |
</li> |
167 |
</li> |
| 173 |
<li> |
168 |
<li> |
| 174 |
Any directory tree where you plan on installing non-distribution software should |
169 |
Any directory tree where you want to install non-distribution software should |
| 175 |
be on a seperate partition. According to the <uri link = |
170 |
be on a separate partition. According to the <uri |
| 176 |
"http://www.pathname.com/fhs/">File Hierarchy Standard</uri>, this |
171 |
link="http://www.pathname.com/fhs/">File Hierarchy Standard</uri>, this is |
| 177 |
is <path>/opt</path> or <path>/usr/local</path>. If these are separate |
172 |
<path>/opt</path> or <path>/usr/local</path>. If these are separate |
| 178 |
partitions, they will not be erased if you have to reinstall the system. |
173 |
partitions, they will not be erased if you have to reinstall the system. |
| 179 |
</li> |
174 |
</li> |
| 180 |
<li> |
175 |
<li> |
| 181 |
For extra security, static data can be put on a seperate partition that is |
176 |
Try to move static data to its own partition, and mount that partition in |
| 182 |
mounted read-only. For the truly paranoid, try using read-only media like |
177 |
read-only mode. If you're really paranoid you could try storing static data |
| 183 |
CD-ROM. |
178 |
on read-only media like CDROMs. |
| 184 |
</li> |
179 |
</li> |
| 185 |
</ul> |
180 |
</ul> |
| 186 |
|
181 |
|
|
Lines 191-199
Link Here
|
| 191 |
<body> |
186 |
<body> |
| 192 |
|
187 |
|
| 193 |
<p> |
188 |
<p> |
| 194 |
The user 'root' is the most vital user on the system and should not be |
189 |
The user 'root' is the most vital user on the system and should not be used for |
| 195 |
used for anything except when absolutely necessary. If an attacker gains root |
190 |
anything except if it is necessary. If an attacker gains root access you can no |
| 196 |
access, the only way to ever trust your system again is to reinstall. |
191 |
longer trust your system, so reinstall. |
| 197 |
</p> |
192 |
</p> |
| 198 |
|
193 |
|
| 199 |
<p> |
194 |
<p> |
|
Lines 202-299
Link Here
|
| 202 |
|
197 |
|
| 203 |
<ul> |
198 |
<ul> |
| 204 |
<li> |
199 |
<li> |
| 205 |
Always create a user for everyday use and if this user needs to have root |
200 |
Always create a user for everyday use and if this user needs to have root |
| 206 |
access, add the user to the group 'wheel'. This makes it possible for a normal |
201 |
access, add the user to the group wheel. This makes it possible for a normal |
| 207 |
user to <c>su</c> to root. |
202 |
user to su to root. |
| 208 |
</li> |
203 |
</li> |
| 209 |
<li> |
204 |
<li> |
| 210 |
Never run X or any other user application as root. root should only be used when |
205 |
Never run X or any other user application as root |
| 211 |
absolutely necessary; if a vulnerability exists in an application running as a |
|
|
| 212 |
user, an attacker can gain user level access. But if that application is running |
| 213 |
as root, the attacker gains root access. |
| 214 |
</li> |
206 |
</li> |
| 215 |
<li> |
207 |
<li> |
| 216 |
Always use absolute paths when logged in as root (or always use <c>su -</c>, |
208 |
Always use absolute paths when logged in as root. It's possible to trick root |
| 217 |
which replaces the environmental variables of the user with those of root, |
209 |
into running a different application rather than the one meant to be ran. For |
| 218 |
while being sure root's <c>PATH</c> only includes protecte directories |
210 |
example if someone tampered with the PATH and root su's without using |
| 219 |
like <path>/bin</path> and <path>/sbin</path>). It's possible to trick |
211 |
<c>su -</c>. Then root will use the path of the user. |
| 220 |
root into runninga different application rather than the one meant to be |
|
|
| 221 |
run. If root's <c>PATH</c> is protected or root only uses absolute paths, wecan |
| 222 |
be sure this won't happen. |
| 223 |
</li> |
212 |
</li> |
| 224 |
<li> |
213 |
<li> |
| 225 |
If a user only needs to run a few commands as root, instead of everything that |
214 |
If a user only needs a few commands instead of everything that root normally |
| 226 |
root normally can do, consider using <c>sudo</c> instead. Just be careful who |
215 |
can do, consider using <c>sudo</c>, but be careful with this! |
| 227 |
you give this access to, as well! |
|
|
| 228 |
</li> |
216 |
</li> |
| 229 |
<li> |
217 |
<li> |
| 230 |
Never leave the terminal when you are logged in as root. |
218 |
Never leave the terminal when you are logged in as root |
| 231 |
</li> |
219 |
</li> |
| 232 |
</ul> |
220 |
</ul> |
| 233 |
|
221 |
|
| 234 |
<p> |
222 |
<p> |
| 235 |
Gentoo has some default protection against normal users trying to <c>su</c> to |
223 |
Gentoo has general protection against normal users, trying to <c>su</c>. The |
| 236 |
root. The default PAM setting requires that a user be a member of the group |
224 |
default PAM setting states that a users has to be a member of wheel in order |
| 237 |
"wheel" in order to be able to <c>su</c>. |
225 |
to be able to su. |
| 238 |
</p> |
226 |
</p> |
| 239 |
|
227 |
|
| 240 |
</body> |
228 |
</body> |
| 241 |
</section> |
229 |
</section> |
| 242 |
<section id = "security_policies"> |
230 |
<section> |
| 243 |
<title>Security policies</title> |
231 |
<title>Security policies</title> |
| 244 |
<body> |
232 |
<body> |
| 245 |
|
233 |
|
| 246 |
<p> |
234 |
<p> |
| 247 |
There are several reasons to draft a security policy for your system(s) and |
235 |
There are several reasons why security policies are needed. |
| 248 |
network. |
|
|
| 249 |
</p> |
236 |
</p> |
| 250 |
|
237 |
|
| 251 |
<ul> |
238 |
<ul> |
| 252 |
<li> |
239 |
<li> |
| 253 |
A good security policy allows you to outline security as a "system", rather |
240 |
You cannot claim to have a secure network without a definition of what you |
| 254 |
than simply a jumble of different features. For example, without a policy an |
241 |
think is secure |
| 255 |
administrator might decide to turn off telnet, because it transmits |
242 |
</li> |
| 256 |
unencrypted passwords, but leave on FTP access, which has the same weakness. A |
243 |
<li> |
| 257 |
good security policy allows you to identify which security measures are |
244 |
It is almost impossible to catch potential attackers, resolve network |
| 258 |
worthwhile, and which are not. |
245 |
problems, or conduct audits, without spying on network traffic or looking in |
|
|
246 |
private home directories. And spying without the users agreement is illegal |
| 247 |
in most countries. And since about 60% of all attacks currently come from |
| 248 |
inside the organization, it is important that you keep an open eye. |
| 259 |
</li> |
249 |
</li> |
| 260 |
<li> |
250 |
<li> |
| 261 |
In order to diagnose problems, conduct audits, or track down intruders, it may |
251 |
You cannot expect your users to think about security, if you never explained |
| 262 |
be necessary to intercept network traffic, inspect the login and command |
252 |
why it was important or how they should protect themselves and their |
| 263 |
history of users, and look in home directories. Without outlining this in |
253 |
colleagues. |
| 264 |
print, and making users aware of this, such actions may actually be illegal |
|
|
| 265 |
and put <e>you</e> in legal jepeordy. |
| 266 |
</li> |
254 |
</li> |
| 267 |
<li> |
255 |
<li> |
| 268 |
Hijacked user accounts pose one of the most common threats to system |
256 |
Good guidelines and network documentation always pays off, no matter what |
| 269 |
security. Without explaining to users why security is important, and how to |
|
|
| 270 |
practice good security (such as not writing passwords on a Post-It note on |
| 271 |
their desks), it is unlikely you will have any hope of secure user accounts. |
| 272 |
</li> |
257 |
</li> |
| 273 |
<li> |
258 |
<li> |
| 274 |
A well-documented network and system layout will aid you, as well as law |
259 |
Police or federal law enforcement can not help you catch the attacker, if |
| 275 |
enforcement forensics examiners, if need be, in tracing an intrusion and |
260 |
they do not know your network configuration or the services that you provide. |
| 276 |
idetifying weaknesses after the fact. A security policy "issue" banner, |
261 |
</li> |
| 277 |
stating that your system is a private network and all unauthorized access is |
262 |
<li> |
| 278 |
prohibited, will also help ensure your ability to properly prosecute an |
263 |
What will you do when there has been an attack? You need to define what you |
| 279 |
intruder, once he is caught. |
264 |
are going to do and who you are going to tell about it. Are you just going |
|
|
265 |
to call the police/a CERT team on every occasion? They won't take you serious! |
| 280 |
</li> |
266 |
</li> |
| 281 |
</ul> |
267 |
</ul> |
| 282 |
|
268 |
|
| 283 |
<p> |
269 |
<p> |
| 284 |
The need for a good security policy is hopefully now more than clear. |
270 |
This should clearly state why it is important to create policies for systems |
|
|
271 |
with more than one user and why it is important to educate users. |
| 285 |
</p> |
272 |
</p> |
| 286 |
|
273 |
|
| 287 |
<p> |
274 |
<p> |
| 288 |
The policy itself is a document, or several documents, that outline the network |
275 |
A policy is a document (or several documents) with answers to questions like |
| 289 |
and system features (such as what services are provided), acceptible use and |
276 |
who, where, why and what. Every user on your system/network should read, |
| 290 |
forbidden use, security "best practices", and so forth. All users should be made |
277 |
understand and sign it. It is important that you take the time to help the |
| 291 |
aware of your security policy, as well as changes you make to keep it up to |
278 |
users understand the policy and why the policy needs to be signed or what will |
| 292 |
date. It is important that you take the time to help users understand your |
279 |
happens if they act directly against the policy (the policy should also state |
| 293 |
policy and why that policy needs to be signed or what will happens if they act |
280 |
this). This should be repeated at least once a year since the policy can change |
| 294 |
directly against the policy (the policy should also state this). This should be |
281 |
but also as a reminder to the user. |
| 295 |
repeated at least once a year, since the policy can change (but also as a |
|
|
| 296 |
reminder to the user of the policy itself). |
| 297 |
</p> |
282 |
</p> |
| 298 |
|
283 |
|
| 299 |
<note> |
284 |
<note> |
|
Lines 301-306
Link Here
|
| 301 |
</note> |
286 |
</note> |
| 302 |
|
287 |
|
| 303 |
<p> |
288 |
<p> |
|
|
289 |
Most parts of a policy can be enforced directly in the operating system or |
| 290 |
through firewalls and others cannot. |
| 291 |
</p> |
| 292 |
|
| 293 |
<p> |
| 304 |
A security policy should at least contain the following subjects: |
294 |
A security policy should at least contain the following subjects: |
| 305 |
</p> |
295 |
</p> |
| 306 |
|
296 |
|
|
Lines 322-328
Link Here
|
| 322 |
<li>PC shutdown before leaving</li> |
312 |
<li>PC shutdown before leaving</li> |
| 323 |
<li>Use of encryption</li> |
313 |
<li>Use of encryption</li> |
| 324 |
<li>Handling of keys to trusted co-workers</li> |
314 |
<li>Handling of keys to trusted co-workers</li> |
| 325 |
<li>Handling of confidential material when traveling</li> |
315 |
<li>Handling of classified material when traveling</li> |
| 326 |
</ul> |
316 |
</ul> |
| 327 |
</li> |
317 |
</li> |
| 328 |
<li>Handling of computer equipment when traveling</li> |
318 |
<li>Handling of computer equipment when traveling</li> |
|
Lines 334-357
Link Here
|
| 334 |
</ul> |
324 |
</ul> |
| 335 |
|
325 |
|
| 336 |
<p> |
326 |
<p> |
| 337 |
Different users may require different levels or types of access, and as such |
327 |
The policy for the IT-staff might be a bit different then the normal users. |
| 338 |
your policy may vary to accomodate them all. |
|
|
| 339 |
</p> |
328 |
</p> |
| 340 |
|
329 |
|
| 341 |
<p> |
330 |
<p> |
| 342 |
The security policy can become huge, and vital information can easily be |
331 |
The security policy can become huge, and vital information can easily be |
| 343 |
forgotten. The IT-staff's policy could contain information that is confidential |
332 |
forgotten. The IT-staff's policy could contain information that is classified |
| 344 |
for the ordinary user, so it is wise to split it up into smaller policies; |
333 |
for the ordinary user, so it is wise to split it up into smaller policies; i.e. |
| 345 |
e.g. Acceptable Use Policy, Password policy, Email policy and Remote Access |
334 |
Acceptable Use Policy, Password policy, Email policy and Remote Access policy. |
| 346 |
policy. |
|
|
| 347 |
</p> |
335 |
</p> |
| 348 |
|
336 |
|
| 349 |
<p> |
337 |
<p> |
| 350 |
You can find example policies at <uri |
338 |
One can find example policies at <uri |
| 351 |
link="http://www.sans.org/resources/policies/">The SANS Security Policy |
339 |
link="http://www.sans.org/resources/policies/">The SANS Security Policy |
| 352 |
Project</uri>. If you have a small network and think these policies are too much |
340 |
Project</uri>. If you have a small network and think these policies are too |
| 353 |
you should look at the <uri |
341 |
much you should look at the <uri |
| 354 |
link="http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc2196.html">Site Security |
342 |
link="http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc2196.html">Site Security |
| 355 |
Handbook</uri>. |
343 |
Handbook</uri>. |
| 356 |
</p> |
344 |
</p> |
| 357 |
|
345 |
|
|
Lines 360-387
Link Here
|
| 360 |
</chapter> |
348 |
</chapter> |
| 361 |
|
349 |
|
| 362 |
<chapter> |
350 |
<chapter> |
| 363 |
<title>Tightening security during and after installation</title> |
351 |
<title>Tightening the security after/during installation</title> |
| 364 |
<section> |
352 |
<section> |
| 365 |
<title>USE flags</title> |
353 |
<title>USE flags</title> |
| 366 |
<body> |
354 |
<body> |
| 367 |
|
355 |
|
| 368 |
<p> |
356 |
<p> |
| 369 |
The <path>make.conf</path> file contains user defined USE flags and |
357 |
The <path>make.conf</path> file contains user defined USE flags and |
| 370 |
<path>/etc/make.profile/make.defaults</path> contains the default USE flags for |
358 |
<path>/etc/make.profile/make.defaults</path> contains the default USE flags |
| 371 |
Gentoo Linux. For this guide's purposes, the important flags are <c>pam</c> |
359 |
for Gentoo Linux. For this guide the important flags are <c>pam</c> (Pluggable |
| 372 |
(Pluggable Authentication Modules), <c>tcpd</c> (TCP wrappers), and <c>ssl</c> |
360 |
Authentication Modules), <c>tcpd</c> (TCP wrappers) and <c>ssl</c> (Secure |
| 373 |
(Secure Socket Layer). These are all in the default USE flags. |
361 |
Socket Layer). These are all in the default USE flags. |
| 374 |
</p> |
362 |
</p> |
| 375 |
|
363 |
|
| 376 |
</body> |
364 |
</body> |
| 377 |
</section> |
365 |
</section> |
| 378 |
<section id = "passwording_GRUB"> |
366 |
<section> |
| 379 |
<title>Password protecting GRUB</title> |
367 |
<title>GRUB password</title> |
| 380 |
<body> |
368 |
<body> |
| 381 |
|
369 |
|
| 382 |
<p> |
370 |
<p> |
| 383 |
GRUB supports two different ways of adding password protection to your boot |
371 |
Grub supports 2 different ways of adding password restriction to its |
| 384 |
loader. The first uses plain text, while the latter uses md5+salt encryption. |
372 |
configuration file (<path>/boot/grub/grub.conf</path>). One with plain text |
|
|
373 |
password and one with md5+salt encryption. |
| 385 |
</p> |
374 |
</p> |
| 386 |
|
375 |
|
| 387 |
<pre caption="/boot/grub/grub.conf"> |
376 |
<pre caption="/boot/grub/grub.conf"> |
|
Lines 390-423
Link Here
|
| 390 |
</pre> |
379 |
</pre> |
| 391 |
|
380 |
|
| 392 |
<p> |
381 |
<p> |
| 393 |
This will add the password <c>changeme</c>. If no password is entered at boot, |
382 |
This will add the password <c>changeme</c> and if no password is entered simply |
| 394 |
GRUB will simply use the default boot setting. |
383 |
use the default boot setting. |
| 395 |
</p> |
384 |
</p> |
| 396 |
|
385 |
|
| 397 |
<p> |
386 |
<p> |
| 398 |
When adding an md5 password, you must convert your password into crypt format, |
387 |
When adding a md5 password, you need to convert the password into crypt format |
| 399 |
which is the same format used in <path>/etc/shadow</path>. For more information |
388 |
(<c>man crypt</c>) which is the same format as <path>/etc/shadow</path>. For |
| 400 |
see <c>man crypt</c>. The encrypted password <e>changeme</e>, for example, could |
389 |
more information see <c>man crypt</c>. The encrypted password <e>changeme</e> |
| 401 |
look like this $1$T7/dgdIJ$dJM.n2wZ8RG.oEiIOwJUs. |
390 |
could look like this $1$T7/dgdIJ$dJM.n2wZ8RG.oEiIOwJUs. |
| 402 |
</p> |
391 |
</p> |
| 403 |
|
392 |
|
| 404 |
<p> |
393 |
<p> |
| 405 |
You can encrypt your password directly at the GRUB shell: |
394 |
Or this you can convert it directly in the grub shell: |
| 406 |
</p> |
395 |
</p> |
| 407 |
|
396 |
|
| 408 |
<pre caption="md5crypt in grub shell"> |
397 |
<pre caption="md5crypt in grub shell"> |
| 409 |
#<i>/sbin/grub</i> |
398 |
#<i>/sbin/grub</i> |
| 410 |
|
399 |
|
| 411 |
GRUB version 0.92 (640K lower / 3072K upper memory) |
400 |
GRUB version 0.92 (640K lower / 3072K upper memory) |
| 412 |
|
401 |
|
| 413 |
[ Minimal BASH-like line editing is supported. For the first word, TAB lists |
402 |
[ Minimal BASH-like line editing is supported. For the first word, TAB |
| 414 |
possible command completions. Anywhere else TAB lists the possible |
403 |
lists possible command completions. Anywhere else TAB lists the possible |
| 415 |
completions of a device/filename. ] |
404 |
completions of a device/filename. ] |
| 416 |
|
405 |
|
| 417 |
grub> <i>md5crypt</i> |
406 |
grub> <i>md5crypt</i> |
| 418 |
|
407 |
|
| 419 |
Password: <i>********</i> |
408 |
Password: <i>********</i> |
| 420 |
<codenote>Typed changeme at the prompt</codenote> |
409 |
<codenote>Typed changeme</codenote> |
| 421 |
Encrypted: $1$T7/dgdIJ$dJM.n2wZ8RG.oEiIOwJUs. |
410 |
Encrypted: $1$T7/dgdIJ$dJM.n2wZ8RG.oEiIOwJUs. |
| 422 |
|
411 |
|
| 423 |
grub> <i>quit</i> |
412 |
grub> <i>quit</i> |
|
Lines 428-483
Link Here
|
| 428 |
</p> |
417 |
</p> |
| 429 |
|
418 |
|
| 430 |
<pre caption="/boot/grub/grub.conf"> |
419 |
<pre caption="/boot/grub/grub.conf"> |
| 431 |
timeout 5 |
420 |
timeout 5 |
| 432 |
password --md5 $1$T7/dgdIJ$dJM.n2wZ8RG.oEiIOwJUs. |
421 |
password --md5 $1$T7/dgdIJ$dJM.n2wZ8RG.oEiIOwJUs. |
| 433 |
</pre> |
422 |
</pre> |
| 434 |
|
423 |
|
| 435 |
<p> |
424 |
<p> |
| 436 |
The 5 seconds timeout becomes handy if the system is remote and should be able |
425 |
The 5 seconds timeout becomes handy if the system is remote and should be able |
| 437 |
to reboot without any keyboard interaction. Learn more about GRUB passwords by |
426 |
to reboot without any keyboard interaction. Learn more about grub passwords by |
| 438 |
executing <c>info grub</c>. |
427 |
executing <c>info grub</c>. |
| 439 |
</p> |
428 |
</p> |
| 440 |
|
429 |
|
| 441 |
</body> |
430 |
</body> |
| 442 |
</section> |
431 |
</section> |
| 443 |
<section id = "passwording_LILO"> |
432 |
<section> |
| 444 |
<title>Password protecting LILO</title> |
433 |
<title>LILO password</title> |
| 445 |
<body> |
434 |
<body> |
| 446 |
|
435 |
|
| 447 |
<p> |
436 |
<p> |
| 448 |
LILO also supports two ways of handling passwords: global and per-image, both in |
437 |
LILO also supports two ways of handling passwords: global and per-image, both |
| 449 |
clear text. |
438 |
in clear text. |
| 450 |
</p> |
439 |
</p> |
| 451 |
|
440 |
|
| 452 |
<p> |
441 |
<p> |
| 453 |
The globalpassword is set at the top of the configuration file, and applies to |
442 |
The global one is set at the top of the configuration file: |
| 454 |
every boot image: |
|
|
| 455 |
</p> |
443 |
</p> |
| 456 |
|
444 |
|
| 457 |
<pre caption="/etc/lilo.conf"> |
445 |
<pre caption="/etc/lilo.conf"> |
| 458 |
password=changeme |
446 |
password=changeme |
| 459 |
restricted |
447 |
restricted |
| 460 |
delay=3 |
448 |
delay=3 |
| 461 |
</pre> |
449 |
</pre> |
| 462 |
|
450 |
|
| 463 |
<p> |
451 |
<p> |
| 464 |
The per-image pasword is set as below: |
452 |
Otherwise simply add it to an image. |
| 465 |
</p> |
453 |
</p> |
| 466 |
|
454 |
|
| 467 |
<pre caption="/etc/lilo.conf"> |
455 |
<pre caption="/etc/lilo.conf"> |
| 468 |
image=/boot/bzImage |
456 |
image=/boot/bzImage |
| 469 |
read-only |
457 |
read-only |
| 470 |
password=changeme |
458 |
password=changeme |
| 471 |
restricted |
459 |
restricted |
| 472 |
</pre> |
460 |
</pre> |
| 473 |
|
461 |
|
| 474 |
<p> |
462 |
<p> |
| 475 |
If the <c>restricted</c> option is not entered, it will prompt for a password |
463 |
If the <c>restricted</c> option is not entered, it will prompt for password, |
| 476 |
every time. |
464 |
every time. |
| 477 |
</p> |
465 |
</p> |
| 478 |
|
466 |
|
| 479 |
<p> |
467 |
<p> |
| 480 |
In order to store the new information in <path>lilo.conf</path>, you must run |
468 |
In order to store the new information in <path>lilo.conf</path> you need to run |
| 481 |
<c>/sbin/lilo</c>. |
469 |
<c>/sbin/lilo</c>. |
| 482 |
</p> |
470 |
</p> |
| 483 |
|
471 |
|
|
Lines 488-504
Link Here
|
| 488 |
<body> |
476 |
<body> |
| 489 |
|
477 |
|
| 490 |
<p> |
478 |
<p> |
| 491 |
The <path>/etc/securetty</path> file allows you to specify which <c>tty</c> |
479 |
The <path>/etc/securetty</path> file allows you to specify which <c>tty</c> |
| 492 |
(terminal) devices root is allowed to login in from. |
480 |
(terminal) devices root is allowed to login in from. |
| 493 |
</p> |
481 |
</p> |
| 494 |
|
482 |
|
| 495 |
<p> |
483 |
<p> |
| 496 |
We suggest that you comment out all lines except <c>vc/1</c>. This will ensure |
484 |
We suggest that you comment out all lines except <c>vc/1</c>. This will ensure |
| 497 |
that root only can login once and only on one terminal. |
485 |
that root only can login once and only on one terminal. |
| 498 |
</p> |
486 |
</p> |
| 499 |
|
487 |
|
| 500 |
<note> |
488 |
<note> |
| 501 |
Users in the group "wheel" can still <c>su -</c> to become root on other TTYs. |
489 |
Users in the wheel group can still <c>su -</c> to become root on other TTYs. |
| 502 |
</note> |
490 |
</note> |
| 503 |
|
491 |
|
| 504 |
<pre caption="/etc/securetty"> |
492 |
<pre caption="/etc/securetty"> |
|
Lines 515-527
Link Here
|
| 515 |
<body> |
503 |
<body> |
| 516 |
|
504 |
|
| 517 |
<p> |
505 |
<p> |
| 518 |
Extra logging should be added to catch warnings or errors that might indicate |
506 |
Extra logging should be added to catch warnings or errors that might warn of an |
| 519 |
anongoing attack or a successful compromise. Attackers often scan or probe |
507 |
ongoing attack or of a successful compromise. Attackers often scan or probe |
| 520 |
before attacking. |
508 |
networks before attacking. |
| 521 |
</p> |
509 |
</p> |
| 522 |
|
510 |
|
| 523 |
<p> |
511 |
<p> |
| 524 |
It's also vital that your log files are easily readable and manageable. Gentoo |
512 |
Its also vital that the log files are easy readable and manageable. Gentoo |
| 525 |
Linux lets you choose between 3 different loggers when installing. |
513 |
Linux lets you choose between 3 different loggers when installing. |
| 526 |
</p> |
514 |
</p> |
| 527 |
|
515 |
|
|
Lines 532-548
Link Here
|
| 532 |
<body> |
520 |
<body> |
| 533 |
|
521 |
|
| 534 |
<p> |
522 |
<p> |
| 535 |
Syslogd is the most common logger for Linux and Unix in general. It does not |
523 |
Syslogd is the most common logger for Linux and Unix in general. It does not |
| 536 |
come with log rotation. This feature is handled by running |
524 |
come with log rotation. This feature is handled by running |
| 537 |
<path>/usr/sbin/logrotate</path> in a cron job (logrotate is configured in |
525 |
<path>/usr/sbin/logrotate</path> in a cron job and configured in |
| 538 |
<path>/etc/logrotate.conf</path>). How often log rotation should be done depends |
526 |
<path>/etc/logrotate.conf</path>. How often log rotation should be done depends |
| 539 |
on the system load. |
527 |
on the system load. |
| 540 |
</p> |
528 |
</p> |
| 541 |
|
529 |
|
| 542 |
<p> |
530 |
<p> |
| 543 |
Below is the standard <path>syslog.conf</path> with some added features. We |
531 |
Below is the standard <path>syslog.conf</path> with some added features. We |
| 544 |
have uncommented the <c>cron</c> and <c>tty</c> lines and added a remote |
532 |
have uncommented the <c>cron</c> and <c>tty</c> lines and added a remote |
| 545 |
logging server. To further enhance security you could add logging to two places. |
533 |
logging server. To further enhance security you could add logs in two places. |
| 546 |
</p> |
534 |
</p> |
| 547 |
|
535 |
|
| 548 |
<pre caption="/etc/syslog.conf"> |
536 |
<pre caption="/etc/syslog.conf"> |
|
Lines 624-637
Link Here
|
| 624 |
# *.=debug;*.=info;\ |
612 |
# *.=debug;*.=info;\ |
| 625 |
# *.=notice;*.=warn |/dev/xconsole |
613 |
# *.=notice;*.=warn |/dev/xconsole |
| 626 |
|
614 |
|
| 627 |
local2.* --/var/log/ppp.log |
615 |
local2.* -/var/log/ppp.log |
| 628 |
</pre> |
616 |
</pre> |
| 629 |
|
617 |
|
| 630 |
<p> |
618 |
<p> |
| 631 |
Attackers will most likely try to erase their tracks by editing or deleting log |
619 |
Attackers will most likely try to erase their tracks by editing or deleting the |
| 632 |
files. You can make it harder for them by logging to one or more remote logging |
620 |
log files. You can make it harder for the attacker by logging to one or more |
| 633 |
servers on other machines. Get more info about syslogd by executing <c>man |
621 |
logging servers on different machines. Get more info about syslogd by executing |
| 634 |
syslog</c>. |
622 |
<c>man syslog</c>. |
| 635 |
</p> |
623 |
</p> |
| 636 |
|
624 |
|
| 637 |
</body> |
625 |
</body> |
|
Lines 641-656
Link Here
|
| 641 |
<body> |
629 |
<body> |
| 642 |
|
630 |
|
| 643 |
<p> |
631 |
<p> |
| 644 |
<uri link="http://metalog.sourceforge.net">Metalog</uri> by Frank Dennis is not |
632 |
<uri link="http://metalog.sourceforge.net">Metalog</uri> by Frank Dennis is not |
| 645 |
able to log to a remote server, but it does have advantages when it comes to |
633 |
able to log to a remote server, but it does have advantages when it comes to |
| 646 |
performance and logging flexibility. It can log by program name, urgency, |
634 |
performance and logging flexibility. It can log by program name, urgency, |
| 647 |
facility (like syslogd), and comes with regular expression matching with which |
635 |
facility (like syslogd) and comes with regular expression matching and it can |
| 648 |
you can launch external scripts when specific patterns are found. It is very good |
636 |
launch external scripts when specific patterns are found. It is very good for |
| 649 |
at taking action when needed. |
637 |
taking action when needed. |
| 650 |
</p> |
638 |
</p> |
| 651 |
|
639 |
|
| 652 |
<p> |
640 |
<p> |
| 653 |
The standard configuration is usually enough. If you want to be notified by |
641 |
The standard configuration is basically enough. If you want to be notified by |
| 654 |
email whenever a password failure occurs use one of the following scripts. |
642 |
email whenever a password failure occurs use one of the following scripts. |
| 655 |
</p> |
643 |
</p> |
| 656 |
|
644 |
|
|
Lines 658-664
Link Here
|
| 658 |
For postfix: |
646 |
For postfix: |
| 659 |
</p> |
647 |
</p> |
| 660 |
|
648 |
|
| 661 |
<pre caption="/usr/local/sbin/mail_pwd_failures.sh for postfix"> |
649 |
<pre caption = "/usr/local/sbin/mail_pwd_failures.sh for postfix"> |
| 662 |
#! /bin/sh |
650 |
#! /bin/sh |
| 663 |
echo "$3" | mail -s "Warning (program : $2)" root |
651 |
echo "$3" | mail -s "Warning (program : $2)" root |
| 664 |
</pre> |
652 |
</pre> |
|
Lines 667-673
Link Here
|
| 667 |
For qmail: |
655 |
For qmail: |
| 668 |
</p> |
656 |
</p> |
| 669 |
|
657 |
|
| 670 |
<pre caption="/usr/local/sbin/mail_pwd_failures.sh for qmail"> |
658 |
<pre caption = "/usr/local/sbin/mail_pwd_failures.sh for qmail"> |
| 671 |
#!/bin/sh |
659 |
#!/bin/sh |
| 672 |
echo "To: root |
660 |
echo "To: root |
| 673 |
Subject:Failure (Warning: $2) |
661 |
Subject:Failure (Warning: $2) |
|
Lines 681-687
Link Here
|
| 681 |
</p> |
669 |
</p> |
| 682 |
|
670 |
|
| 683 |
<p> |
671 |
<p> |
| 684 |
Then uncomment the command line under "Password failures" in |
672 |
Then uncomment the command line under Password failures in |
| 685 |
<path>/etc/metalog/metalog.conf</path> like: |
673 |
<path>/etc/metalog/metalog.conf</path> like: |
| 686 |
</p> |
674 |
</p> |
| 687 |
|
675 |
|
|
Lines 696-710
Link Here
|
| 696 |
<body> |
684 |
<body> |
| 697 |
|
685 |
|
| 698 |
<p> |
686 |
<p> |
| 699 |
Syslog-ng provides some of the same features as syslog and metalog with a small |
687 |
Syslog-ng provide some of the same features as syslog and metalog with a small |
| 700 |
difference. It can filter messages based on level and content (like metalog), |
688 |
difference. It can filter messages based on level and content (like metalog), |
| 701 |
provide remote logging like syslog, handle logs from syslogd (even streams from |
689 |
provide remote logging like syslog, handle log from syslogd (even streams from |
| 702 |
Solaris), write to a TTY, execute programs, and it can act as a logging server. |
690 |
Solaris, write to a TTY, execute programs and it can act as a logging server. |
| 703 |
Basically it is the best of both loggers combined with advanced configuration. |
691 |
Basically it is the best of both loggers combined with advanced configuration. |
| 704 |
</p> |
692 |
</p> |
| 705 |
|
693 |
|
| 706 |
<p> |
694 |
<p> |
| 707 |
Below is a classic configuration file slightly modified. |
695 |
A classic configuration file slightly modified. |
| 708 |
</p> |
696 |
</p> |
| 709 |
|
697 |
|
| 710 |
<pre caption="/etc/syslog-ng/syslog-ng.conf"> |
698 |
<pre caption="/etc/syslog-ng/syslog-ng.conf"> |
|
Lines 783-834
Link Here
|
| 783 |
</pre> |
771 |
</pre> |
| 784 |
|
772 |
|
| 785 |
<p> |
773 |
<p> |
| 786 |
Syslog-ng is very easy to configure, but it is also very easy to miss something |
774 |
Very easy to configure but also very easy to miss something in the configuration |
| 787 |
in the configuration file since it is huge. The author still promises some extra |
775 |
file since it is huge. The author still promises some extra features like |
| 788 |
features like encryption, authentication, compression and MAC (Mandatory Access |
776 |
encryption, authentication, compression and MAC (Mandatory Access Control) |
| 789 |
Control) control. With these options it will be a perfect for network logging, |
777 |
control. With these options it will be a perfect for network logging. since |
| 790 |
since the attacker cannot spy on the log. |
778 |
the attacker cannot spy on the log. |
| 791 |
</p> |
|
|
| 792 |
|
| 793 |
<p> |
| 794 |
And syslog-ng does have one other advantage: it does not have to run as root! |
| 795 |
</p> |
779 |
</p> |
| 796 |
|
780 |
|
| 797 |
</body> |
|
|
| 798 |
</section> |
| 799 |
|
| 800 |
<section> |
| 801 |
<title>Log analysis with Logcheck</title> |
| 802 |
<body> |
| 803 |
|
| 804 |
<p> |
781 |
<p> |
| 805 |
Of course, keeping logs alone is only half the battle. An application such as |
782 |
And syslog-ng does have other advantages. It does not have to run as root!. |
| 806 |
Logcheck can make regular log analysis much easier. Logcheck is a script, |
|
|
| 807 |
accompanied by a binary called <c>logtail</c>, that runs from your cron daemon |
| 808 |
and checks your logs against a set of rules for suspicious activity. It then |
| 809 |
mails the output to root's mailbox. |
| 810 |
</p> |
| 811 |
<p> |
| 812 |
Logcheck uses four files to filter important log entries from the |
| 813 |
unimportant. These files are <path>logcheck.hacking</path>, which contains known |
| 814 |
hacking attack messages, <path>logcheck.violations</path>, which contains |
| 815 |
patterns indicating security |
| 816 |
violations, <path>logcheck.violations.ignore</path>, which contains keywords |
| 817 |
likely to be matched by the violations file, allowing normal entries to be |
| 818 |
ignored, and <path>logcheck.ignore</path>, which matches those entries to be |
| 819 |
ignored. |
| 820 |
</p> |
783 |
</p> |
| 821 |
|
784 |
|
| 822 |
<warn> |
|
|
| 823 |
Do not leave <path>logcheck.violations.ignore</path> empty. Logcheck |
| 824 |
uses <c>grep</c> to parse logs, some versions of which will take an empty file |
| 825 |
to mean wildcard. All violations would thus be ignored. |
| 826 |
</warn> |
| 827 |
<!--FIXME: Might want to add more details on logcheck here...I have to install |
| 828 |
it on Gentoo to figure out how it's configured!--> |
| 829 |
</body> |
785 |
</body> |
| 830 |
</section> |
786 |
</section> |
| 831 |
|
|
|
| 832 |
</chapter> |
787 |
</chapter> |
| 833 |
|
788 |
|
| 834 |
<chapter> |
789 |
<chapter> |
|
Lines 837-845
Link Here
|
| 837 |
<body> |
792 |
<body> |
| 838 |
|
793 |
|
| 839 |
<p> |
794 |
<p> |
| 840 |
When mounting an <c>ext2</c>, <c>ext3</c>, or <c>reiserfs</c> partition, you |
795 |
When mounting an <c>ext2</c>, <c>ext3</c> or a <c>reiserfs</c> partition, you |
| 841 |
have several options you can apply to the file <path>/etc/fstab</path>. The |
796 |
have several options you can apply to the <path>/etc/fstab</path>. The options |
| 842 |
options are: |
797 |
are: |
| 843 |
</p> |
798 |
</p> |
| 844 |
|
799 |
|
| 845 |
<ul> |
800 |
<ul> |
|
Lines 848-854
Link Here
|
| 848 |
file |
803 |
file |
| 849 |
</li> |
804 |
</li> |
| 850 |
<li> |
805 |
<li> |
| 851 |
<c>noexec</c> - Will prevent execution of files from this partition |
806 |
<c>noexec</c> - Will prevent from executing files from this partition |
| 852 |
</li> |
807 |
</li> |
| 853 |
<li> |
808 |
<li> |
| 854 |
<c>nodev</c> - Ignores devices |
809 |
<c>nodev</c> - Ignores devices |
|
Lines 856-864
Link Here
|
| 856 |
</ul> |
811 |
</ul> |
| 857 |
|
812 |
|
| 858 |
<p> |
813 |
<p> |
| 859 |
Unfortunately, these settings can easily be circumvented by executing a |
814 |
Unfortunately these settings can easily be circumvented by executing a |
| 860 |
non-direct path. However, setting <path>/tmp</path> to noexec will stop the |
815 |
non-direct path. However setting <path>/tmp</path> to noexec will stop about |
| 861 |
majority of exploits designed to be executed directly from <path>/tmp</path>. |
816 |
99% of all script kiddies since their exploits are designed to be executed |
|
|
817 |
directly from <path>/tmp</path>. |
| 862 |
</p> |
818 |
</p> |
| 863 |
|
819 |
|
| 864 |
<pre caption="/etc/fstab"> |
820 |
<pre caption="/etc/fstab"> |
|
Lines 874-890
Link Here
|
| 874 |
</pre> |
830 |
</pre> |
| 875 |
|
831 |
|
| 876 |
<warn> |
832 |
<warn> |
| 877 |
Placing <path>/tmp</path> in <c>noexec</c> mode can prevent certain scripts |
833 |
Placing <path>/tmp</path> in <c>noexec</c> mode can prevent certain scripts |
| 878 |
from executing properly. |
834 |
from executing properly. |
| 879 |
</warn> |
835 |
</warn> |
| 880 |
|
836 |
|
| 881 |
<note> |
837 |
<note> |
| 882 |
For disk quotas see <uri link="#doc_chap6_sect3">the Quotas section</uri>. |
838 |
Disk quotas see <uri link="#doc_chap6_sect3">Quotas section</uri>. |
| 883 |
</note> |
839 |
</note> |
| 884 |
|
840 |
|
| 885 |
<note> |
841 |
<note> |
| 886 |
I do not set <path>/var</path> to <c>noexec</c> or <c>nosuid</c>, even if files |
842 |
I do not set <path>/var</path> to <c>noexec</c> or <c>nosuid</c> even if files |
| 887 |
normally are never executed from this mount point. The reason for this is that |
843 |
normally are never executed from this mount point. The reason for this is that |
| 888 |
qmail is installed in <path>/var/qmail</path> and must be allowed to execute |
844 |
qmail is installed in <path>/var/qmail</path> and must be allowed to execute |
| 889 |
and access one SUID file. I setup <path>/usr</path> in read-only mode since I |
845 |
and access one SUID file. I setup <path>/usr</path> in read-only mode since I |
| 890 |
never write anything there unless I want to update Gentoo. Then I remount the |
846 |
never write anything there unless I want to update Gentoo. Then I remount the |
|
Lines 893-901
Link Here
|
| 893 |
|
849 |
|
| 894 |
<note> |
850 |
<note> |
| 895 |
Even if you do not use qmail, Gentoo still needs the executable bit set on |
851 |
Even if you do not use qmail, Gentoo still needs the executable bit set on |
| 896 |
<path>/var/tmp</path> since ebuilds are made here. But an alternative path can |
852 |
<path>/var/tmp</path> since ebuilds are made here. But an alternative path can |
| 897 |
be setup if you insist on having <path>/var</path> mounted in <c>noexec</c> |
853 |
be setup if you insist on having <path>/var</path> in <c>noexec</c> mode. |
| 898 |
mode. |
|
|
| 899 |
</note> |
854 |
</note> |
| 900 |
|
855 |
|
| 901 |
</body> |
856 |
</body> |
|
Lines 904-940
Link Here
|
| 904 |
|
859 |
|
| 905 |
<chapter> |
860 |
<chapter> |
| 906 |
<title>User/group limitations</title> |
861 |
<title>User/group limitations</title> |
| 907 |
<section id = "limits_conf"> |
862 |
<section> |
| 908 |
<title>/etc/security/limits.conf</title> |
863 |
<title>/etc/security/limits.conf</title> |
| 909 |
<body> |
864 |
<body> |
| 910 |
|
865 |
|
| 911 |
<p> |
866 |
<p> |
| 912 |
Controlling resource usage can be very effective when trying to prevent a local |
867 |
Controlling resource limitations can be very effective when trying to prevent |
| 913 |
Denial of Service or restricting the maximum allowed logins for a group or user. |
868 |
a local DoS or handling the maximum allowed logins for a group or user. |
| 914 |
</p> |
869 |
</p> |
| 915 |
|
870 |
|
| 916 |
<pre caption="/etc/security/limits.conf"> |
871 |
<pre caption="/etc/security/limits.conf"> |
| 917 |
* soft core 0 |
872 |
* soft core 0 |
| 918 |
* hard core 0 |
873 |
* hard core 0 |
| 919 |
* hard nproc 15 |
874 |
* hard nproc 15 |
| 920 |
* hard rss 10000 |
875 |
* hard rss 10000 |
| 921 |
* - maxlogins 2 |
876 |
* - maxlogins 2 |
| 922 |
@dev hard core 100000 |
877 |
@dev hard core 100000 |
| 923 |
@dev soft nproc 20 |
878 |
@dev soft nproc 20 |
| 924 |
@dev hard nproc 35 |
879 |
@dev hard nproc 35 |
| 925 |
@dev - maxlogins 10 |
880 |
@dev - maxlogins 10 |
| 926 |
</pre> |
881 |
</pre> |
| 927 |
|
882 |
|
| 928 |
<p> |
883 |
<p> |
| 929 |
If you find yourself trying to set <c>nproc</c> or <c>maxlogins</c> to 0, maybe |
884 |
If you find yourself trying to set <c>nproc</c> or <c>maxlogins</c> to 0, maybe |
| 930 |
you should delete the user instead. The example above sets the group <c>dev</c> |
885 |
you should delete the user instead. The example above sets the group <c>dev</c> |
| 931 |
settings for processes, core file and <c>maxlogins</c>. The rest is set to a |
886 |
settings for processes, core file and <c>maxlogins</c>. The rest is set to a |
| 932 |
default value. |
887 |
default value. |
| 933 |
</p> |
888 |
</p> |
| 934 |
|
889 |
|
| 935 |
<note> |
890 |
<note> |
| 936 |
<path>/etc/security/limits.conf</path> is part of the PAM package and will |
891 |
<path>/etc/security/limits.conf</path> is part of the PAM package and will |
| 937 |
only apply to packages that use PAM. |
892 |
only apply to packages that use PAM. |
| 938 |
</note> |
893 |
</note> |
| 939 |
|
894 |
|
| 940 |
</body> |
895 |
</body> |
|
Lines 945-953
Link Here
|
| 945 |
|
900 |
|
| 946 |
<p> |
901 |
<p> |
| 947 |
<path>/etc/limits</path> is very similar to the limit file |
902 |
<path>/etc/limits</path> is very similar to the limit file |
| 948 |
<path>/etc/security/limits.conf</path>. The only difference is is the format and |
903 |
<path>/etc/security/limits.conf</path>. The only differences is the format and |
| 949 |
that it only works on users or wild cards (not groups). Lets have a look at a |
904 |
it only works on users or wild cards (not groups). Lets have a look at decent |
| 950 |
sample configuration: |
905 |
configuration: |
| 951 |
</p> |
906 |
</p> |
| 952 |
|
907 |
|
| 953 |
<pre caption="/etc/limits"> |
908 |
<pre caption="/etc/limits"> |
|
Lines 956-964
Link Here
|
| 956 |
</pre> |
911 |
</pre> |
| 957 |
|
912 |
|
| 958 |
<p> |
913 |
<p> |
| 959 |
Here we set the default settings and a specific setting for the user kn. Limits |
914 |
Here we set the default settings and a specific setting for the user kn. |
| 960 |
are part of the sys-apps/shadow package. It is not necessary to set any limits |
915 |
Limits are part of the sys-apps/shadow package. It is not necessary to set any |
| 961 |
in this file if you have disabled <c>pam</c> in |
916 |
limitations in this file if you have disabled <c>pam</c> in |
| 962 |
<path>make.conf</path> or not configured PAM properly. |
917 |
<path>make.conf</path> or not configured PAM properly. |
| 963 |
</p> |
918 |
</p> |
| 964 |
|
919 |
|
|
Lines 969-996
Link Here
|
| 969 |
<body> |
924 |
<body> |
| 970 |
|
925 |
|
| 971 |
<warn> |
926 |
<warn> |
| 972 |
Make sure the file systems you are working with support quotas. In order to use |
927 |
Make sure the file systems you are working with support quotas. ReiserFS is not |
| 973 |
quotas on ReiserFS, you must patch your kernel with patches available from <uri |
928 |
one of them! |
| 974 |
link = |
|
|
| 975 |
"ftp://ftp.namesys.com/pub/reiserfs-for-2.4/testing/quota-2.4.20">Namesys</uri>. User |
| 976 |
tools are available from <uri link = |
| 977 |
"http://www.sf.net/projects/linuxquota/">the Linux DiskQuota |
| 978 |
project</uri>. While quotas do work with ReiserFS, you may encounter other |
| 979 |
issues while trying to use them--you have been warned! |
| 980 |
</warn> |
929 |
</warn> |
| 981 |
|
930 |
|
| 982 |
<p> |
931 |
<p> |
| 983 |
Putting quotas on a file system restricts disk usage on a per-user or per-group |
932 |
Putting quotas on a file system prevents users from filling up the disk or |
| 984 |
basis. Quotas are enabled in the kernel and added to a mount point |
933 |
writing at all. Quotas are enabled in the kernel and added to a mount point. |
| 985 |
in <path>/etc/fstab</path>. The kernel option is enabled in the kernel |
934 |
The kernel option is enabled in the kernel configuration under |
| 986 |
configuration under <c>File systems->Quota support</c>. Apply the following |
935 |
<c>File systems->Quota support</c>. Apply the following settings, rebuild the |
| 987 |
settings, rebuild the kernel and reboot using the new kernel. |
936 |
kernel and reboot using the new kernel. |
| 988 |
</p> |
937 |
</p> |
| 989 |
|
938 |
|
| 990 |
<p> |
939 |
<p> |
| 991 |
Start by installing quotas with <c>emerge quota</c>. Then modify your |
940 |
Start by installing quotas with <c>emerge quota</c>. Then modify your |
| 992 |
<path>/etc/fstab</path> and add <c>usrquota</c> and <c>grpquota</c> to the |
941 |
<path>/etc/fstab</path> and add <c>usrquota</c> and <c>grpquota</c> to the |
| 993 |
partitions that you want to restrict disk usage on, like in the example below. |
942 |
partitions that you want to restrict disk usage like the example below. |
| 994 |
</p> |
943 |
</p> |
| 995 |
|
944 |
|
| 996 |
<pre caption="/etc/fstab"> |
945 |
<pre caption="/etc/fstab"> |
|
Lines 1006-1013
Link Here
|
| 1006 |
</pre> |
955 |
</pre> |
| 1007 |
|
956 |
|
| 1008 |
<p> |
957 |
<p> |
| 1009 |
On every partition that you have enabled quotas, create the quota files |
958 |
On every partition that you have enabled quotas, create the quota files |
| 1010 |
(<path>quota.user</path> and <path>quota.group</path>) and place them in the |
959 |
(<path>quota.user</path> and <path>quota.group</path>) and place them in the |
| 1011 |
root of the partition. |
960 |
root of the partition. |
| 1012 |
</p> |
961 |
</p> |
| 1013 |
|
962 |
|
|
Lines 1019-1025
Link Here
|
| 1019 |
</pre> |
968 |
</pre> |
| 1020 |
|
969 |
|
| 1021 |
<p> |
970 |
<p> |
| 1022 |
This step has to be done on every partition where quotas are enabled. After |
971 |
This step has to be done on every partition where quotas are enabled. After |
| 1023 |
adding and configuring the quota files, we need to add the <c>quota</c> script |
972 |
adding and configuring the quota files, we need to add the <c>quota</c> script |
| 1024 |
to the boot runlevel. |
973 |
to the boot runlevel. |
| 1025 |
</p> |
974 |
</p> |
|
Lines 1029-1036
Link Here
|
| 1029 |
</pre> |
978 |
</pre> |
| 1030 |
|
979 |
|
| 1031 |
<p> |
980 |
<p> |
| 1032 |
We will now configure the system to check the quotas once a week by adding the |
981 |
We will now configure the system to check the quotas once a |
| 1033 |
following line to <path>/etc/crontab</path>: |
982 |
week by adding the following line to <path>/etc/crontab</path>: |
| 1034 |
</p> |
983 |
</p> |
| 1035 |
|
984 |
|
| 1036 |
<pre caption="Adding quota check to crontab"> |
985 |
<pre caption="Adding quota check to crontab"> |
|
Lines 1038-1047
Link Here
|
| 1038 |
</pre> |
987 |
</pre> |
| 1039 |
|
988 |
|
| 1040 |
<p> |
989 |
<p> |
| 1041 |
After rebooting the machine, it is time to setup the quotas for users and |
990 |
After rebooting the machine, it is time to setup the quotas for users and |
| 1042 |
groups. <c>edquota -u kn</c> will start the editor defined in $EDITOR (default |
991 |
groups. <c>edquota -u kn</c> will start the editor defined in $EDITOR (default |
| 1043 |
is nano) and let you edit the quotas of the user kn. <c>edquota -g</c> will do |
992 |
is nano) and let you edit the quotas of the user kn. <c>edquota -g</c> will do |
| 1044 |
the same thing for groups. |
993 |
the same thing just for groups. |
| 1045 |
</p> |
994 |
</p> |
| 1046 |
|
995 |
|
| 1047 |
<pre caption="Setting up quota's for user kn"> |
996 |
<pre caption="Setting up quota's for user kn"> |
|
Lines 1051-1057
Link Here
|
| 1051 |
</pre> |
1000 |
</pre> |
| 1052 |
|
1001 |
|
| 1053 |
<p> |
1002 |
<p> |
| 1054 |
For more detail read <c>man edquota</c> or the <uri |
1003 |
For more detail read <c>man edquota</c> or the <uri |
| 1055 |
link="http://www.tldp.org/HOWTO/mini/Quota.html">Quota mini howto</uri>. |
1004 |
link="http://www.tldp.org/HOWTO/mini/Quota.html">Quota mini howto</uri>. |
| 1056 |
</p> |
1005 |
</p> |
| 1057 |
|
1006 |
|
|
Lines 1062-1072
Link Here
|
| 1062 |
<body> |
1011 |
<body> |
| 1063 |
|
1012 |
|
| 1064 |
<p> |
1013 |
<p> |
| 1065 |
If your security policy states that users should change their password |
1014 |
If the policy states that users should change their password every other week, |
| 1066 |
every other week, change the value <c>PASS_MAX_DAYS</c> to 14 |
1015 |
change the value <c>PASS_MAX_DAYS</c> to 14 and <c>PASS_WARN_AGE</c> to 7. It |
| 1067 |
and <c>PASS_WARN_AGE</c> to 7. It is recommended that you use password |
1016 |
is also recommended that you use password aging since brute force methods will |
| 1068 |
aging since brute force methods can find any password, given enough |
1017 |
find any password, it is just a matter of time. We also encourage you to set |
| 1069 |
time. We also encourage you to set <c>LOG_OK_LOGINS</c> to yes. |
1018 |
<c>LOG_OK_LOGINS</c> to yes. |
| 1070 |
</p> |
1019 |
</p> |
| 1071 |
|
1020 |
|
| 1072 |
</body> |
1021 |
</body> |
|
Lines 1076-1092
Link Here
|
| 1076 |
<body> |
1025 |
<body> |
| 1077 |
|
1026 |
|
| 1078 |
<p> |
1027 |
<p> |
| 1079 |
The <path>login.access</path> file is also part of the sys-apps/shadow package, |
1028 |
The <path>login.access</path> file is also part of the sys-apps/shadow package, |
| 1080 |
which provides a login access control table. This table is used to control who |
1029 |
which gives a login access control table. The table is used to control who can |
| 1081 |
can and cannot login based on user name, group name or host name. By default, |
1030 |
and cannot login based on user name, group name or host name. Per default, all |
| 1082 |
all users on the system are allowed to login, so the file consists only of |
1031 |
users on the system are allowed to login so the file consists only of comments |
| 1083 |
comments and examples. Whether you are securing your server or workstation, we |
1032 |
and examples. Whether you are securing your server or workstation, we recommend |
| 1084 |
recommend that you setup this file so no one other than yourself (the admin) has |
1033 |
that you setup this file so no one other than yourself (the admin) has access to |
| 1085 |
access to the console. |
1034 |
the console. |
| 1086 |
</p> |
1035 |
</p> |
| 1087 |
|
1036 |
|
| 1088 |
<note> |
1037 |
<note> |
| 1089 |
These settings do not apply for root. |
1038 |
These settings does not apply for root. |
| 1090 |
</note> |
1039 |
</note> |
| 1091 |
|
1040 |
|
| 1092 |
<pre caption="/etc/login.access"> |
1041 |
<pre caption="/etc/login.access"> |
|
Lines 1095-1113
Link Here
|
| 1095 |
</pre> |
1044 |
</pre> |
| 1096 |
|
1045 |
|
| 1097 |
<impo> |
1046 |
<impo> |
| 1098 |
Be careful when configuring these options, since mistakes will leave you with no |
1047 |
Be careful when configuring these options, since mistakes will leave you out |
| 1099 |
access to the machine if you do not have root access. |
1048 |
with no access to the machine if you do not have root access. |
| 1100 |
</impo> |
1049 |
</impo> |
| 1101 |
|
1050 |
|
| 1102 |
<note> |
1051 |
<note> |
| 1103 |
These settings does not apply to SSH, since SSH does not execute |
1052 |
These settings does not apply to SSH since SSH does not execute |
| 1104 |
<c>/bin/login</c> by default. This can be enabled by setting <c>UseLogin yes</c> |
1053 |
<c>/bin/login</c> per default. This can be enabled by using the <c>UseLogin |
| 1105 |
in <path>/etc/ssh/sshd_config</path>. |
1054 |
yes</c> in <path>/etc/ssh/sshd_config</path>. It will make SSH use login and |
|
|
1055 |
the settings will apply. |
| 1106 |
</note> |
1056 |
</note> |
| 1107 |
|
1057 |
|
| 1108 |
<p> |
1058 |
<p> |
| 1109 |
This will setup login access so members of the wheel group can login locally or |
1059 |
This will setup login access so members of the wheel group can login locally |
| 1110 |
from the gentoo.org domain. Maybe too paranoid, but better safe then sorry. |
1060 |
or from the gentoo.org domain. Maybe too paranoid, but better safe then sorry. |
| 1111 |
</p> |
1061 |
</p> |
| 1112 |
|
1062 |
|
| 1113 |
</body> |
1063 |
</body> |
|
Lines 1121-1132
Link Here
|
| 1121 |
<body> |
1071 |
<body> |
| 1122 |
|
1072 |
|
| 1123 |
<p> |
1073 |
<p> |
| 1124 |
Normal users should not have access to configuration files or passwords. An |
1074 |
Normal users should not have access to configuration files or passwords. An |
| 1125 |
attacker can steal passwords from databases or websites and use them to |
1075 |
attacker can steal passwords from databases or websites and use them to deface |
| 1126 |
deface--or even worse, delete--data. This is why it is important that your file |
1076 |
or even worse, delete data. This is why it is important that the permissions |
| 1127 |
permissions are correct. If you are sure that a file is only used by root, |
1077 |
are correct. If you are sure that a file is only used by root, assign it with |
| 1128 |
assign it with the permissions <c>0600</c> and assign the file to the correct |
1078 |
the permissions <c>0600</c> and assign the file to the correct user with |
| 1129 |
user with <c>chown</c>. |
1079 |
<c>chown</c>. |
| 1130 |
</p> |
1080 |
</p> |
| 1131 |
|
1081 |
|
| 1132 |
</body> |
1082 |
</body> |
|
Lines 1143-1151
Link Here
|
| 1143 |
</pre> |
1093 |
</pre> |
| 1144 |
|
1094 |
|
| 1145 |
<p> |
1095 |
<p> |
| 1146 |
This will create a huge file with permission of all files having either write |
1096 |
This will create a huge file with permission of all files having either write |
| 1147 |
permission set to the group or everybody. Check the permissions and eliminate |
1097 |
permission set to the group or everybody. Check the permissions and eliminate |
| 1148 |
world writable files to everyone, by executing <c>/bin/chmod o-w</c> on the |
1098 |
world writable files to everyone, by executing <c>/bin/chmod o-w</c> on the |
| 1149 |
files. |
1099 |
files. |
| 1150 |
</p> |
1100 |
</p> |
| 1151 |
|
1101 |
|
|
Lines 1156-1175
Link Here
|
| 1156 |
<body> |
1106 |
<body> |
| 1157 |
|
1107 |
|
| 1158 |
<p> |
1108 |
<p> |
| 1159 |
Files with the SUID or SGID bit set execute with privileges of the <e>owning</e> |
1109 |
Files with the SUID or SGID bit set allows the files to execute with |
| 1160 |
user or group and not the user executing the file. Normally these bits are used |
1110 |
privileges of the <e>owning</e> user or group and not the user executing the |
| 1161 |
on files that must run as root in order to do what they do. These files can lead |
1111 |
file. Normally these bits are used on files that must run as root in order to |
| 1162 |
to local root compromises (if they contain security holes). This is dangerous |
1112 |
do what they do. These files can lead to local root compromise (if they |
| 1163 |
and files with the SUID or SGID bits set should be avoided at any cost. If you |
1113 |
contain security holes). This is dangerous and files with the SUID or SGID |
| 1164 |
do not use these files, use <c>chmod 0</c> on them or unmerge the package that |
1114 |
bits set should be avoided at any cost. If you do not use the files use |
| 1165 |
they came from (check which package they belong to by using <c>qpkg -f</c>; if |
1115 |
<c>chmod 0</c> on them or unmerge the package they came from (check which |
| 1166 |
you do not already have it installed simply type <c>emerge |
1116 |
package they belong to by using <c>qpkg -f</c>). If you do not already have it |
| 1167 |
gentoolkit</c>). Otherwise just turn the SUID bit off with <c>chmod -s</c>. |
1117 |
installed simply type <c>emerge gentoolkit</c> it). Otherwise just turn the |
|
|
1118 |
SUID bit off with <c>chmod -s</c>. |
| 1168 |
</p> |
1119 |
</p> |
| 1169 |
|
1120 |
|
| 1170 |
<pre caption="Finding setuid files"> |
1121 |
<pre caption="Finding setuid files"> |
| 1171 |
# <i>/usr/bin/find / -type f \( -perm -004000 -o -perm -002000 \) \ |
1122 |
# <i>/usr/bin/find / -type f \( -perm -004000 -o -perm -002000 \) \ |
| 1172 |
-exec ls -lg {} \; 2>/dev/null >suidfiles.txt</i> |
1123 |
-exec ls -lg {} \; 2>/dev/null >suidfiles.txt</i> |
| 1173 |
</pre> |
1124 |
</pre> |
| 1174 |
|
1125 |
|
| 1175 |
<p> |
1126 |
<p> |
|
Lines 1200-1222
Link Here
|
| 1200 |
</pre> |
1151 |
</pre> |
| 1201 |
|
1152 |
|
| 1202 |
<p> |
1153 |
<p> |
| 1203 |
By default Gentoo Linux does not have a lot of SUID files (though this depends |
1154 |
By default Gentoo Linux does not have a lot of SUID files (it depends on what |
| 1204 |
on what you installed), but you might get a list like the one above. Most of the |
1155 |
you installed), but you might get a list like the one above. Most of the |
| 1205 |
commands should not be used by normal users, only root. Switch off the SUID bit |
1156 |
commands should not be used by normal users, only root. Switch off the SUID |
| 1206 |
on <c>ping</c>, <c>mount</c>, <c>umount</c>, <c>chfn</c>, <c>chsh</c>, <c>newgrp</c>, <c>suidperl</c>, <c>pt_chown</c> |
1157 |
bit on <c>ping</c>, <c>mount</c>, <c>umount</c>, <c>chfn</c>, <c>chsh</c>, |
| 1207 |
and <c>traceroute</c> by executing <c>chmod -s</c> on every file. Don't |
1158 |
<c>newgrp</c>, <c>suidperl</c>, <c>pt_chown</c> and <c>traceroute</c> by |
| 1208 |
remove the bit on <c>su</c>, <c>qmail-queue</c> or <c>unix_chkpwd</c>. Removing |
1159 |
<c>chmod -s</c> on every file. Don't remove the bit on <c>su</c>, |
| 1209 |
setuid from those files will prevent you from <c>su</c>'ing and receiving |
1160 |
<c>qmail-queue</c> or <c>unix_chkpwd</c>. Removing will prevent you from |
| 1210 |
mail. By removing the bit (where it is safe to do so) you remove the possibility |
1161 |
su'ing and receiving mail. By removing the bit you remove the possibility of a |
| 1211 |
of a normal user (or an attacker) gaining root access through any of these |
1162 |
normal user (or an attacker) to gain root access through any of these files. |
| 1212 |
files. |
|
|
| 1213 |
</p> |
1163 |
</p> |
| 1214 |
|
1164 |
|
| 1215 |
<p> |
1165 |
<p> |
| 1216 |
The only SUID files that I have on my system are <c>su</c>, <c>passwd</c>, |
1166 |
The only SUID files that I have on my system are <c>su</c>, <c>passwd</c>, |
| 1217 |
<c>gpasswd</c>, <c>qmail-queue</c>, <c>unix_chkpwd</c> and <c>pwdb_chkpwd</c>. |
1167 |
<c>gpasswd</c>, <c>qmail-queue</c>, <c>unix_chkpwd</c> and <c>pwdb_chkpwd</c>. |
| 1218 |
But if you are running X, you might have some more, since X needs the elevated |
1168 |
But if you are running X, you might have some more, since X needs the access. |
| 1219 |
access afforded by SUID. |
|
|
| 1220 |
</p> |
1169 |
</p> |
| 1221 |
|
1170 |
|
| 1222 |
</body> |
1171 |
</body> |
|
Lines 1229-1238
Link Here
|
| 1229 |
<body> |
1178 |
<body> |
| 1230 |
|
1179 |
|
| 1231 |
<p> |
1180 |
<p> |
| 1232 |
PAM is a suite of shared libraries that provide an alternative way providing |
1181 |
PAM is a suite of shared libraries that provide an alternative way of making |
| 1233 |
user authentication in programs. The <c>pam</c> USE flag is turned on by |
1182 |
authentication in programs. The <c>pam</c> USE flag is turned on by default. |
| 1234 |
default. Thus the PAM settings on Gentoo Linux are pretty reasonable, but there |
1183 |
Thus the PAM settings on Gentoo Linux are pretty reasonable, but there is |
| 1235 |
is always room for improvement. First install cracklib. |
1184 |
always room for improvement. First install cracklib. |
| 1236 |
</p> |
1185 |
</p> |
| 1237 |
|
1186 |
|
| 1238 |
<pre caption="Installing cracklib"> |
1187 |
<pre caption="Installing cracklib"> |
|
Lines 1248-1258
Link Here
|
| 1248 |
</pre> |
1197 |
</pre> |
| 1249 |
|
1198 |
|
| 1250 |
<p> |
1199 |
<p> |
| 1251 |
This will add the cracklib which will ensure that the user passwords are at |
1200 |
This will add the cracklib which will ensure that the users use a minimum |
| 1252 |
least 8 characters and contain a minimum of 2 digits, 2 other characters, and |
1201 |
password length of 8 characters and it consists of minimum 2 digits, 2 others |
| 1253 |
are more than 3 characters different from the last password. This forces the |
1202 |
and there must be more than 3 characters different from the last password. |
| 1254 |
user to choose a good password (password policy). Check the <uri |
1203 |
This forces the user to choose a good password (password policy). Check the |
| 1255 |
link="http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam-6.html#ss6.3">PAM</uri> |
1204 |
<uri link="http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam-6.html#ss6.3">PAM</uri> |
| 1256 |
documentation for more options. |
1205 |
documentation for more options. |
| 1257 |
</p> |
1206 |
</p> |
| 1258 |
|
1207 |
|
|
Lines 1269-1281
Link Here
|
| 1269 |
</pre> |
1218 |
</pre> |
| 1270 |
|
1219 |
|
| 1271 |
<p> |
1220 |
<p> |
| 1272 |
Every service not configured with a PAM file in <path>/etc/pam.d</path> will use |
1221 |
Every service not configured with a PAM file in <path>/etc/pam.d</path> will |
| 1273 |
the rules in <path>/etc/pam.d/other</path>. The defaults are set to <c>deny</c>, |
1222 |
use the rules in <path>/etc/pam.d/other</path> rule. The default settings are |
| 1274 |
as they should be. But I like to have a lot of logs, which is why I |
1223 |
set to <c>deny</c> as it should. But I like to have a lot of logs and that is |
| 1275 |
added <c>pam_warn.so</c>. The last configuration is <c>pam_limits</c>, which is |
1224 |
why I added <c>pam_warn.so</c>. The last configuration is <c>pam_limits</c> |
| 1276 |
controlled by <path>/etc/security/limits.conf</path>. See <uri link = |
1225 |
which is controlled by <path>/etc/security/limits.conf</path>. See <uri |
| 1277 |
"#limits_conf">/etc/security/limits.conf section</uri> for more on these |
1226 |
link="#doc_chap6_sect1">/etc/security/limits.conf section</uri> for more on |
| 1278 |
settings. |
1227 |
these settings. |
| 1279 |
</p> |
1228 |
</p> |
| 1280 |
|
1229 |
|
| 1281 |
<pre caption="/etc/pam.d/other"> |
1230 |
<pre caption="/etc/pam.d/other"> |
|
Lines 1299-1311
Link Here
|
| 1299 |
<body> |
1248 |
<body> |
| 1300 |
|
1249 |
|
| 1301 |
<p> |
1250 |
<p> |
| 1302 |
This is a way of controlling access to services normally run by inetd (which |
1251 |
Is a way of controlling access to services normally run by inetd (which Gentoo |
| 1303 |
Gentoo does not have), but it can also be used by xinetd and other services. |
1252 |
does not have) but it can also be used by xinetd and other services. |
| 1304 |
</p> |
1253 |
</p> |
| 1305 |
|
1254 |
|
| 1306 |
<note> |
1255 |
<note> |
| 1307 |
The service should be executing tcpd in its server argument (in xinetd). See the |
1256 |
The service should be executing tcpd in its server argument (in xinetd). See |
| 1308 |
chapter on xinetd for more information. |
1257 |
the chapter on xinetd for more information. |
| 1309 |
</note> |
1258 |
</note> |
| 1310 |
|
1259 |
|
| 1311 |
<pre caption="/etc/hosts.deny"> |
1260 |
<pre caption="/etc/hosts.deny"> |
|
Lines 1318-1337
Link Here
|
| 1318 |
</pre> |
1267 |
</pre> |
| 1319 |
|
1268 |
|
| 1320 |
<p> |
1269 |
<p> |
| 1321 |
As you can see the format is very similar to the one |
1270 |
As you can see the format is very similar to the one in |
| 1322 |
in <path>/etc/login.access</path>. Tcpd supports a specific service; it does not |
1271 |
<path>/etc/login.access</path>. Tcpd supports a specific service and they do |
| 1323 |
overlap with <path>/etc/login.access</path>. These settings only apply to |
1272 |
not work in the same area of security. These settings only apply to services |
| 1324 |
services using tcp wrappers. |
1273 |
using tcp wrappers. |
| 1325 |
</p> |
1274 |
</p> |
| 1326 |
|
1275 |
|
| 1327 |
<p> |
1276 |
<p> |
| 1328 |
It is also possible to execute commands when a service is accessed (this can be |
1277 |
It is also possible to execute commands when a service is accessed (can be |
| 1329 |
used when activating relaying for dial-in users) but it is not recommended, |
1278 |
used when activating relaying for dial in users) but its not recommended since |
| 1330 |
since people tend to create more problems than they are trying to solve. An |
1279 |
people tend to create more problems than they are trying to solve. An example |
| 1331 |
example could be that you configure a script to send an e-mail every time |
1280 |
could be that you configure a script to send an email every time someone hits |
| 1332 |
someone hits the deny rule, but then an attacker could launch a DoS attack by |
1281 |
the deny rule, but then an attacker could launch a DoS attack by keep hitting |
| 1333 |
keep hitting the deny rule. This will create a lot of I/O and e-mails so |
1282 |
the deny rule. This will create a lot of I/O and mails so don't do it!. Read |
| 1334 |
don't do it!. Read the <c>man 5 hosts_access</c> for more information. |
1283 |
the <c>man 5 hosts_access</c> for more information. |
| 1335 |
</p> |
1284 |
</p> |
| 1336 |
|
1285 |
|
| 1337 |
</body> |
1286 |
</body> |
|
Lines 1345-1376
Link Here
|
| 1345 |
<body> |
1294 |
<body> |
| 1346 |
|
1295 |
|
| 1347 |
<p> |
1296 |
<p> |
| 1348 |
The basic rule when configuring the kernel is to remove everything that you do |
1297 |
The basic rule when configuring the kernel is to remove everything, you do not |
| 1349 |
not need. This will not only create a small kernel but also remove the |
1298 |
need. This will create a small kernel but also remove the vulnerabilities that |
| 1350 |
vulnerabilities that may lie inside drivers and other features. |
1299 |
may lie inside drivers and other features. |
| 1351 |
</p> |
1300 |
</p> |
| 1352 |
|
1301 |
|
| 1353 |
<p> |
1302 |
<p> |
| 1354 |
Also consider turning off loadable module support. Even though it is possible to |
1303 |
Also consider turning off loadable module support. Even though it is possible |
| 1355 |
add root kits without this features, it does make it harder for normal attackers |
1304 |
to add modules (root kits) without this features, it does make it harder for |
| 1356 |
to install root kits via kernel modules. |
1305 |
normal attackers to install root kits via kernel modules. |
| 1357 |
</p> |
1306 |
</p> |
| 1358 |
|
1307 |
|
| 1359 |
</body> |
1308 |
</body> |
| 1360 |
</section> |
1309 |
</section> |
| 1361 |
<section> |
1310 |
<section> |
| 1362 |
<title>The proc filesystem</title> |
1311 |
<title>/proc (kernel flags)</title> |
| 1363 |
<body> |
1312 |
<body> |
| 1364 |
|
1313 |
|
| 1365 |
<p> |
1314 |
<p> |
| 1366 |
Many kernel parameters can be altered through the <path>/proc</path> file system |
1315 |
Many kernel parameters can be altered through the <path>/proc</path> file |
| 1367 |
or by using <c>sysctl</c>. |
1316 |
system or by using <c>sysctl</c>. |
| 1368 |
</p> |
1317 |
</p> |
| 1369 |
|
1318 |
|
| 1370 |
<p> |
1319 |
<p> |
| 1371 |
To dynamically change kernel parameters and variables on the fly, you need |
1320 |
To dynamically change kernel parameters and variables on the fly you need |
| 1372 |
<c>CONFIG_SYSCTL</c> defined in your kernel. This is on by default in |
1321 |
<c>CONFIG_SYSCTL</c> defined in your kernel. This is default in a standard 2.4 |
| 1373 |
a standard 2.4 kernel. |
1322 |
kernel. |
| 1374 |
</p> |
1323 |
</p> |
| 1375 |
|
1324 |
|
| 1376 |
<pre caption="Drop ping packets"> |
1325 |
<pre caption="Drop ping packets"> |
|
Lines 1378-1391
Link Here
|
| 1378 |
</pre> |
1327 |
</pre> |
| 1379 |
|
1328 |
|
| 1380 |
<p> |
1329 |
<p> |
| 1381 |
This will cause the kernel to simply ignore all ping messages (also known as |
1330 |
This will cause the kernel to simply ignore all ping messages also known as |
| 1382 |
ICMP type 0 messages). The reason for this is that an IP packet carrying an ICMP |
1331 |
ICMP type 0 messages. The reason for this is that an IP packet carrying the |
| 1383 |
message can contain a payload with information other than you think. |
1332 |
ICMP message can contain payload with other information than you think. |
| 1384 |
Administrators use ping as a diagnostic tool and often complain if it is |
1333 |
Administrators use ping as a diagnostic tool and often complain if they cannot |
| 1385 |
disabled, but there is no reason for an outsider to be able to ping. However, |
1334 |
ping. There is no reason for an outsider to be able to ping. But sometimes it |
| 1386 |
since it sometimes can be handy for insiders to be able to ping, you can disable |
1335 |
can be handy for insiders to be able to ping. Then this can be solved by |
| 1387 |
ICMP type 0 messages in the firewall (allowing local administrators to continue |
1336 |
disabling ICMP type 0 messages in the firewall. |
| 1388 |
to use this tool). |
|
|
| 1389 |
</p> |
1337 |
</p> |
| 1390 |
|
1338 |
|
| 1391 |
<pre caption="Ignore broadcast pings"> |
1339 |
<pre caption="Ignore broadcast pings"> |
|
Lines 1393-1403
Link Here
|
| 1393 |
</pre> |
1341 |
</pre> |
| 1394 |
|
1342 |
|
| 1395 |
<p> |
1343 |
<p> |
| 1396 |
This disables response to ICMP broadcasts and will prevent Smurf attacks. The |
1344 |
This disables response to ICMP broadcasts and will prevent Smurf attacks. The |
| 1397 |
Smurf attack works by sending an ICMP type 0 (ping) message to the broadcast |
1345 |
Smurf attack works by sending an ICMP type 0 (ping) message to the broadcast |
| 1398 |
address of a network. Typically the attacker will use a spoofed source |
1346 |
address of a network. Typically the attacker will use a spoofed source address. |
| 1399 |
address. All the computers on the network will respond to the ping message and |
1347 |
All the computers on the network will respond to the ping message and thereby |
| 1400 |
thereby flood the host at the spoofed source address. |
1348 |
flooding the spoofed host. |
| 1401 |
</p> |
1349 |
</p> |
| 1402 |
|
1350 |
|
| 1403 |
<pre caption="Disable source routed packets"> |
1351 |
<pre caption="Disable source routed packets"> |
|
Lines 1405-1415
Link Here
|
| 1405 |
</pre> |
1353 |
</pre> |
| 1406 |
|
1354 |
|
| 1407 |
<p> |
1355 |
<p> |
| 1408 |
Do not accept source routed packets. Attackers can use source routing to |
1356 |
Do not accept source routed packets. Attackers can use source routing to |
| 1409 |
generate traffic pretending to originate from inside your network, but that is |
1357 |
generate traffic pretending to originate from inside your network, but it is |
| 1410 |
actually routed back along the path from which it came, so attackers can |
1358 |
actually routed back along the path from which it came, so attackers can |
| 1411 |
compromise your network. Source routing is rarely used for legitimate purposes, |
1359 |
compromise your network. Source routing is rarely used for legitimate purposes |
| 1412 |
so it is safe to disable it. |
1360 |
so disable it. |
| 1413 |
</p> |
1361 |
</p> |
| 1414 |
|
1362 |
|
| 1415 |
<pre caption="Disable redirect acceptance"> |
1363 |
<pre caption="Disable redirect acceptance"> |
|
Lines 1417-1424
Link Here
|
| 1417 |
</pre> |
1365 |
</pre> |
| 1418 |
|
1366 |
|
| 1419 |
<p> |
1367 |
<p> |
| 1420 |
Do not accept ICMP redirect packets. ICMP redirects can be used to alter your |
1368 |
Disable ICMP redirect acceptance. ICMP redirects can be used to alter your |
| 1421 |
routing tables, possibly to a malicious end. |
1369 |
routing tables, possibly to a bad end. |
| 1422 |
</p> |
1370 |
</p> |
| 1423 |
|
1371 |
|
| 1424 |
<pre caption="Protect against bad error messages"> |
1372 |
<pre caption="Protect against bad error messages"> |
|
Lines 1440-1456
Link Here
|
| 1440 |
</note> |
1388 |
</note> |
| 1441 |
|
1389 |
|
| 1442 |
<p> |
1390 |
<p> |
| 1443 |
Turn on reverse path filtering. This helps make sure that packets use legitimate |
1391 |
Turn on reverse path filtering. This helps make sure that packets use |
| 1444 |
source addresses by automatically rejecting incoming packets if the routing |
1392 |
legitimate source addresses, by automatically rejecting incoming packets if |
| 1445 |
table entry for their source address does not match the network interface they |
1393 |
the routing table entry for their source address does not match the network |
| 1446 |
are arriving on. This has security advantages because it prevents IP spoofing. |
1394 |
interface they are arriving on. This has security advantages because it |
|
|
1395 |
prevents IP spoofing. |
| 1447 |
</p> |
1396 |
</p> |
| 1448 |
|
1397 |
|
| 1449 |
<warn> |
1398 |
<warn> |
| 1450 |
However turning on reverse path filtering can be a problem if you use asymmetric |
1399 |
However turning on reverse path filtering can be a problem if you use |
| 1451 |
routing (packets from you to a host take a different path than packets from that |
1400 |
asymmetric routing (packets from you to a host take a different path than |
| 1452 |
host to you) or if you operate a non-routing host which has several IP addresses |
1401 |
packets from that host to you) or if you operate a non-routing host which has |
| 1453 |
on different interfaces. |
1402 |
several IP addresses on different interfaces. |
| 1454 |
</warn> |
1403 |
</warn> |
| 1455 |
|
1404 |
|
| 1456 |
<pre caption="Log all spoofed, source routed and redirect packets"> |
1405 |
<pre caption="Log all spoofed, source routed and redirect packets"> |
|
Lines 1466-1479
Link Here
|
| 1466 |
</pre> |
1415 |
</pre> |
| 1467 |
|
1416 |
|
| 1468 |
<p> |
1417 |
<p> |
| 1469 |
Make sure that IP forwarding is turned off. We only want this for a |
1418 |
Make sure that IP forwarding is turned off. We only want this for a multi-homed |
| 1470 |
multi-homed host. |
1419 |
host. |
| 1471 |
</p> |
1420 |
</p> |
| 1472 |
|
1421 |
|
| 1473 |
<p> |
1422 |
<p> |
| 1474 |
All these settings will be reset when the machine is rebooted. I suggest that |
1423 |
All these settings will be reset when the machine is rebooted. So I suggest |
| 1475 |
you add them to <path>/etc/sysctl.conf</path>, which is automatically sourced by |
1424 |
that you add them to <path>/etc/sysctl.conf</path> which is automatically |
| 1476 |
the <path>/etc/init.d/bootmisc</path> init script. |
1425 |
sourced by the <path>/etc/init.d/bootmisc</path> init script. |
| 1477 |
</p> |
1426 |
</p> |
| 1478 |
|
1427 |
|
| 1479 |
<p> |
1428 |
<p> |
|
Lines 1497-1505
Link Here
|
| 1497 |
<body> |
1446 |
<body> |
| 1498 |
|
1447 |
|
| 1499 |
<p> |
1448 |
<p> |
| 1500 |
The patch from <uri link="http://grsecurity.net">Grsecurity</uri> is standard in |
1449 |
The patch from <uri link="http://grsecurity.net">Grsecurity</uri> is standard |
| 1501 |
the Gentoo kernel sources but is disabled by default. Configure your kernel as |
1450 |
in the Gentoo kernel sources but is disabled as default. Configure your kernel |
| 1502 |
you normally do and then configure the Grsecurity options. An in-depth |
1451 |
as you normally do and then configure the Grsecurity options. An in-depth |
| 1503 |
explanation on the available Grsecurity options (version 1.9) is available on |
1452 |
explanation on the available Grsecurity options (version 1.9) is available on |
| 1504 |
the <uri link="/proj/en/hardened">Gentoo Hardened</uri> project page. |
1453 |
the <uri link="/proj/en/hardened">Gentoo Hardened</uri> project page. |
| 1505 |
</p> |
1454 |
</p> |
|
Lines 1507-1514
Link Here
|
| 1507 |
<p> |
1456 |
<p> |
| 1508 |
Recent <c>grsec-sources</c> provide the 2.* version of Grsecurity. For more |
1457 |
Recent <c>grsec-sources</c> provide the 2.* version of Grsecurity. For more |
| 1509 |
information on this improved Grsecurity patch set, please consult the |
1458 |
information on this improved Grsecurity patch set, please consult the |
| 1510 |
documentation available on the <uri link="http://www.grsecurity.net/">Grsecurity |
1459 |
documentation available on the <uri |
| 1511 |
homepage</uri>. |
1460 |
link="http://www.grsecurity.net/">Grsecurity homepage</uri>. |
| 1512 |
</p> |
1461 |
</p> |
| 1513 |
|
1462 |
|
| 1514 |
</body> |
1463 |
</body> |
|
Lines 1518-1531
Link Here
|
| 1518 |
<body> |
1467 |
<body> |
| 1519 |
|
1468 |
|
| 1520 |
<p> |
1469 |
<p> |
| 1521 |
<uri link="http://www.Kerneli.org">Kerneli</uri> is a patch that adds encryption |
1470 |
<uri link="http://www.Kerneli.org">Kerneli</uri> is a patch that adds |
| 1522 |
to the existing kernel. By patching your kernel you will get new options such as |
1471 |
encryption to the existing kernel. By patching your kernel you will get new |
| 1523 |
cryptographic ciphers, digest algorithms and cryptographic loop filters. |
1472 |
options like: Cryptographic ciphers, digest algorithms and cryptographic loop |
|
|
1473 |
filters. |
| 1524 |
</p> |
1474 |
</p> |
| 1525 |
|
1475 |
|
| 1526 |
<warn> |
1476 |
<warn> |
| 1527 |
The kerneli patch is currently not in a stable version for the latest kernel, so |
1477 |
The kerneli patch is currently not in a stable version for the latest kernel, |
| 1528 |
be careful when using it. |
1478 |
so be careful when using it. |
| 1529 |
</warn> |
1479 |
</warn> |
| 1530 |
|
1480 |
|
| 1531 |
</body> |
1481 |
</body> |
|
Lines 1545-1551
Link Here
|
| 1545 |
</ul> |
1495 |
</ul> |
| 1546 |
|
1496 |
|
| 1547 |
<p> |
1497 |
<p> |
| 1548 |
And there are probably a lot more. |
1498 |
And there is probably a lot more. |
| 1549 |
</p> |
1499 |
</p> |
| 1550 |
|
1500 |
|
| 1551 |
</body> |
1501 |
</body> |
|
Lines 1559-1574
Link Here
|
| 1559 |
<body> |
1509 |
<body> |
| 1560 |
|
1510 |
|
| 1561 |
<p> |
1511 |
<p> |
| 1562 |
Apache (1.3.26) comes with a pretty decent configuration file but again, we need |
1512 |
Apache (1.3.26) comes with a pretty decent configuration file but again. We |
| 1563 |
to improve some things, like binding Apache to one address and preventing it |
1513 |
need to improve some things, like binding to one address and keep it from |
| 1564 |
from leaking information. Below are the options that you should apply the |
1514 |
leaking information. These are the options that you should apply the |
| 1565 |
configuration file. |
1515 |
configuration file: |
| 1566 |
</p> |
1516 |
</p> |
| 1567 |
|
1517 |
|
| 1568 |
<p> |
1518 |
<p> |
| 1569 |
If you did not disable <c>ssl</c> in your <path>/etc/make.conf</path> before |
1519 |
If you did not disable <c>ssl</c> in your <path>/etc/make.conf</path> before |
| 1570 |
installing Apache, you should have access to an ssl enabled server. Just add the |
1520 |
installing apache, you should have access to a ssl enabled server. Just add |
| 1571 |
following line to enable it. |
1521 |
the following line to enable it. |
| 1572 |
</p> |
1522 |
</p> |
| 1573 |
|
1523 |
|
| 1574 |
<pre caption="/etc/conf.d/apache"> |
1524 |
<pre caption="/etc/conf.d/apache"> |
|
Lines 1591-1604
Link Here
|
| 1591 |
|
1541 |
|
| 1592 |
<p> |
1542 |
<p> |
| 1593 |
Apache is compiled with <c>--enable-shared=max</c> and |
1543 |
Apache is compiled with <c>--enable-shared=max</c> and |
| 1594 |
<c>--enable-module=all</c>. This will by default enable all modules, so you |
1544 |
<c>--enable-module=all</c>. This will per default enable all modules so you |
| 1595 |
should comment out all modules in the <c>LoadModule</c> section |
1545 |
should comment out all modules in the <c>LoadModule</c> section |
| 1596 |
(<c>LoadModule</c> and <c>AddModule</c>) that you do not use. Restart the |
1546 |
(<c>LoadModule</c> and <c>AddModule</c>) that you do not use. Restart the |
| 1597 |
service by executing <c>/etc/init.d/apache restart</c>. |
1547 |
service by executing <c>/etc/init.d/apache restart</c>. |
| 1598 |
</p> |
1548 |
</p> |
| 1599 |
|
1549 |
|
| 1600 |
<p> |
1550 |
<p> |
| 1601 |
Documentation is available at <uri>http://www.apache.org</uri>. |
1551 |
One can find documentation at <uri>http://www.apache.org</uri>. |
| 1602 |
</p> |
1552 |
</p> |
| 1603 |
|
1553 |
|
| 1604 |
</body> |
1554 |
</body> |
|
Lines 1611-1627
Link Here
|
| 1611 |
<p> |
1561 |
<p> |
| 1612 |
One can find documentation at the <uri |
1562 |
One can find documentation at the <uri |
| 1613 |
link="http://www.isc.org/products/BIND/bind9.html">Internet Software |
1563 |
link="http://www.isc.org/products/BIND/bind9.html">Internet Software |
| 1614 |
Consortium</uri>. The BIND 9 Administrator Reference Manual is also in |
1564 |
Consortium</uri> the BIND 9 Administrator Reference Manual is also in |
| 1615 |
the <path>doc/arm</path>. |
1565 |
the <path>doc/arm</path>. |
| 1616 |
</p> |
1566 |
</p> |
| 1617 |
|
1567 |
|
| 1618 |
<p> |
1568 |
<p> |
| 1619 |
The newer BIND ebuilds support chrooting out of the box. After |
1569 |
The newer BIND ebuilds support chrooting out of the box. After emerging <c>bind</c> follow these simple instructions: |
| 1620 |
emerging <c>bind</c> follow these simple instructions: |
|
|
| 1621 |
</p> |
1570 |
</p> |
| 1622 |
<pre caption="Chrooting BIND"> |
1571 |
<pre caption="Chrooting BIND"> |
| 1623 |
ebuild /var/db/pkg/net-dns/bind-9.2.2-r2/bind-9.2.2-r2.ebuild config\`" |
1572 |
ebuild /var/db/pkg/net-dns/bind-9.2.2-r2/bind-9.2.2-r2.ebuild config\`" |
| 1624 |
<codenote>Before running the above command you might want to change the chroot |
1573 |
<codenote>Before running the above command you might want to change the chroot |
| 1625 |
directory in /etc/conf.d/named. Otherwise /chroot/dns will be used.</codenote> |
1574 |
directory in /etc/conf.d/named. Otherwise /chroot/dns will be used.</codenote> |
| 1626 |
<codenote>You might need to substitute the version number with the current version number </codenote> |
1575 |
<codenote>You might need to substitute the version number with the current version number </codenote> |
| 1627 |
</pre> |
1576 |
</pre> |
|
Lines 1632-1641
Link Here
|
| 1632 |
<body> |
1581 |
<body> |
| 1633 |
|
1582 |
|
| 1634 |
<p> |
1583 |
<p> |
| 1635 |
Djbdns is a DNS implementation on the security of which its author is willing to |
1584 |
Djbdns is a DNS implementation of which the author is willing to bet |
| 1636 |
bet <uri link="http://cr.yp.to/djbdns/guarantee.html">money</uri>. It is very |
1585 |
<uri link="http://cr.yp.to/djbdns/guarantee.html">money</uri> on how |
| 1637 |
different from how Bind 9 works but worth a try. More information can be |
1586 |
secure it is. It is very different from how Bind 9 works but worth a try. |
| 1638 |
obtained from <uri>http://www.djbdns.org</uri>. |
1587 |
More information can be obtained from <uri>http://www.djbdns.org</uri>. |
| 1639 |
</p> |
1588 |
</p> |
| 1640 |
|
1589 |
|
| 1641 |
</body> |
1590 |
</body> |
|
Lines 1646-1657
Link Here
|
| 1646 |
<body> |
1595 |
<body> |
| 1647 |
|
1596 |
|
| 1648 |
<p> |
1597 |
<p> |
| 1649 |
Generally, using FTP (File Transfer Protocol) is a bad idea. It uses unencrypted |
1598 |
Generally, using the FTP (File Transfer Protocol) is a bad idea. It uses |
| 1650 |
data (ie. passwords are sent in clear text), listens on 2 ports (normally port |
1599 |
unencrypted data, listens on 2 ports (normally port 20 and 21), and anonymous |
| 1651 |
20 and 21), and attackers are frequently looking for anonymous logins for |
1600 |
logins that are what attackers are looking for (for trading warez). Since the |
| 1652 |
trading warez. Since the FTP protocol contains several security problems you |
1601 |
FTP protocol contains several security problems (ie. passwords are sent in clear text), you should rather use |
| 1653 |
should instead use <c>sftp</c> or HTTP. If this is not possible, secure your |
1602 |
<c>sftp</c> or HTTP instead. If not, secure your services as good as you |
| 1654 |
services as well as you can and prepare yourself. |
1603 |
can and prepare yourself. |
| 1655 |
</p> |
1604 |
</p> |
| 1656 |
|
1605 |
|
| 1657 |
</body> |
1606 |
</body> |
|
Lines 1661-1677
Link Here
|
| 1661 |
<body> |
1610 |
<body> |
| 1662 |
|
1611 |
|
| 1663 |
<p> |
1612 |
<p> |
| 1664 |
If you only need local applications to access the <c>mysql</c> database, |
1613 |
If you only need local applications to access the <c>mysql</c> database uncomment the following line. |
| 1665 |
uncomment the following line. |
|
|
| 1666 |
</p> |
1614 |
</p> |
| 1667 |
<pre caption="Disable network access"> |
1615 |
<pre caption="Disable network access"> |
| 1668 |
skip-networking |
1616 |
skip-networking |
| 1669 |
</pre> |
1617 |
</pre> |
| 1670 |
|
1618 |
|
| 1671 |
<p> |
1619 |
<p> |
| 1672 |
Then we disable the use of the LOAD DATA LOCAL INFILE command. This is to |
1620 |
Disable the command <c>LOAD DATA LOCAL INFILE</c>. |
| 1673 |
prevent against unauthorized reading from local files. This is relevant when new |
|
|
| 1674 |
SQL Injection vulnerabilities in PHP applications are found. |
| 1675 |
</p> |
1621 |
</p> |
| 1676 |
|
1622 |
|
| 1677 |
<pre caption="Disable LOAD DATA LOCAL INFILE in the [mysqld] section"> |
1623 |
<pre caption="Disable LOAD DATA LOCAL INFILE in the [mysqld] section"> |
|
Lines 1679-1686
Link Here
|
| 1679 |
</pre> |
1625 |
</pre> |
| 1680 |
|
1626 |
|
| 1681 |
<p> |
1627 |
<p> |
| 1682 |
Next, we must remove the sample database (test) and all accounts except the |
1628 |
The default <c>mysql</c> installation comes with an empty <c>root</c> password. |
| 1683 |
local <c>root</c> account. |
1629 |
</p> |
|
|
1630 |
|
| 1631 |
<pre caption="Set root password"> |
| 1632 |
<i>/usr/local/mysql/bin/mysql -u root</i> |
| 1633 |
mysql> <i>SET PASSWORD FOR root@localhost=PASSWORD('new_password');</i> |
| 1634 |
</pre> |
| 1635 |
<note> |
| 1636 |
|
| 1637 |
It is good practice not to change passwords from the command line, for example, |
| 1638 |
by using the <c>mysqladmin password</c> command. This is especially important when other |
| 1639 |
users work on the server. In that case the password could be easily revealed, e.g. |
| 1640 |
by using the <c>ps aux</c> command or reviewing history files (<path>~/.history</path>, |
| 1641 |
<path>~/.bash_history</path> etc), when improper access rights are set to them. |
| 1642 |
</note> |
| 1643 |
|
| 1644 |
<p> |
| 1645 |
Next, we must remove the sample database (test) and all accounts except the local <c>root</c> account. |
| 1684 |
</p> |
1646 |
</p> |
| 1685 |
|
1647 |
|
| 1686 |
<pre caption="Removing sample database and all unnecessary users"> |
1648 |
<pre caption="Removing sample database and all unnecessary users"> |
|
Lines 1692-1705
Link Here
|
| 1692 |
</pre> |
1654 |
</pre> |
| 1693 |
|
1655 |
|
| 1694 |
<warn> |
1656 |
<warn> |
|
|
1657 |
|
| 1695 |
Be careful with the above if you have already configured user accounts. |
1658 |
Be careful with the above if you have already configured user accounts. |
| 1696 |
</warn> |
1659 |
</warn> |
| 1697 |
<note> |
|
|
| 1698 |
If you have been changing passwords from the MySQL prompt, you should always |
| 1699 |
clean out <path>~/.mysql_history</path> and |
| 1700 |
<path>/var/log/mysql/mysql.log</path> as they store the executed SQL |
| 1701 |
commands with passwords in clear text. |
| 1702 |
</note> |
| 1703 |
</body> |
1660 |
</body> |
| 1704 |
</section> |
1661 |
</section> |
| 1705 |
<section> |
1662 |
<section> |
|
Lines 1707-1714
Link Here
|
| 1707 |
<body> |
1664 |
<body> |
| 1708 |
|
1665 |
|
| 1709 |
<p> |
1666 |
<p> |
| 1710 |
Proftpd has had several security problems, but most of them seem to have been |
1667 |
Proftpd has had several security problems, but they seem to have fixed most of |
| 1711 |
fixed. Nonetheless, it is a good idea to apply some enhancements: |
1668 |
them. Still apply some enhancements: |
| 1712 |
</p> |
1669 |
</p> |
| 1713 |
|
1670 |
|
| 1714 |
<pre caption="/etc/proftpd/proftpd.conf"> |
1671 |
<pre caption="/etc/proftpd/proftpd.conf"> |
|
Lines 1760-1772
Link Here
|
| 1760 |
<body> |
1717 |
<body> |
| 1761 |
|
1718 |
|
| 1762 |
<p> |
1719 |
<p> |
| 1763 |
Pure-ftpd is an branch of the original trollftpd, modified for security reasons |
1720 |
Pure-ftpd is an branch of the original trollftpd. Modified for security reasons |
| 1764 |
and functionality by Frank Dennis. |
1721 |
and functionality by Frank Dennis. |
| 1765 |
</p> |
1722 |
</p> |
| 1766 |
|
1723 |
|
| 1767 |
<p> |
1724 |
<p> |
| 1768 |
Use virtual users (never system accounts) by enabling the <c>AUTH</c> option. |
1725 |
Use virtual users (never system accounts) by enabling the <c>AUTH</c> option. |
| 1769 |
Set this to <c>-lpuredb:/etc/pureftpd.pdb</c> and create your users by using |
1726 |
Set it to <c>-lpuredb:/etc/pureftpd.pdb</c> and create your users by using |
| 1770 |
<c>/usr/bin/pure-pw</c>. |
1727 |
<c>/usr/bin/pure-pw</c>. |
| 1771 |
</p> |
1728 |
</p> |
| 1772 |
|
1729 |
|
|
Lines 1778-1791
Link Here
|
| 1778 |
</pre> |
1735 |
</pre> |
| 1779 |
|
1736 |
|
| 1780 |
<p> |
1737 |
<p> |
| 1781 |
Configure your <c>MISC_OTHER</c> setting to deny anonymous logins (<c>-E</c>), |
1738 |
And configure your <c>MISC_OTHER</c> setting for not allowing anonymous |
| 1782 |
chroot everyone (<c>-A</c>), prevent users from reading or writing to files |
1739 |
(<c>-E</c>), chroot everyone (<c>-A</c>), Users can not read or write to files |
| 1783 |
beginning with a . (dot) (<c>-X</c>), max idle time (<c>-I</c>), limit recursion |
1740 |
beginning with a . (dot) (<c>-X</c>), max idle time (<c>-I</c>), limit recursion |
| 1784 |
(<c>-L</c>), and a reasonable <c>umask</c>. |
1741 |
(<c>-L</c>), and a reasonable <c>umask</c>. |
| 1785 |
</p> |
1742 |
</p> |
| 1786 |
|
1743 |
|
| 1787 |
<warn> |
1744 |
<warn> |
| 1788 |
Do <e>not</e> use the <c>-w</c> or <c>-W</c> options! If you want to have a |
1745 |
Do <e>not</e> use the <c>-w</c> or <c>-W</c> options! If you want to have a |
| 1789 |
warez site, stop reading this guide! |
1746 |
warez site, stop reading this guide! |
| 1790 |
</warn> |
1747 |
</warn> |
| 1791 |
|
1748 |
|
|
Lines 1796-1847
Link Here
|
| 1796 |
</body> |
1753 |
</body> |
| 1797 |
</section> |
1754 |
</section> |
| 1798 |
<section> |
1755 |
<section> |
| 1799 |
<title>Vsftpd</title> |
|
|
| 1800 |
<body> |
| 1801 |
|
| 1802 |
<p> |
| 1803 |
Vsftpd (short for very secure ftp) is a small ftp daemon running a reasonably |
| 1804 |
default configuration. It is simple and does not have as many features (like |
| 1805 |
virtual users) as pureftp and proftp. |
| 1806 |
</p> |
| 1807 |
|
| 1808 |
<pre caption="/etc/vsftpd"> |
| 1809 |
anonymous_enable=NO |
| 1810 |
local_enable=YES |
| 1811 |
|
| 1812 |
#read only |
| 1813 |
write_enable=NO |
| 1814 |
|
| 1815 |
#enable logging of transfers |
| 1816 |
xferlog_std_format=YES |
| 1817 |
|
| 1818 |
idle_session_timeout=20 |
| 1819 |
data_connection_timeout=20 |
| 1820 |
nopriv_user=nobody |
| 1821 |
|
| 1822 |
chroot_list_enable=YES |
| 1823 |
chroot_list_file=/etc/vsftpd/chrootlist |
| 1824 |
|
| 1825 |
ls_recurse_enable=NO |
| 1826 |
</pre> |
| 1827 |
|
| 1828 |
<p> |
| 1829 |
As you can see, there is no way for this service to have individual permissions |
| 1830 |
and no default chroot action. But when it comes to anonymous settings it is |
| 1831 |
quite good. Sometimes it can be nice to have an anonymous ftp server (for |
| 1832 |
sharing open source), and vsftpd does a really good job at this. |
| 1833 |
</p> |
| 1834 |
|
| 1835 |
</body> |
| 1836 |
</section> |
| 1837 |
<section> |
| 1838 |
<title>Qmail</title> |
1756 |
<title>Qmail</title> |
| 1839 |
<body> |
1757 |
<body> |
| 1840 |
|
1758 |
|
| 1841 |
<p> |
1759 |
<p> |
| 1842 |
Qmail is often considered to be a very secure mail server. It is written with |
1760 |
Qmail is considered to be the most secure mail server. It is written with |
| 1843 |
security (and paranoia) in mind. It does not allow relaying by default and has |
1761 |
security (and paranoia) in mind. It does not allow relaying per default and |
| 1844 |
not had a security hole since 1996. Simply <c>emerge qmail</c> and go configure! |
1762 |
have not had a security hole since 1996. Simply <c>emerge qmail</c> and go |
|
|
1763 |
configure! |
| 1845 |
</p> |
1764 |
</p> |
| 1846 |
</body> |
1765 |
</body> |
| 1847 |
</section> |
1766 |
</section> |
|
Lines 1850-1857
Link Here
|
| 1850 |
<body> |
1769 |
<body> |
| 1851 |
|
1770 |
|
| 1852 |
<p> |
1771 |
<p> |
| 1853 |
Samba is a protocol to share files with Microsoft/Novell networks and it |
1772 |
Samba is a protocol to share files with Microsoft/Novell networks and it |
| 1854 |
should <e>not</e> be used over the Internet. Nonetheless, it still needs |
1773 |
should <e>not</e> be used over the Internet. But nevertheless it needs |
| 1855 |
securing. |
1774 |
securing. |
| 1856 |
</p> |
1775 |
</p> |
| 1857 |
|
1776 |
|
|
Lines 1870-1876
Link Here
|
| 1870 |
#Enables user authentication |
1789 |
#Enables user authentication |
| 1871 |
#(don't use the share mode) |
1790 |
#(don't use the share mode) |
| 1872 |
security = user |
1791 |
security = user |
| 1873 |
|
1792 |
|
| 1874 |
#Disallow privileged accounts |
1793 |
#Disallow privileged accounts |
| 1875 |
invalid users = root @wheel |
1794 |
invalid users = root @wheel |
| 1876 |
|
1795 |
|
|
Lines 1887-1900
Link Here
|
| 1887 |
</pre> |
1806 |
</pre> |
| 1888 |
|
1807 |
|
| 1889 |
<p> |
1808 |
<p> |
| 1890 |
Make sure that permissions are set correct on every share and remember to read |
1809 |
Make sure that permissions are set correct on every share and remember to read |
| 1891 |
the <uri link="http://www.samba.org">documentation</uri>. |
1810 |
the <uri link="http://www.samba.org">documentation</uri>. |
| 1892 |
</p> |
1811 |
</p> |
| 1893 |
|
1812 |
|
| 1894 |
<p> |
1813 |
<p> |
| 1895 |
Now restart the server and add the users who should have access to this |
1814 |
Now restart the server and add the users who should have access to this |
| 1896 |
service. This is done though the command <path>/usr/bin/smbpasswd</path> with |
1815 |
service. This is done though the <path>/usr/bin/smbpasswd</path> with the |
| 1897 |
the parameter <c>-a</c>. |
1816 |
parameter -a |
| 1898 |
</p> |
1817 |
</p> |
| 1899 |
|
1818 |
|
| 1900 |
</body> |
1819 |
</body> |
|
Lines 1904-1914
Link Here
|
| 1904 |
<body> |
1823 |
<body> |
| 1905 |
|
1824 |
|
| 1906 |
<p> |
1825 |
<p> |
| 1907 |
The only securing that OpenSSH needs is turning on a stronger authentication |
1826 |
The only securing that OpenSSH needs is turning on a stronger authentication |
| 1908 |
based on public key encryption. Too many sites (like |
1827 |
based on public key encryption. Too many sites (like |
| 1909 |
<uri>http://www.sourceforge.net</uri>, <uri>http://www.php.net</uri> and |
1828 |
<uri>http://www.sourceforge.net</uri>, <uri>http://www.php.net</uri> and |
| 1910 |
<uri>http://www.apache.org</uri>) have suffered unauthorized intrusion |
1829 |
<uri>http://www.apache.org</uri>) have all suffered unauthorized intrusion to |
| 1911 |
due to password leaks or bad passwords. |
1830 |
their systems due to password leaks or bad passwords. |
| 1912 |
</p> |
1831 |
</p> |
| 1913 |
|
1832 |
|
| 1914 |
<pre caption="/etc/ssh/sshd_config"> |
1833 |
<pre caption="/etc/ssh/sshd_config"> |
|
Lines 1943-1950
Link Here
|
| 1943 |
</pre> |
1862 |
</pre> |
| 1944 |
|
1863 |
|
| 1945 |
<p> |
1864 |
<p> |
| 1946 |
Now all that your users have to do is create a key (on the machine |
1865 |
Now all that your users have to do, is create a key (on their machine they want |
| 1947 |
they want to login from) with the following command: |
1866 |
to login from) with the following command |
| 1948 |
</p> |
1867 |
</p> |
| 1949 |
|
1868 |
|
| 1950 |
<pre caption="Create a DSA keypair"> |
1869 |
<pre caption="Create a DSA keypair"> |
|
Lines 1952-1958
Link Here
|
| 1952 |
</pre> |
1871 |
</pre> |
| 1953 |
|
1872 |
|
| 1954 |
<p> |
1873 |
<p> |
| 1955 |
And type in a passphrase. |
1874 |
And type in a passphrase |
| 1956 |
</p> |
1875 |
</p> |
| 1957 |
|
1876 |
|
| 1958 |
<pre caption="Output of ssh-keygen"> |
1877 |
<pre caption="Output of ssh-keygen"> |
|
Lines 1970-1990
Link Here
|
| 1970 |
<p> |
1889 |
<p> |
| 1971 |
This will add two files in your <path>~/.ssh/</path> directory called |
1890 |
This will add two files in your <path>~/.ssh/</path> directory called |
| 1972 |
<path>id_dsa</path> and <path>id_dsa.pub</path>. The file called |
1891 |
<path>id_dsa</path> and <path>id_dsa.pub</path>. The file called |
| 1973 |
<path>id_dsa</path> is your private key and should be kept from other people |
1892 |
<path>id_dsa</path> is your private key and should be kept from other people |
| 1974 |
than yourself. The other file <path>id_dsa.pub</path> is to be distributed to |
1893 |
than yourself. The other file <path>id_dsa.pub</path> is to be distributed to |
| 1975 |
every server that you have access to. Add the key to the users home directory |
1894 |
every server that you have access to. Add the key to the users home directory |
| 1976 |
in <path>~/.ssh/authorized_keys</path> and the user should be able to login. |
1895 |
in <path>~/.ssh/authorized_keys</path> and the user should be able to login. |
| 1977 |
</p> |
1896 |
</p> |
| 1978 |
|
1897 |
|
| 1979 |
<p> |
1898 |
<p> |
| 1980 |
Now your users should guard this private key well. Put it on a media that they |
1899 |
Now your users should guard this private key well. Put it on a media that they |
| 1981 |
always carry with them or keep it on their workstation (put this in the <uri |
1900 |
always carry with them or keep it on their workstation (put this in the <uri |
| 1982 |
link="#security_policies">password</uri> policy). |
1901 |
link="#doc_chap2_sect5">password</uri> policy). |
| 1983 |
</p> |
1902 |
</p> |
| 1984 |
|
1903 |
|
| 1985 |
<p> |
1904 |
<p> |
| 1986 |
For more information go to the <uri |
1905 |
For more information go to the <uri link="http://www.openssh.org">OpenSSH</uri> |
| 1987 |
link="http://www.openssh.org">OpenSSH</uri> website. |
1906 |
website. |
| 1988 |
</p> |
1907 |
</p> |
| 1989 |
|
1908 |
|
| 1990 |
</body> |
1909 |
</body> |
|
Lines 1994-2011
Link Here
|
| 1994 |
<body> |
1913 |
<body> |
| 1995 |
|
1914 |
|
| 1996 |
<p> |
1915 |
<p> |
| 1997 |
<c>xinetd</c> is a replacement for <c>inetd</c> (which Gentoo does not have), |
1916 |
xinetd is a replacement for inetd (which Gentoo does not have), the internet |
| 1998 |
the internet services daemon. It supports access control based on the address of |
1917 |
services daemon. It supports access control based on the address of the remote |
| 1999 |
the remote host and the time of access. It also provides extensive logging |
1918 |
host and the time of access. It also provide extensive logging capabilities, |
| 2000 |
capabilities, including server start time, remote host address, remote user |
1919 |
including server start time, remote host address, remote user name, server run |
| 2001 |
name, server run time, and actions requested. |
1920 |
time, and actions requested. |
| 2002 |
</p> |
1921 |
</p> |
| 2003 |
|
1922 |
|
| 2004 |
<p> |
1923 |
<p> |
| 2005 |
As with all other services it is important to have a good default configuration. |
1924 |
As with all other services it is important to have a good default configuration. |
| 2006 |
But since <c>xinetd</c> is run as root and supports protocols that you might not |
1925 |
But since <c>xinetd</c> is run as root and supports protocols that you might |
| 2007 |
know how work, we recommend not to use it. But if you still insist on using it, |
1926 |
not know how work we recommend not to use it. But if you want to use it anyway |
| 2008 |
here we will show you how to add some security to it: |
1927 |
here how you can add some security to it: |
| 2009 |
</p> |
1928 |
</p> |
| 2010 |
|
1929 |
|
| 2011 |
<pre caption="Install xinetd"> |
1930 |
<pre caption="Install xinetd"> |
|
Lines 2019-2030
Link Here
|
| 2019 |
<pre caption="/etc/xinetd.conf"> |
1938 |
<pre caption="/etc/xinetd.conf"> |
| 2020 |
defaults |
1939 |
defaults |
| 2021 |
{ |
1940 |
{ |
| 2022 |
only_from = localhost |
1941 |
only_from = localhost |
| 2023 |
instances = 10 |
1942 |
instances = 10 |
| 2024 |
log_type = SYSLOG authpriv info |
1943 |
log_type = SYSLOG authpriv info |
| 2025 |
log_on_success = HOST PID |
1944 |
log_on_success = HOST PID |
| 2026 |
log_on_failure = HOST |
1945 |
log_on_failure = HOST |
| 2027 |
cps = 25 30 |
1946 |
cps = 25 30 |
| 2028 |
} |
1947 |
} |
| 2029 |
|
1948 |
|
| 2030 |
# This will setup pserver (cvs) via xinetd with the following settings: |
1949 |
# This will setup pserver (cvs) via xinetd with the following settings: |
|
Lines 2041-2077
Link Here
|
| 2041 |
# it in case of it should be disabled |
1960 |
# it in case of it should be disabled |
| 2042 |
service cvspserver |
1961 |
service cvspserver |
| 2043 |
{ |
1962 |
{ |
| 2044 |
socket_type = stream |
1963 |
socket_type = stream |
| 2045 |
protocol = tcp |
1964 |
protocol = tcp |
| 2046 |
instances = 10 |
1965 |
instances = 10 |
| 2047 |
protocol = tcp |
1966 |
protocol = tcp |
| 2048 |
wait = no |
1967 |
wait = no |
| 2049 |
user = cvs |
1968 |
user = cvs |
| 2050 |
bind = 10.0.0.2 |
1969 |
bind = 10.0.0.2 |
| 2051 |
only_from = 10.0.0.0 |
1970 |
only_from = 10.0.0.0 |
| 2052 |
access_times = 8:00-17:00 |
1971 |
access_times = 8:00-17:00 |
| 2053 |
server = /usr/sbin/tcpd |
1972 |
server = /usr/sbin/tcpd |
| 2054 |
server_args = /usr/bin/cvs --allow-root=/mnt/cvsdisk/cvsroot pserver |
1973 |
server_args = /usr/bin/cvs --allow-root=/mnt/cvsdisk/cvsroot pserver |
| 2055 |
max_load = 1.0 |
1974 |
max_load = 1.0 |
| 2056 |
log_on_failure += RECORD |
1975 |
log_on_failure += RECORD |
| 2057 |
disable = no |
1976 |
disable = no |
| 2058 |
} |
1977 |
} |
| 2059 |
</pre> |
1978 |
</pre> |
| 2060 |
|
1979 |
|
| 2061 |
<p> |
1980 |
<p> |
| 2062 |
For more information read <c>man 5 xinetd.conf</c>. |
1981 |
For more information read the <c>man 5 xinetd.conf</c>. |
| 2063 |
</p> |
1982 |
</p> |
| 2064 |
|
1983 |
|
| 2065 |
</body> |
1984 |
</body> |
| 2066 |
</section> |
1985 |
</section> |
|
|
1986 |
<section> |
| 1987 |
<title>Vsftpd</title> |
| 1988 |
<body> |
| 1989 |
|
| 1990 |
<p> |
| 1991 |
Vsftpd (short for very secure ftp) is a small ftp daemon running a reasonably |
| 1992 |
default configuration. It is simple and does not have as many features (like |
| 1993 |
virtual users) as pureftp and proftp. |
| 1994 |
</p> |
| 1995 |
|
| 1996 |
<pre caption="/etc/vsftpd"> |
| 1997 |
anonymous_enable=NO |
| 1998 |
local_enable=YES |
| 1999 |
|
| 2000 |
#read only |
| 2001 |
write_enable=NO |
| 2002 |
|
| 2003 |
#enable logging of transfers |
| 2004 |
xferlog_std_format=YES |
| 2005 |
|
| 2006 |
idle_session_timeout=20 |
| 2007 |
data_connection_timeout=20 |
| 2008 |
nopriv_user=nobody |
| 2009 |
|
| 2010 |
chroot_list_enable=YES |
| 2011 |
chroot_list_file=/etc/vsftpd/chrootlist |
| 2012 |
|
| 2013 |
ls_recurse_enable=NO |
| 2014 |
</pre> |
| 2067 |
|
2015 |
|
|
|
2016 |
<p> |
| 2017 |
As you can see there is no way for this service to have individual permissions |
| 2018 |
and no default chroot action. But when it comes to anonymous settings it is |
| 2019 |
quite good. Sometimes it can be nice to have a anonymous ftp server (for |
| 2020 |
sharing open source) and vsftpd does a really good job at this. |
| 2021 |
</p> |
| 2022 |
|
| 2023 |
</body> |
| 2024 |
</section> |
| 2068 |
<section> |
2025 |
<section> |
| 2069 |
<title>X</title> |
2026 |
<title>X</title> |
| 2070 |
<body> |
2027 |
<body> |
| 2071 |
|
2028 |
|
| 2072 |
<p> |
2029 |
<p> |
| 2073 |
By default XFree is configured to act as a Xserver. This can be dangerous since |
2030 |
Per default XFree is configured to act as a Xserver. This can be dangerous |
| 2074 |
X uses unencrypted TCP connections and listens for xclients. |
2031 |
since X uses unencrypted TCP connections and listens for xclients. |
| 2075 |
</p> |
2032 |
</p> |
| 2076 |
|
2033 |
|
| 2077 |
<impo> |
2034 |
<impo> |
|
Lines 2080-2103
Link Here
|
| 2080 |
|
2037 |
|
| 2081 |
<p> |
2038 |
<p> |
| 2082 |
But if you depend on using your workstation as a Xserver use the |
2039 |
But if you depend on using your workstation as a Xserver use the |
| 2083 |
<c>/usr/X11R6/bin/xhost</c> command with caution. This command allows clients |
2040 |
<c>/usr/X11R6/bin/xhost</c> command with caution. This command allows clients |
| 2084 |
from other hosts to connect and use your display. This can be handy if you need |
2041 |
from other hosts to connect and use your display. This can become handy if you |
| 2085 |
an X application from a different machine and the only way is through the |
2042 |
need an X application from a different machine and the only way is through the |
| 2086 |
network, but it can also be exploited by an attacker.The syntax of this command |
2043 |
network. The syntax is <c>/usr/X11R6/bin/xhost +hostname</c> |
| 2087 |
is <c>/usr/X11R6/bin/xhost +hostname</c> |
|
|
| 2088 |
</p> |
2044 |
</p> |
| 2089 |
|
2045 |
|
| 2090 |
<warn> |
2046 |
<warn> |
| 2091 |
Do not ever use the <c>xhost +</c>feature! This will allow any client to connect |
2047 |
Do not ever use the <c>xhost +</c>feature! This will allow any client to |
| 2092 |
and take control of your X. If an attacker can get access to your X, he can log |
2048 |
connect and take control of your X. If an attacker can get access to your X, |
| 2093 |
your keystrokes and take control your desktop. If you have to use it always |
2049 |
he can log your keystrokes and control your desktop. If you have to use it |
| 2094 |
remeber to specify a host. |
2050 |
always remeber to specify a host. |
| 2095 |
</warn> |
2051 |
</warn> |
| 2096 |
|
2052 |
|
| 2097 |
<p> |
2053 |
<p> |
| 2098 |
A more secure solution is to disable this feature completely by starting X |
2054 |
A more secure solution is to disable this feature completely by starting X with |
| 2099 |
with <c>startx -- -nolisten tcp</c> or disable it permanently in the |
2055 |
<c>startx -- -nolisten tcp</c> or disable it permanently in the configuration. |
| 2100 |
configuration. |
|
|
| 2101 |
</p> |
2056 |
</p> |
| 2102 |
|
2057 |
|
| 2103 |
<pre caption="/usr/X11R6/bin/startx"> |
2058 |
<pre caption="/usr/X11R6/bin/startx"> |
|
Lines 2105-2112
Link Here
|
| 2105 |
</pre> |
2060 |
</pre> |
| 2106 |
|
2061 |
|
| 2107 |
<p> |
2062 |
<p> |
| 2108 |
To make sure that <path>startx</path> does not get overwritten when emerging a |
2063 |
To make sure that <path>startx</path> does not get overwritten when emerging |
| 2109 |
new version of XFree you must protect it. Add the following line to |
2064 |
a new version of XFree you must protect it. Add the following line to |
| 2110 |
<path>/etc/make.conf</path>: |
2065 |
<path>/etc/make.conf</path>: |
| 2111 |
</p> |
2066 |
</p> |
| 2112 |
|
2067 |
|
|
Lines 2146-2185
Link Here
|
| 2146 |
<body> |
2101 |
<body> |
| 2147 |
|
2102 |
|
| 2148 |
<p> |
2103 |
<p> |
| 2149 |
Chrooting a service is a way of limiting the service (or user) filesystem to a |
2104 |
Chrooting a service is a way of limiting a service (or user) environment to |
| 2150 |
subset of the real filesystem tree (<c>chroot</c> stands for "change root", |
2105 |
only accessing what it should and not gaining access (or information) that |
| 2151 |
since it changes the filesystem root to an arbitrary point on the |
2106 |
could lead to root access. By running the service as another user than <c>root</c> |
| 2152 |
filesystem). And by running the service as another user |
2107 |
(<c>nobody</c>, <c>apache</c>, <c>named</c>) an attacker can only access files with the permissions |
| 2153 |
(ie. <c>nobody</c>, <c>apache</c>, <c>named</c>), an attacker can only access |
2108 |
of this user. This means that an attacker cannot gain <c>root</c> access even if the |
| 2154 |
files and execute commands with the permissions for this user. This means that |
2109 |
services has a security flaw. |
| 2155 |
an attacker cannot gain root access even if the services has a security flaw. |
|
|
| 2156 |
</p> |
2110 |
</p> |
| 2157 |
|
2111 |
|
| 2158 |
<p> |
2112 |
<p> |
| 2159 |
Some services like <c>pure-ftpd</c> and <c>bind</c> have features for chrooting, |
2113 |
Some services like <c>pure-ftpd</c> and <c>bind</c> have features for chrooting, and other |
| 2160 |
and other services do not. If the service supports it, use it, otherwise you |
2114 |
services do not. If the service supports it, use it, otherwise you have to |
| 2161 |
will have to figure out how to create your own chroot. |
2115 |
figure out how to create your own. Lets see how to create a chroot, for a |
| 2162 |
|
2116 |
basic understanding of how chroots work, we will test it with <c>bash</c> |
| 2163 |
</p> |
2117 |
(easy way of learning). |
| 2164 |
<p> |
|
|
| 2165 |
|
| 2166 |
Let's see how to create a <c>chroot</c>. For a basic understanding of how |
| 2167 |
<c>chroots</c> work, we will test it with <c>bash</c> (an easy way of learning). |
| 2168 |
</p> |
2118 |
</p> |
| 2169 |
|
2119 |
|
| 2170 |
<p> |
2120 |
<p> |
| 2171 |
First we will create the <path>/chroot</path> directory with <c>mkdir |
2121 |
Create the <path>/chroot</path> directory with <c>mkdir chroot</c>. And find what |
| 2172 |
chroot</c>. Now we must find what dynamic libraries <c>bash</c> is compiled |
2122 |
dynamic libraries that <c>bash</c> is compiled with (if it is compiled with |
| 2173 |
with. |
2123 |
<c>-static</c> this step is not necessary): |
| 2174 |
</p> |
2124 |
</p> |
| 2175 |
|
2125 |
|
| 2176 |
<note> |
|
|
| 2177 |
If <c>bash</c> is compiled with the <c>static</c> USE flag this step is not |
| 2178 |
necessary. |
| 2179 |
</note> |
| 2180 |
|
| 2181 |
<p> |
2126 |
<p> |
| 2182 |
The following command will create a list of libraries used by <c>bash</c>. |
2127 |
The following command will create a list of libraries used by <c>bash</c>. |
| 2183 |
</p> |
2128 |
</p> |
| 2184 |
|
2129 |
|
| 2185 |
<pre caption="Get listing of used libraries"> |
2130 |
<pre caption="Get listing of used libraries"> |
|
Lines 2201-2262
Link Here
|
| 2201 |
</pre> |
2146 |
</pre> |
| 2202 |
|
2147 |
|
| 2203 |
<p> |
2148 |
<p> |
| 2204 |
Next copy the files used by <c>bash</c> (<path>/lib</path>) to the |
2149 |
Next copy the files used by <c>bash</c> (<path>/lib</path>) to the chrooted <path>lib</path> and |
| 2205 |
chrooted <path>lib</path> directory, and copy the <c>bash</c> executable to the |
2150 |
copy the bash command to the chrooted <path>bin</path> directory. This will create the |
| 2206 |
chrooted <path>bin</path> directory. This will create the exact same |
2151 |
exact same environment, just with less functionality. After copying try it |
| 2207 |
environment, just with less functionality. After copying try it out: <c>chroot |
2152 |
out: <c>chroot /chroot/bash</c>. If you get an prompt saying <path>/</path> it |
| 2208 |
/chroot/bash</c>. If you get an prompt saying <path>/</path>, you were |
2153 |
works! Otherwise it will properly tell you what a file is missing. Some shared |
| 2209 |
successful. Otherwise it will tell you what a file is missing. Some shared |
|
|
| 2210 |
libraries depend on each other. |
2154 |
libraries depend on each other. |
| 2211 |
</p> |
2155 |
</p> |
| 2212 |
|
2156 |
|
| 2213 |
<p> |
2157 |
<p> |
| 2214 |
You will notice that inside the <c>chroot</c> nothing works |
2158 |
You will notice that inside the chroot nothing works except <c>echo</c>. This |
| 2215 |
except <c>echo</c>. This is because we have no commands in our chroot |
2159 |
is because we have no other commands in out chroot environment than bash and |
| 2216 |
environment other than <c>bash</c>, and <c>echo</c> is built in to <c>bash</c> |
2160 |
<c>echo</c> is a build-in functionality. |
| 2217 |
</p> |
2161 |
</p> |
| 2218 |
|
2162 |
|
| 2219 |
<p> |
2163 |
<p> |
| 2220 |
This is basically the same way you would create a chrooted service. The only |
2164 |
This is basically the same way you would create a chrooted service. The only |
| 2221 |
difference is that services sometimes rely on devices and configuration files |
2165 |
difference is that services sometimes rely on devices and configuration files |
| 2222 |
in <path>/etc</path>. Simply copy them (devices can be copied with <c>cp -a</c>) |
2166 |
in <path>/etc</path>. Simply copy them (devices can be copied with <c>cp |
| 2223 |
to the chrooted environment and edit the init script to use chroot before |
2167 |
-a</c>) to the chrooted environment, edit the init script to use chroot before |
| 2224 |
executing. It can be difficult to find what devices and configuration files a |
2168 |
executing. It can be difficult to find what devices and configuration files a |
| 2225 |
services need. This is where the <c>strace</c> command becomes handy. Start the |
2169 |
services need. This is where the <c>strace</c> command becomes handy. Start |
| 2226 |
service with <c>/usr/bin/strace bash</c> and look for open, read, stat and maybe |
2170 |
the service with <c>/usr/bin/strace</c> bash and look for open, read, stat and |
| 2227 |
connect. This will give you a clue on what files to copy. But in most cases just |
2171 |
maybe connect. This will give you a clue on what files to copy. But in most |
| 2228 |
copy the passwd file (edit the copy and remove users that have nothing to do |
2172 |
cases just copy the passwd file (edit the copy and remove users that has |
| 2229 |
with the service), <path>/dev/zero</path>, <path>/dev/log</path> |
2173 |
nothing to do with the service), <path>/dev/zero</path>, <path>/dev/log</path> |
| 2230 |
and <path>/dev/random</path>. |
2174 |
and <path>/dev/random</path>. |
| 2231 |
</p> |
2175 |
</p> |
| 2232 |
|
2176 |
|
| 2233 |
<note> |
|
|
| 2234 |
|
| 2235 |
In <c>portage</c> you can find <uri |
| 2236 |
link="http://www.jmcresearch.com/projects/jail/">jail</uri> which will setup a |
| 2237 |
chroot jail almost automatically. |
| 2238 |
</note> |
| 2239 |
|
| 2240 |
</body> |
2177 |
</body> |
| 2241 |
</section> |
2178 |
</section> |
| 2242 |
<section> |
2179 |
<section> |
| 2243 |
<title>User Mode Linux</title> |
2180 |
<title>Virtual servers</title> |
| 2244 |
<body> |
2181 |
<body> |
| 2245 |
|
2182 |
|
| 2246 |
<p> |
2183 |
<p> |
| 2247 |
Another way of creating a more secure environment is by running a virtual |
2184 |
Another way of creating a more secure environment is by using a virtual server |
| 2248 |
machine. A virtual machine, as the name implies, is a process that runs on top |
2185 |
environment. This will create a copy of the existing Linux and boots it in a |
| 2249 |
of your real operating system providing a hardware and operating system |
2186 |
virtual mode. This means that if the server is compromised its only the virtual |
| 2250 |
environment that appears to be its own unique machine. The security benefit is |
2187 |
server that has been compromised and not the real installation. |
| 2251 |
that if the server running on the virtual machine is compromised, only the |
|
|
| 2252 |
virtual server is affected and not the parent installation. |
| 2253 |
</p> |
2188 |
</p> |
| 2254 |
|
2189 |
|
| 2255 |
<p> |
2190 |
<p> |
| 2256 |
For more information about how to setup User Mode Linux consult the |
2191 |
Example of virtual servers: |
| 2257 |
<uri link="http://www.gentoo.org/doc/en/uml.xml">User Mode Linux |
|
|
| 2258 |
Guide</uri>. |
| 2259 |
</p> |
2192 |
</p> |
|
|
2193 |
|
| 2194 |
<ul> |
| 2195 |
<li> |
| 2196 |
<uri link="http://user-mode-linux.sourceforge.net">User-Mode Linux</uri> and |
| 2197 |
a howto about <uri link="http://www.gentoo.org/doc/uml.html">User-Mode |
| 2198 |
Linux</uri>. |
| 2199 |
</li> |
| 2200 |
</ul> |
| 2201 |
|
| 2260 |
</body> |
2202 |
</body> |
| 2261 |
</section> |
2203 |
</section> |
| 2262 |
</chapter> |
2204 |
</chapter> |
|
Lines 2269-2284
Link Here
|
| 2269 |
|
2211 |
|
| 2270 |
<p> |
2212 |
<p> |
| 2271 |
People often think that a firewall provides the ultimate security, but they |
2213 |
People often think that a firewall provides the ultimate security, but they |
| 2272 |
are wrong. In most cases a misconfigured firewall gives less security than |
2214 |
are wrong. In most cases a misconfigured firewall gives worse security than |
| 2273 |
not having one at all. A firewall is also a piece of software and should be |
2215 |
not having one at all. A firewall is also a piece of software and should be |
| 2274 |
treated the same way as any other piece of software, because it is just as likely |
2216 |
treated the same way as any other piece of software, because is just as likely |
| 2275 |
to contain bugs. |
2217 |
to contain bugs. |
| 2276 |
</p> |
2218 |
</p> |
| 2277 |
|
2219 |
|
| 2278 |
<p> |
2220 |
<p> |
| 2279 |
So think before implementing a firewall! Do you really need one? If you think |
2221 |
So think before implementing one! Do you really need one? If you think you need |
| 2280 |
you need one write a policy on how it should work, what type of firewall, and |
2222 |
one write a policy on how it should work, what type of firewall and who should |
| 2281 |
who should operate it. But first read this guide. |
2223 |
operate it. But first read this guide. |
| 2282 |
</p> |
2224 |
</p> |
| 2283 |
|
2225 |
|
| 2284 |
<p> |
2226 |
<p> |
|
Lines 2301-2308
Link Here
|
| 2301 |
</ul> |
2243 |
</ul> |
| 2302 |
|
2244 |
|
| 2303 |
<p> |
2245 |
<p> |
| 2304 |
A firewall should be a dedicated machine running no services (or <c>sshd</c> as |
2246 |
A firewall should be a dedicated machine running no services (or <c>sshd</c> as |
| 2305 |
the only one) and secured the way this guide recommends it be. |
2247 |
the only one) and secured the way this guide recommends it to be. |
| 2306 |
</p> |
2248 |
</p> |
| 2307 |
|
2249 |
|
| 2308 |
</body> |
2250 |
</body> |
|
Lines 2312-2322
Link Here
|
| 2312 |
<body> |
2254 |
<body> |
| 2313 |
|
2255 |
|
| 2314 |
<p> |
2256 |
<p> |
| 2315 |
All network traffic is sent in the form of packets. Large amounts of traffic is |
2257 |
All network traffic is in the form of packets. Large amounts of traffic also |
| 2316 |
split up into small packets for easy handling and then reassembled when it |
2258 |
split up into small packets for easy handling and then reassembled when |
| 2317 |
arrives at its destination. In the packet header every packet contains |
2259 |
arriving at its destination. In the packet header every packet contains |
| 2318 |
information on how and where it should be delivered. And this information is |
2260 |
information on how and where it should be delivered. And these informations |
| 2319 |
exactly what a packing filtering firewall uses. Filtering is based on: |
2261 |
are exactly what a packing filtering firewall uses. Filtering is based on: |
| 2320 |
</p> |
2262 |
</p> |
| 2321 |
|
2263 |
|
| 2322 |
<ul> |
2264 |
<ul> |
|
Lines 2327-2334
Link Here
|
| 2327 |
</ul> |
2269 |
</ul> |
| 2328 |
|
2270 |
|
| 2329 |
<p> |
2271 |
<p> |
| 2330 |
In other words, this filtering is based on all the data within the header of a |
2272 |
Basically filtering is based on all data within the header of a packet and not |
| 2331 |
packet and not its content. |
2273 |
its content. |
| 2332 |
</p> |
2274 |
</p> |
| 2333 |
|
2275 |
|
| 2334 |
<p> |
2276 |
<p> |
|
Lines 2337-2348
Link Here
|
| 2337 |
|
2279 |
|
| 2338 |
<ul> |
2280 |
<ul> |
| 2339 |
<li> |
2281 |
<li> |
| 2340 |
Address information in a packet can potentially be a bogus IP address (or as we |
2282 |
Address information in a packet can potentially be a bogus IP address or as |
| 2341 |
say <e>spoofed</e>) by the sender. |
2283 |
we say <e>spoofed</e> by the sender |
| 2342 |
</li> |
2284 |
</li> |
| 2343 |
<li> |
2285 |
<li> |
| 2344 |
Data or requests within the allowed packet may contain unwanted data that the |
2286 |
Data or requests within the allowed packet may contain unwanted data that the |
| 2345 |
attacker can use to exploit known bugs in the services on or behind the firewall |
2287 |
attacker can use to exploit known bugs in the services on or behind the |
|
|
2288 |
firewall |
| 2346 |
</li> |
2289 |
</li> |
| 2347 |
<li>Usually single point of failure</li> |
2290 |
<li>Usually single point of failure</li> |
| 2348 |
</ul> |
2291 |
</ul> |
|
Lines 2371-2380
Link Here
|
| 2371 |
</li> |
2314 |
</li> |
| 2372 |
<li><uri link="http://www.smoothwall.org">SmoothWall</uri></li> |
2315 |
<li><uri link="http://www.smoothwall.org">SmoothWall</uri></li> |
| 2373 |
</ul> |
2316 |
</ul> |
| 2374 |
<!--FIXME: should SmoothWall really be included, since it uses iptables?--> |
|
|
| 2375 |
<note> |
| 2376 |
It is recommended that you use iptables. Ipchains is obsoleted. |
| 2377 |
</note> |
| 2378 |
|
2317 |
|
| 2379 |
</body> |
2318 |
</body> |
| 2380 |
</section> |
2319 |
</section> |
|
Lines 2383-2393
Link Here
|
| 2383 |
<body> |
2322 |
<body> |
| 2384 |
|
2323 |
|
| 2385 |
<p> |
2324 |
<p> |
| 2386 |
A circuit level gateway is a firewall that validates connections before allowing |
2325 |
Or circuit level gateways is a firewall that validates connections before |
| 2387 |
data to be exchanged. This means that it does not simply allow or deny packets |
2326 |
allowing data to be exchanged. This means that it simply does not allow or |
| 2388 |
based on the packet header but determines whether the connection between both |
2327 |
deny packets based on the packet header but determines whether the connection |
| 2389 |
ends is valid according to configurable rules before it opens a session and |
2328 |
between both ends is valid according to configurable rules before it opens a |
| 2390 |
allows data to be exchanged. Filtering is based on: |
2329 |
session and allows data to be exchanged. Filtering is based on: |
| 2391 |
</p> |
2330 |
</p> |
| 2392 |
|
2331 |
|
| 2393 |
<ul> |
2332 |
<ul> |
|
Lines 2400-2406
Link Here
|
| 2400 |
</ul> |
2339 |
</ul> |
| 2401 |
|
2340 |
|
| 2402 |
<p> |
2341 |
<p> |
| 2403 |
All traffic is validated and monitored, and unwanted traffic can be dropped. |
2342 |
All traffic is validated, monitored and unwanted traffic can be dropped. |
| 2404 |
</p> |
2343 |
</p> |
| 2405 |
|
2344 |
|
| 2406 |
<p> |
2345 |
<p> |
|
Lines 2409-2416
Link Here
|
| 2409 |
|
2348 |
|
| 2410 |
<ul> |
2349 |
<ul> |
| 2411 |
<li> |
2350 |
<li> |
| 2412 |
Operates at the Transport Layer and may require substantial modification of the |
2351 |
Operates at the Transport Layer and may require substantial modification of |
| 2413 |
programs that normally provide transport functions. |
2352 |
the programming which normally provides transport functions |
| 2414 |
</li> |
2353 |
</li> |
| 2415 |
</ul> |
2354 |
</ul> |
| 2416 |
|
2355 |
|
|
Lines 2421-2436
Link Here
|
| 2421 |
<body> |
2360 |
<body> |
| 2422 |
|
2361 |
|
| 2423 |
<p> |
2362 |
<p> |
| 2424 |
The application level gateway is a proxy for applications, exchanging data with |
2363 |
The application level gateway is a proxy for applications, exchanging data |
| 2425 |
remote systems on behalf of the clients. It is kept away from the public safely |
2364 |
with remote systems on behalf of the clients. It is kept away from the public |
| 2426 |
behind a DMZ (De-Militarized Zone: the portion of a private network that is |
2365 |
safely behind a DMZ (De-Militarized Zone: the portion of a private network that |
| 2427 |
visible through the firewall) or a firewall allowing no connections from the |
2366 |
is visible through the firewall) or a firewall allowing no connections from the |
| 2428 |
outside. Filtering is based on: |
2367 |
outside. Filtering is based on: |
| 2429 |
</p> |
2368 |
</p> |
| 2430 |
|
2369 |
|
| 2431 |
<ul> |
2370 |
<ul> |
| 2432 |
<li>Allow or disallow based on source/destination IP address</li> |
2371 |
<li>Allow or disallow based on source/destination IP address</li> |
| 2433 |
<li>Based on the packet's content</li> |
2372 |
<li>Based on the packets content</li> |
| 2434 |
<li>Limiting file access based on file type or extension</li> |
2373 |
<li>Limiting file access based on file type or extension</li> |
| 2435 |
</ul> |
2374 |
</ul> |
| 2436 |
|
2375 |
|
|
Lines 2441-2447
Link Here
|
| 2441 |
<ul> |
2380 |
<ul> |
| 2442 |
<li>Can cache files, increasing network performance</li> |
2381 |
<li>Can cache files, increasing network performance</li> |
| 2443 |
<li>Detailed logging of all connections</li> |
2382 |
<li>Detailed logging of all connections</li> |
| 2444 |
<li>Scales well (some proxy servers can "share" the cached data)</li> |
2383 |
<li>Scales perfectly (some proxy servers can "share" the cached data)</li> |
| 2445 |
<li>No direct access from the outside</li> |
2384 |
<li>No direct access from the outside</li> |
| 2446 |
<li>Can even alter the packet content on the fly</li> |
2385 |
<li>Can even alter the packet content on the fly</li> |
| 2447 |
</ul> |
2386 |
</ul> |
|
Lines 2455-2463
Link Here
|
| 2455 |
</ul> |
2394 |
</ul> |
| 2456 |
|
2395 |
|
| 2457 |
<p> |
2396 |
<p> |
| 2458 |
Application gateways are considered to be the most secure solution since they do |
2397 |
Application gateways are considered to be the most secure solution since it |
| 2459 |
not have to run as root and the hosts behind them are not reachable from the |
2398 |
does not have to run as root and the hosts behind it are not reachable from |
| 2460 |
Internet. |
2399 |
the Internet. |
| 2461 |
</p> |
2400 |
</p> |
| 2462 |
|
2401 |
|
| 2463 |
<p> |
2402 |
<p> |
|
Lines 2475-2592
Link Here
|
| 2475 |
<body> |
2414 |
<body> |
| 2476 |
|
2415 |
|
| 2477 |
<p> |
2416 |
<p> |
| 2478 |
In order to use iptables, it must be enabled in the kernel. I have added |
2417 |
In order to get iptables working, it has to be enabled in the kernel. I have |
| 2479 |
iptables as modules (the <c>iptables</c> command will load them as they are |
2418 |
added them as modules (the <c>iptables</c> command will load them as they are |
| 2480 |
needed) and recompiled my kernel (but you may want to compile iptables in, if |
2419 |
needed) and recompiled my kernel. For more information on how to configure your |
| 2481 |
you intend to disable Loadable Kernel Modules as discussed previously). For more |
2420 |
kernel for iptables go to the <uri |
| 2482 |
information on how to configure your kernel for iptables go to the <uri link = |
2421 |
link="http://iptables-tutorial.frozentux.net/chunkyhtml/kernelsetup.html">Iptables |
| 2483 |
"http://iptables-tutorial.frozentux.net/chunkyhtml/kernelsetup.html">Iptables |
2422 |
Tutorial Chapter 2: Preparations</uri>. After you have compiled your new kernel |
| 2484 |
Tutorial Chapter 2: Preparations</uri>. After you have compiled your new kernel |
2423 |
(or while compiling the kernel) you have to add the <c>iptables</c> command. |
| 2485 |
(or while compiling the kernel), you must add the <c>iptables</c> command. |
|
|
| 2486 |
Just <c>emerge iptables</c> and it should work. |
2424 |
Just <c>emerge iptables</c> and it should work. |
| 2487 |
</p> |
2425 |
</p> |
| 2488 |
|
2426 |
|
| 2489 |
<p> |
2427 |
<p> |
| 2490 |
Now test that it works by running <c>iptables -L</c>. If this fails something is |
2428 |
Now test that it works by running <c>iptables -L</c>. If it fails something is |
| 2491 |
wrong and you have to check you configuration once more. |
2429 |
wrong and you have to check you configuration once more. |
| 2492 |
</p> |
2430 |
</p> |
| 2493 |
|
2431 |
|
| 2494 |
<p> |
2432 |
<p> |
| 2495 |
Iptables is the new and heavily improved packet filter in the Linux 2.4.x |
2433 |
Iptables is the new and heavily improved packet filter in the Linux 2.4.x |
| 2496 |
kernel. It is the successor of the previous ipchains packet filter in the Linux |
2434 |
kernel. It is the successor of the previous ipchains packet filter in the |
| 2497 |
2.2.x kernel. One of the major improvements is that iptables is able to perform |
2435 |
Linux 2.2.x kernel. One of the major improvements is that iptables is able to |
| 2498 |
stateful packet filtering. With stateful packet filtering it is possible to keep |
2436 |
perform stateful packet filtering. With stateful packet filtering it is |
| 2499 |
track of each established TCP connection. |
2437 |
possible to keep track of each established TCP connection. |
| 2500 |
</p> |
2438 |
</p> |
| 2501 |
|
2439 |
|
| 2502 |
<p> |
2440 |
<p> |
| 2503 |
A TCP connection consists of a series of packets containing information about |
2441 |
A TCP connection consists of a series of packets containing information about |
| 2504 |
source IP address, destination IP address, source port, destination port, and a |
2442 |
source IP address, destination IP address, sequence number so the packets can |
| 2505 |
sequence number so the packets can be reassembled without losing data. TCP is a |
2443 |
be reassembled and not to forget data. TCP is a connection-oriented protocol |
| 2506 |
connection-oriented protocol, in contrast to UDP, which is connectionless. |
2444 |
in contrast to UDP which is connectionless. |
| 2507 |
</p> |
2445 |
</p> |
| 2508 |
|
2446 |
|
| 2509 |
<p> |
2447 |
<p> |
| 2510 |
By examining the TCP packet header, a stateful packet filter can determine if a |
2448 |
By examining the TCP packet header a stateful packet filter can determine if a |
| 2511 |
received TCP packet is part of an already established connection or not and |
2449 |
received TCP packet is part of an already established connection or not and |
| 2512 |
decide either to accept or drop the packet. |
2450 |
decide either to accept or drop the packet. |
| 2513 |
</p> |
2451 |
</p> |
| 2514 |
|
2452 |
|
| 2515 |
<p> |
2453 |
<p> |
| 2516 |
With a stateless packet filter it is possible to fool the packet filter into |
2454 |
With a stateless packet filter it is possible to fool the packet filter to |
| 2517 |
accepting packets that should be dropped by manipulating the TCP packet headers. |
2455 |
accept packets that should be dropped by manipulating the TCP packet headers. |
| 2518 |
This could be done by manipulating the SYN flag or other flags in the TCP header |
2456 |
This could be done by manipulating the SYN flag or other flags in the TCP |
| 2519 |
to make a malicious packet appear to be a part of an established connection |
2457 |
header. With stateful packet filtering it is possible to drop such packets as |
| 2520 |
(since the packet filter itself does not do connection tracking). With stateful |
2458 |
they are not part of an already established connection. This will also stop |
| 2521 |
packet filtering it is possible to drop such packets, as they are not part of an |
2459 |
the possibility of "stealth scans" since such packets will not be part of an |
| 2522 |
already established connection. This will also stop the possibility of |
2460 |
already established connection. |
| 2523 |
"stealth scans", a type of portscan in which the scanner sends packets |
|
|
| 2524 |
with flags that are far less likely to be logged by a firewall than ordinary SYN |
| 2525 |
packets. |
| 2526 |
</p> |
2461 |
</p> |
| 2527 |
|
2462 |
|
| 2528 |
<p> |
2463 |
<p> |
| 2529 |
Iptables provides several other features like NAT (Network Address Translation) |
2464 |
Iptables provides several other features like NAT (Network Address Translation) |
| 2530 |
and rate limiting. Rate limiting is extremely useful when trying to prevent |
2465 |
and rate limiting. Rate limiting is extremely useful when trying to prevent |
| 2531 |
certain DoS (Denial of Service) attacks like SYN floods. |
2466 |
certain DoS (Denial of Service) attacks like SYN floods. |
| 2532 |
</p> |
2467 |
</p> |
| 2533 |
|
2468 |
|
| 2534 |
<p> |
2469 |
<p> |
| 2535 |
A TCP connection is established by a "three-way handshake". When establishing a |
2470 |
A TCP connection is established by a so called three-way handshake. When |
| 2536 |
TCP connection, the client sends a packet to the server with the SYN flag |
2471 |
establishing a TCP connection the client-side sends a packet to the server |
| 2537 |
set. When the server-side receives the SYN packet it responds by sending a |
2472 |
with the SYN flag set. When the server-side receives the SYN packet it |
| 2538 |
SYN+ACK packet back to the client-side. When the SYN+ACK is received the |
2473 |
responds by sending a SYN+ACK packet back to the client-side. When the SYN+ACK |
| 2539 |
client-side responds with a third ACK packet, in effect acknowledging the |
2474 |
is received the client-side responds with a third ACK packet in effect |
| 2540 |
connection. |
2475 |
acknowledging the connection. |
| 2541 |
</p> |
2476 |
</p> |
| 2542 |
|
2477 |
|
| 2543 |
<p> |
2478 |
<p> |
| 2544 |
A SYN flood attack is performed by sending the SYN packet but failing to respond |
2479 |
A SYN flood attack is performed by sending the SYN packet but failing to |
| 2545 |
to the SYN+ACK packet. The client-side can forge a packet with a fake source IP |
2480 |
respond to the SYN+ACK packet. The client-side can forge a packet with a fake |
| 2546 |
address because it does not need a reply. The server-side system will add an |
2481 |
source IP address because it does not need a reply. The server-side system will |
| 2547 |
entry to a queue of half-open connections when it receives the SYN packet and |
2482 |
add an entry to a queue of half-open connections when it receives the SYN |
| 2548 |
then wait for the final ACK packet before deleting the entry from the queue. The |
2483 |
packet and then wait for the final ACK packet before deleting the entry from |
| 2549 |
queue has a limitied number of slots, and if all the slots are filled it is |
2484 |
the queue. The queue has a limitied number of slots and if all the slots are |
| 2550 |
unable to open any further connections. If the ACK packet is not received before |
2485 |
filled it is unable to open any further connections. If the ACK packet is not |
| 2551 |
a specified timeout period the entry will automatically be deleted from the |
2486 |
received before a specified timeout period the entry will automatically be |
| 2552 |
queue. The timeout settings vary but will typically be 30-60 seconds or even |
2487 |
deleted from the queue. The timeout settings vary but will typically be 30-60 |
| 2553 |
more. The client-side initiates the attack by forging a lot of SYN packets with |
2488 |
seconds or even more. The client-side initiates the attack by forging a lot of |
| 2554 |
different source IP addresses and sends them to the target IP address as fast as |
2489 |
SYN packets with different source IP addresses and sends them to the target IP |
| 2555 |
possible, thereby filling up the queue of half-open connections and preventing |
2490 |
address as fast as possible and thereby filling up the queue of half-open |
| 2556 |
other clients from establishing legitimate connections with the server. |
2491 |
connections and thus preventing other clients from establishing legitimate |
|
|
2492 |
with the server. |
| 2557 |
</p> |
2493 |
</p> |
| 2558 |
|
2494 |
|
| 2559 |
<p> |
2495 |
<p> |
| 2560 |
This is where the rate limit becomes handy. It is possible to limit the rate of |
2496 |
This is where the rate limit becomes handy. It is possible to limit the rate |
| 2561 |
accepted SYN packets by using the <c>-m limit --limit 1/s</c>. This will limit |
2497 |
of accepted SYN packets by using the <c>-m limit --limit 1/s</c>. This will |
| 2562 |
the number of SYN packets accepted to one per second and therefore limit the SYN |
2498 |
limit the number of SYN packets accepted to one per second and therefore |
| 2563 |
flood's effect on our resources. |
2499 |
restricting the SYN flood on our resources. |
| 2564 |
</p> |
2500 |
</p> |
| 2565 |
|
2501 |
|
| 2566 |
<note> |
|
|
| 2567 |
Another option for preventing SYN floods are <uri link = |
| 2568 |
"http://cr.yp.to/syncookies.html">SYN cookies</uri>, which allow your computer |
| 2569 |
to respond to SYN packetes without filling space in the connection queue. SYN |
| 2570 |
cookies can be enabled in the Linux kernel configuration, but they are |
| 2571 |
considered experimental at this time. |
| 2572 |
</note> |
| 2573 |
|
| 2574 |
<p> |
2502 |
<p> |
| 2575 |
Now some practical stuff! |
2503 |
Now some practical stuff! |
| 2576 |
</p> |
2504 |
</p> |
| 2577 |
|
2505 |
|
| 2578 |
<p> |
2506 |
<p> |
| 2579 |
When iptables is loaded in the kernel it has 5 hooks where you can place your |
2507 |
When iptables is loaded in the kernel it has 5 hooks where you can place your |
| 2580 |
rules. They are called <c>INPUT</c>, <c>OUTPUT</c>, <c>FORWARD</c>, |
2508 |
rules. They are called <c>INPUT</c>, <c>OUTPUT</c>, <c>FORWARD</c>, |
| 2581 |
<c>PREROUTING</c> and <c>POSTROUTING</c>. Each of these is called a "chain" and |
2509 |
<c>PREROUTING</c> and <c>POSTROUTING</c>. Each of these is called a chain and |
| 2582 |
consists of a list of rules. Each rule contains a packet header and an action to |
2510 |
consists of a list of rules. Each rule says if the packet header looks like |
| 2583 |
take for packets with matching headers. If the rule does not match the packet |
2511 |
this, then here is what to do with the packet. If the rule does not match the |
| 2584 |
the next rule in the chain is consulted. |
2512 |
packet the next rule in the chain is consulted. |
| 2585 |
</p> |
2513 |
</p> |
| 2586 |
|
2514 |
|
| 2587 |
<p> |
2515 |
<p> |
| 2588 |
You can place rules directly in the 5 main chains or create new chains and add |
2516 |
You can place rules directly in the 5 main chains or create new chains and add |
| 2589 |
them as a rule to an existing chain. Iptables supports the following options: |
2517 |
them to as a rule to an existing chain. Iptables supports the following options. |
| 2590 |
</p> |
2518 |
</p> |
| 2591 |
|
2519 |
|
| 2592 |
<table> |
2520 |
<table> |
|
Lines 2616-2622
Link Here
|
| 2616 |
</tr> |
2544 |
</tr> |
| 2617 |
<tr> |
2545 |
<tr> |
| 2618 |
<ti>-F</ti> |
2546 |
<ti>-F</ti> |
| 2619 |
<ti>Delete all rules in chain or all chains</ti> |
2547 |
<ti>Delete all rules in chain or all chains</ti> |
| 2620 |
</tr> |
2548 |
</tr> |
| 2621 |
<tr> |
2549 |
<tr> |
| 2622 |
<ti>-Z</ti> |
2550 |
<ti>-Z</ti> |
|
Lines 2701-2708
Link Here
|
| 2701 |
</table> |
2629 |
</table> |
| 2702 |
|
2630 |
|
| 2703 |
<p> |
2631 |
<p> |
| 2704 |
First we will try to block all ICMP packets to our machine, just to get familiar |
2632 |
First we will try to block all ICMP packets to our machine, just to get |
| 2705 |
with iptables. |
2633 |
familiar with iptables. |
| 2706 |
</p> |
2634 |
</p> |
| 2707 |
|
2635 |
|
| 2708 |
<pre caption="Block all ICMP packets"> |
2636 |
<pre caption="Block all ICMP packets"> |
|
Lines 2710-2734
Link Here
|
| 2710 |
</pre> |
2638 |
</pre> |
| 2711 |
|
2639 |
|
| 2712 |
<p> |
2640 |
<p> |
| 2713 |
First we specify the chain our rule should be appended to, then the protocol of |
2641 |
First we specify the chain it should be appended to next the protocol and then |
| 2714 |
the packets to match, and finally the target. The target can be the name of a |
2642 |
the target. The target can be the name of a user specified chain or one of the |
| 2715 |
user specified chain or one of the special targets <c>ACCEPT</c>, <c>DROP</c>, |
2643 |
special targets <c>ACCEPT</c>, <c>DROP</c>, <c>REJECT</c>, <c>LOG</c>, |
| 2716 |
<c>REJECT</c>, <c>LOG</c>, <c>QUEUE</c>, or <c>MASQUERADE</c>. In this case we |
2644 |
<c>QUEUE</c>, <c>MASQUERADE</c>. In this case we use <c>DROP</c> which will |
| 2717 |
use <c>DROP</c>, which will drop the packet without responding to the client. |
2645 |
drop the packet without responding to the client. |
| 2718 |
</p> |
2646 |
</p> |
| 2719 |
|
2647 |
|
| 2720 |
<note> |
|
|
| 2721 |
The <c>LOG</c> target is what's known as "non-terminating". If a packet matches |
| 2722 |
a rule with the <c>LOG</c> target, rather than halting evaluation, the packet |
| 2723 |
will continue to be matched to further rules. This allows you to log packets |
| 2724 |
while still processing them normally. |
| 2725 |
</note> |
| 2726 |
|
| 2727 |
<p> |
2648 |
<p> |
| 2728 |
Now try <c>ping localhost</c>. You will not get any response, since iptables |
2649 |
Now try <c>ping localhost</c>. It will not be able to get any response since |
| 2729 |
will drop all incoming ICMP messages. You will also not be able to ping other |
2650 |
iptables will drop all incoming ICMP messages. It will not be able to ping |
| 2730 |
machines, since the ICMP reply packet will be dropped as well. Now flush the |
2651 |
other machines either since the ICMP reply packet will be dropped. Now flush |
| 2731 |
chain to get ICMP flowing again. |
2652 |
the chain to get ICMP flowing again. |
| 2732 |
</p> |
2653 |
</p> |
| 2733 |
|
2654 |
|
| 2734 |
<pre caption="Flush all rules"> |
2655 |
<pre caption="Flush all rules"> |
|
Lines 2736-2744
Link Here
|
| 2736 |
</pre> |
2657 |
</pre> |
| 2737 |
|
2658 |
|
| 2738 |
<p> |
2659 |
<p> |
| 2739 |
Now lets look at the stateful packet filtering in iptables. If we wanted to |
2660 |
Now lets look at the stateful packet filtering in iptables. If we wanted to |
| 2740 |
enable stateful inspection of packets incoming on eth0 we would issue the |
2661 |
have a stateful inspection of packets incoming on eth0 we could enable it by |
| 2741 |
command: |
2662 |
issuing: |
| 2742 |
</p> |
2663 |
</p> |
| 2743 |
|
2664 |
|
| 2744 |
<pre caption="Accept packets that originate from an already established connection"> |
2665 |
<pre caption="Accept packets that originate from an already established connection"> |
|
Lines 2746-2758
Link Here
|
| 2746 |
</pre> |
2667 |
</pre> |
| 2747 |
|
2668 |
|
| 2748 |
<p> |
2669 |
<p> |
| 2749 |
This will accept any packet from an already established connection or related in |
2670 |
This will accept any packet from an already established connection or related |
| 2750 |
the INPUT chain. And you could drop any packet that is not in the state table by |
2671 |
in the INPUT chain. And you could drop any packet that is not in the state |
| 2751 |
issuing <c>iptables -A INPUT -i eth0 -m state --state INVALID -j DROP</c> just |
2672 |
table by issuing <c>iptables -A INPUT -i eth0 -m state --state INVALID -j |
| 2752 |
before the previous command. This enables the stateful packet filtering in |
2673 |
DROP</c> just before. This enables the stateful packet filtering in iptables |
| 2753 |
iptables by loading the extension "state". If you wanted to allow others to |
2674 |
by loading the extension state. If you wanted to allow others to connect to |
| 2754 |
connect to your machine, you could use the flag <c>--state NEW</c>. Iptables |
2675 |
you machine you could use the <c>--state NEW</c>. Iptables contain some modules |
| 2755 |
contains some modules for different purposes. Some of them are: |
2676 |
for different purposes. Some of them are: |
| 2756 |
</p> |
2677 |
</p> |
| 2757 |
|
2678 |
|
| 2758 |
<table> |
2679 |
<table> |
|
Lines 2786-2797
Link Here
|
| 2786 |
</tr> |
2707 |
</tr> |
| 2787 |
<tr> |
2708 |
<tr> |
| 2788 |
<ti>unclean</ti> |
2709 |
<ti>unclean</ti> |
| 2789 |
<ti>Various random sanity checks on packets</ti><ti/> |
2710 |
<ti>Various random sanity checks on packets</ti><ti></ti> |
| 2790 |
</tr> |
2711 |
</tr> |
| 2791 |
</table> |
2712 |
</table> |
| 2792 |
|
2713 |
|
| 2793 |
<p> |
2714 |
<p> |
| 2794 |
Let's try to create a user defined chain and apply it to one of the existing |
2715 |
Lets try to create a user defined chain and apply it to one of the existing |
| 2795 |
chains: |
2716 |
chains: |
| 2796 |
</p> |
2717 |
</p> |
| 2797 |
|
2718 |
|
|
Lines 2808-2836
Link Here
|
| 2808 |
</pre> |
2729 |
</pre> |
| 2809 |
|
2730 |
|
| 2810 |
<p> |
2731 |
<p> |
| 2811 |
By applying the rule to the input chain we get the policy that all outgoing |
2732 |
By applying the rule to the input chain we get the policy: All outgoing packets |
| 2812 |
packets are allowed and all incoming packets are dropped. |
2733 |
are allowed and all incoming packets are dropped. |
| 2813 |
</p> |
2734 |
</p> |
| 2814 |
|
2735 |
|
| 2815 |
<p> |
2736 |
<p> |
| 2816 |
One can find documentation at <uri |
2737 |
One can find documentation at <uri |
| 2817 |
link="http://www.iptables.org/documentation/index.html#HOWTO">Netfilter/iptables documentation</uri>. |
2738 |
link="http://www.iptables.org/documentation/index.html#HOWTO">Netfilter/iptables documentation</uri>. |
| 2818 |
</p> |
2739 |
</p> |
| 2819 |
|
2740 |
|
| 2820 |
<p> |
2741 |
<p> |
| 2821 |
Lets see a full blown example. In this case my firewall/gateway policy states |
2742 |
Lets see a full blown example. In this case my firewall/gateway policy states: |
| 2822 |
that: |
|
|
| 2823 |
</p> |
2743 |
</p> |
| 2824 |
|
2744 |
|
| 2825 |
<ul> |
2745 |
<ul> |
| 2826 |
<li>Connections to the firewall are only allowed through SSH (port 22)</li> |
2746 |
<li>Connections to the firewall are only allowed through SSH (port 22)</li> |
| 2827 |
<li> |
2747 |
<li> |
| 2828 |
The local network should have access to HTTP, HTTPS and SSH (DNS should also be |
2748 |
The local network should have access to HTTP, HTTPS and SSH (DNS should also |
| 2829 |
allowed) |
2749 |
be allowed) |
| 2830 |
</li> |
2750 |
</li> |
| 2831 |
<li> |
2751 |
<li> |
| 2832 |
ICMP traffic can contain malicious payloads and should not be allowed. Of course |
2752 |
ICMP traffic can contain payload and should not be allowed. Of course we have |
| 2833 |
we have to allow some ICMP traffic. |
2753 |
to allow some ICMP traffic. |
| 2834 |
</li> |
2754 |
</li> |
| 2835 |
<li>Port scans should be detected and logged</li> |
2755 |
<li>Port scans should be detected and logged</li> |
| 2836 |
<li>SYN attacks should be avoided</li> |
2756 |
<li>SYN attacks should be avoided</li> |
|
Lines 3048-3073
Link Here
|
| 3048 |
</pre> |
2968 |
</pre> |
| 3049 |
|
2969 |
|
| 3050 |
<p> |
2970 |
<p> |
| 3051 |
Some advice when creating a firewall: |
2971 |
Free advice when creating a firewall: |
| 3052 |
</p> |
2972 |
</p> |
| 3053 |
|
2973 |
|
| 3054 |
<ol> |
2974 |
<ol> |
| 3055 |
<li>Create your firewall policy before implementing it</li> |
2975 |
<li>Create your firewall policy before implementing it</li> |
| 3056 |
<li>Keep it simple</li> |
2976 |
<li>Keep it simple</li> |
| 3057 |
<li> |
2977 |
<li> |
| 3058 |
Know how each protocol works (read the relevent <uri |
2978 |
Know how the protocol works (read the <uri |
| 3059 |
link="http://www.ietf.org/">RFC</uri>(Request For Comments)) |
2979 |
link="http://www.ietf.org/">RFC</uri>(Request For Comments)) |
| 3060 |
</li> |
2980 |
</li> |
| 3061 |
<li> |
2981 |
<li> |
| 3062 |
Keep in mind that a firewall is just another piece of software running as root. |
2982 |
Keep in mind that a firewall it just another piece of software running as root |
| 3063 |
</li> |
2983 |
</li> |
| 3064 |
<li>Test your firewall</li> |
2984 |
<li>Test your firewall</li> |
| 3065 |
</ol> |
2985 |
</ol> |
| 3066 |
|
2986 |
|
| 3067 |
<p> |
2987 |
<p> |
| 3068 |
If you think that iptables is hard to understand or takes to long to setup a |
2988 |
If you think that iptables is hard to understand or takes to long to setup a |
| 3069 |
decent firewall you could use <uri |
2989 |
decent firewall you could use <uri |
| 3070 |
link="http://www.shorewall.net">Shorewall</uri>. It basically uses iptables to |
2990 |
link="http://www.shorewall.net">Shorewall</uri>. It basically uses iptables to |
| 3071 |
generate firewall rules, but concentrates on rules and not specific protocols. |
2991 |
generate firewall rules, but concentrates on rules and not specific protocols. |
| 3072 |
</p> |
2992 |
</p> |
| 3073 |
|
2993 |
|
|
Lines 3078-3095
Link Here
|
| 3078 |
<body> |
2998 |
<body> |
| 3079 |
|
2999 |
|
| 3080 |
<p> |
3000 |
<p> |
| 3081 |
Squid is a very powerful proxy server. It can filter traffic based on time, |
3001 |
Squid is a very powerful proxy server and it can filter traffic based on: time, |
| 3082 |
regular expressions on path/URI, source and destination IP addresses, domain, |
3002 |
regular expressions on path/URI, source and destination IP addresses, domain, |
| 3083 |
browser, authenticated username, MIME type, and port number (protocol). I |
3003 |
browser, authenticated username, MIME type and port number (protocol). I |
| 3084 |
probably forgot some features, but it can be hard to cover the entire list right |
3004 |
probably forgot some features, but it can be hard to cover the entire feature |
| 3085 |
here. |
3005 |
list. |
| 3086 |
</p> |
3006 |
</p> |
| 3087 |
|
3007 |
|
| 3088 |
<p> |
3008 |
<p> |
| 3089 |
In the following example I have added a banner filter instead of a filter based |
3009 |
In the following example I have added a banner filter instead of a filter based |
| 3090 |
on porn sites. The reason for this is that Gentoo.org should <e>not</e> be |
3010 |
on porn sites. The reason for this is that Gentoo.org should <e>not</e> be |
| 3091 |
listed as some porn site. And I do not want to waste my time trying to find some |
3011 |
listed as some porn site. And I do not want to waste my time trying to find |
| 3092 |
good sites for you. |
3012 |
some good sites for you. |
| 3093 |
</p> |
3013 |
</p> |
| 3094 |
|
3014 |
|
| 3095 |
<p> |
3015 |
<p> |
|
Lines 3098-3117
Link Here
|
| 3098 |
|
3018 |
|
| 3099 |
<ul> |
3019 |
<ul> |
| 3100 |
<li> |
3020 |
<li> |
| 3101 |
Surfing (HTTP/HTTPS) is allowed during work hours (mon-fri 8-17 and sat 8-13), |
3021 |
Surfing (HTTP/HTTPS) is allowed during work hours (mon-fri 8-17 and sat 8-13) |
| 3102 |
but if employees are here late they should work, not surf |
3022 |
if they are here late they should work, not surf |
| 3103 |
</li> |
|
|
| 3104 |
<li> |
| 3105 |
Downloading files is not allowed (.exe, .com, .arj, .zip, .asf, .avi, .mpg, |
| 3106 |
.mpeg, etc) |
| 3107 |
</li> |
3023 |
</li> |
| 3108 |
<li> |
3024 |
<li> |
| 3109 |
We do not like banners, so they are filtered and replaced with a transparent gif |
3025 |
Download is not allowed (.exe, .com, .arj, .zip, .asf, .avi, .mpg, .mpeg etc) |
| 3110 |
(this is where you get creative!). |
|
|
| 3111 |
</li> |
3026 |
</li> |
| 3112 |
<li> |
3027 |
<li> |
| 3113 |
All other connections to and from the Internet are denied. |
3028 |
We do not like banners so they are filtered and replaced with a transparent |
|
|
3029 |
gif (this is where you get creative!) |
| 3114 |
</li> |
3030 |
</li> |
|
|
3031 |
<li>All other connections to and from the Internet are not allowed</li> |
| 3115 |
</ul> |
3032 |
</ul> |
| 3116 |
|
3033 |
|
| 3117 |
<p> |
3034 |
<p> |
|
Lines 3187-3195
Link Here
|
| 3187 |
</pre> |
3104 |
</pre> |
| 3188 |
|
3105 |
|
| 3189 |
<p> |
3106 |
<p> |
| 3190 |
Next fill in the files you do not want your users to download files. I have |
3107 |
Next fill in the files you do not want your uses to download. I have added zip, |
| 3191 |
added zip, viv, exe, mp3, rar, ace, avi, mov, mpg, mpeg, au, ra, arj, tar, gz |
3108 |
viv, exe, mp3, rar, ace, avi, mov, mpg, mpeg, au, ra, arj, tar, gz and z files. |
| 3192 |
and z files. |
|
|
| 3193 |
</p> |
3109 |
</p> |
| 3194 |
|
3110 |
|
| 3195 |
<pre caption="/etc/squid/files.acl"> |
3111 |
<pre caption="/etc/squid/files.acl"> |
|
Lines 3213-3225
Link Here
|
| 3213 |
</pre> |
3129 |
</pre> |
| 3214 |
|
3130 |
|
| 3215 |
<note> |
3131 |
<note> |
| 3216 |
Please note the [] with upper and lowercase of every character. This is done so |
3132 |
Please note the [] with upper and lowercase of every character. This is done so |
| 3217 |
no one can fool our filter by accessing a file called AvI instead of avi |
3133 |
no one can fool it by accessing a file called AvI instead of avi |
| 3218 |
</note> |
3134 |
</note> |
| 3219 |
|
3135 |
|
| 3220 |
<p> |
3136 |
<p> |
| 3221 |
Next we add the regular expressions for identifying banners. You will probably |
3137 |
Next we add the regular expressions for identifying banners. You will probably |
| 3222 |
be a lot more creative than I: |
3138 |
be a lot more creative than me: |
| 3223 |
</p> |
3139 |
</p> |
| 3224 |
|
3140 |
|
| 3225 |
<pre caption="/etc/squid/banner-ads.acl"> |
3141 |
<pre caption="/etc/squid/banner-ads.acl"> |
|
Lines 3275-3296
Link Here
|
| 3275 |
</note> |
3191 |
</note> |
| 3276 |
|
3192 |
|
| 3277 |
<p> |
3193 |
<p> |
| 3278 |
As you can see, Squid has a lot of possibilities and it is very effective at |
3194 |
As you can see, squid has a lot of possibilities and it is very effective at |
| 3279 |
both filtering and proxying. It can even use alternative Squid proxies to scale |
3195 |
both filtering and proxying. It can even use alternative squid proxies to |
| 3280 |
on very large networks. The configuration I have listed here is mostly suited |
3196 |
scale on very large networks. The configuration I have listed here is mostly |
| 3281 |
for a small network with 1-20 users. |
3197 |
suited for a small network with 1-20 users. |
| 3282 |
</p> |
3198 |
</p> |
| 3283 |
|
3199 |
|
| 3284 |
<p> |
3200 |
<p> |
| 3285 |
But combining the packet filter (iptables) and the application gateway (Squid) |
3201 |
But combining the packet filter (iptables) and the application gateway (squid) |
| 3286 |
is probably the best solution, even if Squid is located somewhere safe and |
3202 |
is probably the best solution, even if squid is located somewhere safe and |
| 3287 |
nobody can access it from the outside. We still need to be concerned about |
3203 |
nobody can access it from the outside. We still need to be concerned by attacks |
| 3288 |
attacks from the inside. |
3204 |
from the inside. |
| 3289 |
</p> |
3205 |
</p> |
| 3290 |
|
3206 |
|
| 3291 |
<p> |
3207 |
<p> |
| 3292 |
Now you have to configure your clients browsers to use the proxy server. The |
3208 |
Now you have to configure your clients browsers to use the proxy server. The |
| 3293 |
gateway will prevent the users from having any contact with the outside unless |
3209 |
gateway will prevent the users from having any contact with the outside unless |
| 3294 |
they use the proxy. |
3210 |
they use the proxy. |
| 3295 |
</p> |
3211 |
</p> |
| 3296 |
|
3212 |
|
|
Lines 3299-3306
Link Here
|
| 3299 |
</note> |
3215 |
</note> |
| 3300 |
|
3216 |
|
| 3301 |
<p> |
3217 |
<p> |
| 3302 |
It can also be done transparently by using iptables to forward all outbound |
3218 |
It can also be done transparently by using iptables to forward all outbound |
| 3303 |
traffic to a Squid proxy. This can be done by adding a forwarding/prerouting |
3219 |
traffic to a squid proxy. This can be done by adding a forwarding/prerouting |
| 3304 |
rule on the gateway: |
3220 |
rule on the gateway: |
| 3305 |
</p> |
3221 |
</p> |
| 3306 |
|
3222 |
|
|
Lines 3309-3325
Link Here
|
| 3309 |
# <i>iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to proxyhost:3128</i> |
3225 |
# <i>iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to proxyhost:3128</i> |
| 3310 |
</pre> |
3226 |
</pre> |
| 3311 |
|
3227 |
|
| 3312 |
<note> |
|
|
| 3313 |
If the proxy is running on the packet filtering host--though this is not |
| 3314 |
recommended, it may be necessary if you do not have enough spare machines--use |
| 3315 |
a <c>REDIRECT</c> target instead of <c>DNAT</c> (<c>REDIRECT</c> directs packets |
| 3316 |
to the localhost). |
| 3317 |
</note> |
| 3318 |
|
| 3319 |
</body> |
3228 |
</body> |
| 3320 |
</section> |
3229 |
</section> |
| 3321 |
<section> |
3230 |
<section> |
| 3322 |
<title>Lessons learned</title> |
3231 |
<title>Now what have we learned?</title> |
| 3323 |
<body> |
3232 |
<body> |
| 3324 |
|
3233 |
|
| 3325 |
<p> |
3234 |
<p> |
|
Lines 3328-3352
Link Here
|
| 3328 |
|
3237 |
|
| 3329 |
<ol> |
3238 |
<ol> |
| 3330 |
<li> |
3239 |
<li> |
| 3331 |
A firewall can be a risk in itself. A badly configured firewall is worse than |
3240 |
A firewall can be a risk in itself. A badly configured firewall is worse than |
| 3332 |
not having one at all. |
3241 |
not having one at all. |
|
|
3242 |
</li> |
| 3243 |
<li>How to setup a basic gateway and a transparent proxy</li> |
| 3244 |
<li>The key to a good firewall is to know the protocol you want do allow</li> |
| 3245 |
<li> |
| 3246 |
That IP traffic does not always contain legitimate data ie. ICMP packets can |
| 3247 |
contain payload. |
| 3333 |
</li> |
3248 |
</li> |
| 3334 |
<li>How to setup a basic gateway and a transparent proxy.</li> |
3249 |
<li>How to prevent SYN attack</li> |
| 3335 |
<li>The key to a good firewall is to know the protocols you want do allow.</li> |
|
|
| 3336 |
<li> |
3250 |
<li> |
| 3337 |
That IP traffic does not always contain legitimate data, e.g. ICMP packets, |
3251 |
Filtering HTTP traffic by removing offensive pictures and downloads of |
| 3338 |
which can contain a malicious payload. |
3252 |
viruses |
| 3339 |
</li> |
3253 |
</li> |
| 3340 |
<li>How to prevent SYN attack.</li> |
|
|
| 3341 |
<li>Filtering HTTP traffic by removing offensive pictures and downloads of viruses.</li> |
| 3342 |
<li> |
3254 |
<li> |
| 3343 |
Combining packet filters and application gateways provides better control. |
3255 |
Combining packet filters and application gateways provides better control |
| 3344 |
</li> |
3256 |
</li> |
| 3345 |
</ol> |
3257 |
</ol> |
| 3346 |
|
3258 |
|
| 3347 |
<p> |
3259 |
<p> |
| 3348 |
Now, if you <e>really</e> need to, go create a firewall that matches |
3260 |
Now, if you <e>really</e> need to, go create a firewall that matches your needs. |
| 3349 |
your needs. |
|
|
| 3350 |
</p> |
3261 |
</p> |
| 3351 |
|
3262 |
|
| 3352 |
</body> |
3263 |
</body> |
|
Lines 3360-3380
Link Here
|
| 3360 |
<body> |
3271 |
<body> |
| 3361 |
|
3272 |
|
| 3362 |
<p> |
3273 |
<p> |
| 3363 |
AIDE is a Host-Based Intrusion Detection System (HIDS), a free alternative to |
3274 |
AIDE is a host based intrusion detection system (free alternative to Tripwire). |
| 3364 |
Tripwire (if you already know Tripwire you should have no difficulties learning |
3275 |
And if you already know Tripwire you should have no difficulties learning the |
| 3365 |
the configuration file for AIDE). HIDS are used to detect changes to important |
3276 |
configuration file for AIDE. |
| 3366 |
system configuration files and binaries, generally by making a unique |
|
|
| 3367 |
cryptographic hash for the files to be checked and storing it in a secure |
| 3368 |
place. On a regular basis (such as once a day), the stored "known-good" hash is |
| 3369 |
compared to the one generated from the current copy of each file, to determine |
| 3370 |
if that file has changed. HIDS are a great way to detect disallowed changes to |
| 3371 |
your system, but they take a little work to implement properly and make good use |
| 3372 |
of. |
| 3373 |
</p> |
3277 |
</p> |
| 3374 |
|
3278 |
|
| 3375 |
<p> |
3279 |
<p> |
| 3376 |
The configuration file is based on regular expressions, macros and rules for |
3280 |
The configuration file is based on regular expressions, macros and rules for |
| 3377 |
files and directories. We have the following macros: |
3281 |
files and directories. We have the following macros: |
| 3378 |
</p> |
3282 |
</p> |
| 3379 |
|
3283 |
|
| 3380 |
<table> |
3284 |
<table> |
|
Lines 3415-3437
Link Here
|
| 3415 |
</tr> |
3319 |
</tr> |
| 3416 |
<tr> |
3320 |
<tr> |
| 3417 |
<ti>endif</ti> |
3321 |
<ti>endif</ti> |
| 3418 |
<ti> |
3322 |
<ti> |
| 3419 |
Endif must be used after any of the above macros except define and undef |
3323 |
Endif must be used after any of the above macros except define and undef |
| 3420 |
</ti> |
3324 |
</ti> |
| 3421 |
<ti>@@endif</ti> |
3325 |
<ti>@@endif</ti> |
| 3422 |
</tr> |
3326 |
</tr> |
| 3423 |
</table> |
3327 |
</table> |
| 3424 |
|
3328 |
|
| 3425 |
<p> |
3329 |
<p> |
| 3426 |
These macros become very handy if you have more than one Gentoo box and want to |
3330 |
These macros become very handy if you have more than one Gentoo box and want to |
| 3427 |
use AIDE on all of them. But not all machines run the same services or even have |
3331 |
use AIDE on all of them. But not all machines run the same services or maybe |
| 3428 |
the same users. |
3332 |
even users. |
| 3429 |
</p> |
3333 |
</p> |
| 3430 |
|
3334 |
|
| 3431 |
<p> |
3335 |
<p> |
| 3432 |
Next we have sets of flags to check for on files and directories. These are a |
3336 |
Next we have sets of flags to check for on files and directories. These are a |
| 3433 |
combination of permissions, file properties and cryptographic hashes |
3337 |
combination of permissions, file properties and cryptographic hashes/checksums. |
| 3434 |
(i.e. checksums). |
|
|
| 3435 |
</p> |
3338 |
</p> |
| 3436 |
|
3339 |
|
| 3437 |
<table> |
3340 |
<table> |
|
Lines 3518-3548
Link Here
|
| 3518 |
</table> |
3421 |
</table> |
| 3519 |
|
3422 |
|
| 3520 |
<p> |
3423 |
<p> |
| 3521 |
And if AIDE is compiled with mhash support it supports a few other features: |
3424 |
And if AIDE is compiled with mhash support it does have a few other features: |
| 3522 |
</p> |
3425 |
</p> |
| 3523 |
|
3426 |
|
| 3524 |
<table> |
3427 |
<table> |
| 3525 |
<tr> |
3428 |
<tr> |
| 3526 |
<th>Flag</th> |
3429 |
<th>Flag</th> |
| 3527 |
<th>Description</th> |
3430 |
<th>Description</th> |
| 3528 |
</tr> |
3431 |
</tr> |
| 3529 |
<tr> |
3432 |
<tr> |
| 3530 |
<ti>haval</ti> |
3433 |
<ti>haval</ti> |
| 3531 |
<ti>haval checksum</ti> |
3434 |
<ti>haval checksum</ti> |
| 3532 |
</tr> |
3435 |
</tr> |
| 3533 |
<tr> |
3436 |
<tr> |
| 3534 |
<ti>gost</ti> |
3437 |
<ti>gost</ti> |
| 3535 |
<ti>gost checksum</ti> |
3438 |
<ti>gost checksum</ti> |
| 3536 |
</tr> |
3439 |
</tr> |
| 3537 |
<tr> |
3440 |
<tr> |
| 3538 |
<ti>crc32</ti> |
3441 |
<ti>crc32</ti> |
| 3539 |
<ti>crc32 checksum</ti> |
3442 |
<ti>crc32 checksum</ti> |
| 3540 |
</tr> |
3443 |
</tr> |
| 3541 |
</table> |
3444 |
</table> |
| 3542 |
|
3445 |
|
| 3543 |
<p> |
3446 |
<p> |
| 3544 |
Now you can create you own rules based on the above flags by combining them |
3447 |
Now you can create you own rules based on the above flags by combining them |
| 3545 |
like this: |
3448 |
like: |
| 3546 |
</p> |
3449 |
</p> |
| 3547 |
|
3450 |
|
| 3548 |
<pre caption="Create a ruleset for AIDE"> |
3451 |
<pre caption="Create a ruleset for AIDE"> |
|
Lines 3551-3579
Link Here
|
| 3551 |
</pre> |
3454 |
</pre> |
| 3552 |
|
3455 |
|
| 3553 |
<p> |
3456 |
<p> |
| 3554 |
The last thing we need to create our own configuration file is to see how to add |
3457 |
The last thing we need to create our own configuration file is to see how to |
| 3555 |
a rule to a file or directory. To enter a rule, combine the file or directory |
3458 |
add a rule to a file or directory. Basically you just type the file or dir |
| 3556 |
name and the rule. AIDE will add all files recursively unless you specify an |
3459 |
name and the rule. AIDE will add all files recursively unless you specify |
| 3557 |
alternate rule. |
3460 |
something else. |
| 3558 |
</p> |
3461 |
</p> |
| 3559 |
|
3462 |
|
| 3560 |
<table> |
3463 |
<table> |
| 3561 |
<tr> |
3464 |
<tr> |
| 3562 |
<th>Flag</th> |
3465 |
<th>Flag</th> |
| 3563 |
<th>Description</th> |
3466 |
<th>Description</th> |
| 3564 |
</tr> |
3467 |
</tr> |
| 3565 |
<tr> |
3468 |
<tr> |
| 3566 |
<ti>!</ti> |
3469 |
<ti>!</ti> |
| 3567 |
<ti>Don't add this file or directory.</ti> |
3470 |
<ti>Don't add this file or directory.</ti> |
| 3568 |
</tr> |
3471 |
</tr> |
| 3569 |
<tr> |
3472 |
<tr> |
| 3570 |
<ti>=</ti> |
3473 |
<ti>=</ti> |
| 3571 |
<ti>Add this directory, but not recursively.</ti> |
3474 |
<ti>Add this directory, but not recursive.</ti> |
| 3572 |
</tr> |
3475 |
</tr> |
| 3573 |
</table> |
3476 |
</table> |
| 3574 |
|
3477 |
|
| 3575 |
<p> |
3478 |
<p> |
| 3576 |
So lets watch a full blown example: |
3479 |
So lets watch a full blown example |
| 3577 |
</p> |
3480 |
</p> |
| 3578 |
|
3481 |
|
| 3579 |
<pre caption="/etc/aide/aide.conf"> |
3482 |
<pre caption="/etc/aide/aide.conf"> |
|
Lines 3618-3672
Link Here
|
| 3618 |
</pre> |
3521 |
</pre> |
| 3619 |
|
3522 |
|
| 3620 |
<p> |
3523 |
<p> |
| 3621 |
In the above example we specify with some macros where the topdir starts and |
3524 |
In the above example with some macros we specify where the topdir starts and |
| 3622 |
where the AIDE directory is. AIDE checks the <path>/etc/aide/aide.db</path> file |
3525 |
where the AIDE directory is. AIDE checks the <path>/etc/aide/aide.db</path> |
| 3623 |
when checking for file integrity. But when updating or creating a new file it |
3526 |
file when checking for file integrity. But when updating or creating a new |
| 3624 |
stores the information in <path>/etc/aide/aide.db.new</path>. This is done so it |
3527 |
file it stores the information in <path>/etc/aide/aide.db.new</path>. This is |
| 3625 |
won't automatically overwrite the old db file. The option |
3528 |
done so it won't automatic overwrite the old db file. The option |
| 3626 |
<c>report_URL</c> is not yet implemented, but the author's intention was that |
3529 |
<c>report_URL</c> is not yet implemented. But the authors intention was that |
| 3627 |
it should be able to e-mail or maybe even execute scripts. |
3530 |
it should be able to email or maybe even execute script. |
| 3628 |
</p> |
3531 |
</p> |
| 3629 |
|
3532 |
|
| 3630 |
<p> |
3533 |
<p> |
| 3631 |
After editing the configuration you should create your db file by executing |
3534 |
After editing the configuration you should create your db file by executing |
| 3632 |
<c>aide -i</c> and then copy the file <path>/etc/aide/aide.db.new</path> to |
3535 |
<c>aide -i</c> and then copy the file <path>/etc/aide/aide.db.new</path> to |
| 3633 |
<path>/etc/aide/aide.db</path> and add the check to cron by executing |
3536 |
<path>/etc/aide/aide.db</path> and add the check to cron by executing |
| 3634 |
<c>crontab -e</c> as root. |
3537 |
<c>crontab -e</c> as root. |
| 3635 |
</p> |
3538 |
</p> |
| 3636 |
|
3539 |
|
| 3637 |
<note> |
3540 |
<note> |
| 3638 |
Depending on your CPU, disk access speed, and the flags you have set on files, |
3541 |
Depending on your cpu, disk access and the flags you have set on files, it can |
| 3639 |
this can take some time. |
3542 |
take some time. |
| 3640 |
</note> |
3543 |
</note> |
| 3641 |
|
3544 |
|
| 3642 |
<pre caption="Shedule aide as a cronjob"> |
3545 |
<pre caption="Shedule aide as a cronjob"> |
| 3643 |
0 3 * * * /usr/bin/aide -u |
3546 |
0 3 * * * /usr/bin/aide -u |
| 3644 |
</pre> |
3547 |
</pre> |
| 3645 |
|
3548 |
|
| 3646 |
<note> |
3549 |
<note> |
| 3647 |
Remember to set an alias so you get roots mail. Otherwise you will never know |
3550 |
Remember to setup so you get roots mail. Otherwise you will never know what |
| 3648 |
what AIDE reports. |
3551 |
aide reports. |
| 3649 |
</note> |
3552 |
</note> |
| 3650 |
|
3553 |
|
| 3651 |
<p> |
3554 |
<p> |
| 3652 |
In this case it runs once at 3am. This is done since I do not want to disturb |
3555 |
In this case it runs once at 3am. This is done since I do not want to disturb |
| 3653 |
the users when they are working. Note I am using the <c>-u</c> (Update) option |
3556 |
the users when working. Note I am using the <c>-u</c> (Update) option instead |
| 3654 |
instead of the <c>-C</c> (Check). Since <c>-u</c> also checks the files and does |
3557 |
of the <c>-C</c> (Check). Since <c>-u</c> also checks the files and does not |
| 3655 |
not overwrite the original db file it saves some time since all you need to do |
3558 |
overwrite the original db file it saves some time since all you need to do is |
| 3656 |
is to copy a file when it detects some changes. Just check the changes to see if |
3559 |
to copy a file when it detects some changes. Just check the changes to see if |
| 3657 |
it was you who made the changes instead of some attacker before you copy it! |
3560 |
it was yourself that made the changes or some attacker before you copy it! |
| 3658 |
</p> |
3561 |
</p> |
| 3659 |
|
3562 |
|
| 3660 |
<p> |
3563 |
<p> |
| 3661 |
Now there is some risk inherent with storing the db files locally, since the |
3564 |
Now there is some problems with storing the db files locally since the attacker |
| 3662 |
attacker will (if they know that AIDE is installed) most certainly try to alter |
3565 |
will (If they know that aide is installed) most certainly try to alter the db |
| 3663 |
the db file, update the db file or modify <path>/usr/bin/aide</path>. So you |
3566 |
file, update the db file or modify <path>/usr/bin/aide</path>. So you should |
| 3664 |
should create a CD or other media and put on it a copy of the .db file and the |
3567 |
create a CD or other media and put a copy of the .db file and the aide binaries. |
| 3665 |
AIDE binaries. |
|
|
| 3666 |
</p> |
3568 |
</p> |
| 3667 |
|
3569 |
|
| 3668 |
<p> |
3570 |
<p> |
| 3669 |
One can find information at the <uri |
3571 |
One can find information at the <uri |
| 3670 |
link="http://www.cs.tut.fi/~rammer/aide.html">AIDE</uri> projectpage. |
3572 |
link="http://www.cs.tut.fi/~rammer/aide.html">AIDE</uri> projectpage. |
| 3671 |
</p> |
3573 |
</p> |
| 3672 |
|
3574 |
|
|
Lines 3677-3683
Link Here
|
| 3677 |
<body> |
3579 |
<body> |
| 3678 |
|
3580 |
|
| 3679 |
<p> |
3581 |
<p> |
| 3680 |
Snort is a Network Intrusion Detection System (NIDS). To install and configure |
3582 |
Snort is a Network Intrusion Detection System (NIDS). To install and configure |
| 3681 |
it use the following examples. |
3583 |
it use the following examples. |
| 3682 |
</p> |
3584 |
</p> |
| 3683 |
|
3585 |
|
|
Lines 3792-3834
Link Here
|
| 3792 |
</pre> |
3694 |
</pre> |
| 3793 |
|
3695 |
|
| 3794 |
<p> |
3696 |
<p> |
| 3795 |
More information is at the <uri |
3697 |
More information is at the <uri link="http://www.snort.org">Snort</uri> website. |
| 3796 |
link="http://www.snort.org">Snort</uri> website. |
|
|
| 3797 |
</p> |
| 3798 |
|
| 3799 |
</body> |
| 3800 |
</section> |
| 3801 |
|
| 3802 |
<section> |
| 3803 |
<title>Detecting malware with chkrootkit</title> |
| 3804 |
|
| 3805 |
<body> |
| 3806 |
|
| 3807 |
<p> |
| 3808 |
HIDS like AIDE are a great way to detect changes to your system, but it never |
| 3809 |
hurts to have another line of defence. <c>chkrootkit</c> is a utility that scans |
| 3810 |
common system files for the presence of rootkits--software designed to hide an |
| 3811 |
intrudor's actions and allow him to retain his access--and scans your system for |
| 3812 |
likely traces of keyloggers and other "malware". While <c>chkrootkit</c> (and |
| 3813 |
alternatives like <c>rkhunter</c>) are useful tools, both for system |
| 3814 |
maintainance and for tracking an intruder after an attack has occurred, they |
| 3815 |
cannot guarantee your system is secure. |
| 3816 |
</p> |
| 3817 |
|
| 3818 |
<p> |
| 3819 |
The best way to use <c>chkrootkit</c> to detect an intrusion is to run it |
| 3820 |
routinely from <c>cron</c>. To start, emerge <path>app-admin/chkrootkit</path>. |
| 3821 |
<c>chkrootkit</c> can be run from the command line by the command of the same |
| 3822 |
name, or from <c>cron</c> with an entry such as this: |
| 3823 |
</p> |
3698 |
</p> |
| 3824 |
|
3699 |
|
| 3825 |
<pre caption="Schedule chkrootkit as a cronjob"> |
|
|
| 3826 |
0 3 * * * /usr/sbin/chkrootkit |
| 3827 |
</pre> |
| 3828 |
|
| 3829 |
</body> |
3700 |
</body> |
| 3830 |
</section> |
3701 |
</section> |
| 3831 |
|
|
|
| 3832 |
</chapter> |
3702 |
</chapter> |
| 3833 |
|
3703 |
|
| 3834 |
<chapter> |
3704 |
<chapter> |
|
Lines 3837-3853
Link Here
|
| 3837 |
<body> |
3707 |
<body> |
| 3838 |
|
3708 |
|
| 3839 |
<p> |
3709 |
<p> |
| 3840 |
Once you have successfully installed your system and ensured a good level of |
3710 |
Once you have successfully installed your system and ensured a good level of |
| 3841 |
security you are not done. Security is an ongoing process; the vast majority of |
3711 |
security you are not done. Security is an ongoing process and you have to |
| 3842 |
intrusions result from known vulnerabilities in unpatched systems. Keeping your |
3712 |
keep your system up to date with the latest security patches. |
| 3843 |
system up-to-date is the single most valuable step you can take to greater |
|
|
| 3844 |
security. |
| 3845 |
</p> |
3713 |
</p> |
| 3846 |
|
3714 |
|
| 3847 |
<p> |
3715 |
<p> |
| 3848 |
If you have a recent version of <c>portage</c> installed, you can first sync |
3716 |
If you have a recent version of <c>portage</c> installed you can first sync |
| 3849 |
your portage tree with <c>emerge sync</c> and then issue the command |
3717 |
your portage tree with <c>emerge sync</c> and then issue the command |
| 3850 |
<c>glsa-check --list</c> to check if your system is up to date security-wise. |
3718 |
<c>glsa-check --list</c> to check if your system is up to date security wise. |
| 3851 |
</p> |
3719 |
</p> |
| 3852 |
|
3720 |
|
| 3853 |
<pre caption="Example output of glsa-check -l"> |
3721 |
<pre caption="Example output of glsa-check -l"> |
|
Lines 3855-3861
Link Here
|
| 3855 |
</pre> |
3723 |
</pre> |
| 3856 |
|
3724 |
|
| 3857 |
<warn> |
3725 |
<warn> |
| 3858 |
The <c>glsa-check</c> is still experimental, so if security really is your top |
3726 |
The <c>glsa-check</c> is still experimental so if security really is your top |
| 3859 |
priority it would be wise to double check the list with other sources. |
3727 |
priority it would be wise to double check the list with other sources. |
| 3860 |
</warn> |
3728 |
</warn> |
| 3861 |
|
3729 |
|
|
Lines 3865-3885
Link Here
|
| 3865 |
</p> |
3733 |
</p> |
| 3866 |
|
3734 |
|
| 3867 |
<p> |
3735 |
<p> |
| 3868 |
Some people still prefer to use <c>emerge packagename</c> instead of |
3736 |
Some people still prefer to use <c>emerge packagename</c> instead of |
| 3869 |
<c>glsa-check -f</c> so all GLSAs are listed as <c>[N]</c>. |
3737 |
<c>glsa-check -f</c> so all GLSAs are listed as <c>[N]</c>. |
| 3870 |
</p> |
3738 |
</p> |
| 3871 |
|
3739 |
|
| 3872 |
<p> |
3740 |
<p> |
| 3873 |
If you want an email each time a GLSA is released subscribe to the |
3741 |
If you want an email each time a GLSA is released subscribe to the |
| 3874 |
<c>gentoo-announce</c> mailing list. Instructions for joining it and many other |
3742 |
<c>gentoo-announce</c> mailing list. Instructions for joining it and a |
| 3875 |
great mailing lists can be found <uri link="/main/en/lists.xml">Gentoo Linux |
3743 |
bunch of other great mailing lists can be found <uri |
| 3876 |
Mailing List Overview</uri>. |
3744 |
link="/main/en/lists.xml">Gentoo Linux Mailing List Overview</uri>. |
| 3877 |
</p> |
3745 |
</p> |
| 3878 |
|
3746 |
|
| 3879 |
<p> |
3747 |
<p> |
| 3880 |
Another great security resource is the <uri |
3748 |
Another great security resource is the <uri |
| 3881 |
link="http://www.securityfocus.com/archive/1">Bugtraq |
3749 |
link="http://www.securityfocus.com/archive/1">Bugtraq mailinglist</uri>. |
| 3882 |
mailinglist</uri>. |
|
|
| 3883 |
</p> |
3750 |
</p> |
| 3884 |
|
3751 |
|
| 3885 |
</body> |
3752 |
</body> |