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