Skip to contentSkip to conversation

Internet-Draft on Port Randomisation

DISCUSSION Eugene Teo 4 participants 6 messages Sep 9, 2008

Subsystems (2)
lore
Share & tools
lore

Eugene Teo

author
#0 lore raw

Has anyone read this Internet-Draft?
http://www.gont.com.ar/drafts/port-randomization/draft-ietf-tsvwg-port-randomization-02.txt

In this memo, there are descriptions of four different ephemeral port randomisation algorithms (see page 17).

Algo #1 and #2 are simple port randomisation algorithms. Algo #3 is what we have in Linux. The memo suggested algorithm #4, double-hash randomisation algorithm, which is an improvement to algo #3 (see page 15).

Does anyone have any thought about the improved algorithm? Is this worth implementing, given the possible additional overhead that it has?

Thanks, Eugene

#1 lore raw
Quoted 6 lines · Eugene Teo

Has anyone read this Internet-Draft?
http://www.gont.com.ar/drafts/port-randomization/draft-ietf-tsvwg-port-randomization-02.txt

In this memo, there are descriptions of four different ephemeral port randomisation algorithms (see page 17).

Quoted 7 lines

Algo #1 and #2 are simple port randomisation algorithms. Algo #3 is what we have in Linux. The memo suggested algorithm #4, double-hash randomisation algorithm, which is an improvement to algo #3 (see page 15).

Does anyone have any thought about the improved algorithm? Is this worth implementing,

No the added lock overhead of a global next free port array is not worth it. Think of big web server under DoS pressure. The existing port search can run in parallel, Algo #4 was suggested by people who don't work on a real SMP OS.

author
#2 lore raw
Quoted 14 lines · Stephen Hemminger
Quoted 13 lines · Eugene Teo

Has anyone read this Internet-Draft?

http://www.gont.com.ar/drafts/port-randomization/draft-ietf-tsvwg-port-randomization-02.txt

In this memo, there are descriptions of four different ephemeral port randomisation algorithms (see page 17).

Algo #1 and #2 are simple port randomisation algorithms. Algo #3 is what we have in Linux. The memo suggested algorithm #4, double-hash randomisation algorithm, which is an improvement to algo #3 (see page 15).

Quoted 8 lines
Quoted 2 lines

Does anyone have any thought about the improved algorithm? Is this worth implementing,

No the added lock overhead of a global next free port array is not worth it. Think of big web server under
DoS pressure. The existing port search can run in parallel, Algo #4 was suggested by people
who don't work on a real SMP OS.

Thanks Stephen.

Eugene

#3 lore raw
In reply to Stephen Hemminger
Quoted 12 lines · Stephen Hemminger
Quoted 11 lines · Eugene Teo

Has anyone read this Internet-Draft?
http://www.gont.com.ar/drafts/port-randomization/draft-ietf-tsvwg-port-randomization-02.txt

In this memo, there are descriptions of four different ephemeral port randomisation algorithms (see page 17).

Algo #1 and #2 are simple port randomisation algorithms. Algo #3 is what we have in Linux. The memo suggested algorithm #4, double-hash randomisation algorithm, which is an improvement to algo #3 (see page 15).

Quoted 4 lines
Quoted 2 lines

Does anyone have any thought about the improved algorithm? Is this worth implementing,

No the added lock overhead of a global next free port array is not worth it.

[haven't read the draft] But you don't necessarily need a full global lock for such a scheme. What works too is to access global state only ever N accesses and pre-allocate a small range per CPU. While there's still some global overhead then, it happens significantly less. My old alternative ipid setup algorithm worked this way.

One drawback of such a scheme today: on RT kernels the per CPU state tends to be become a problem.

-Andi

Signature · 1 line
[email protected]
maintainer
#4 lore raw

From: Andi Kleen <[email protected]>
Date: Tue, 09 Sep 2008 16:28:30 +0200

Quoted 5 lines

[haven't read the draft] But you don't necessarily need a full global lock for such a scheme. What works too is to access global state only ever N accesses and pre-allocate a small range per CPU. While there's still some global overhead then, it happens significantly less. My old alternative ipid setup algorithm worked this way.

Should work well on a 64K cpu system.

#5 lore raw
Quoted 10 lines · David Miller

From: Andi Kleen <[email protected]>
Date: Tue, 09 Sep 2008 16:28:30 +0200

Quoted 5 lines

[haven't read the draft] But you don't necessarily need a full global lock for such a scheme. What works too is to access global state only ever N accesses and pre-allocate a small range per CPU. While there's still some global overhead then, it happens significantly less. My old alternative ipid setup algorithm worked this way.

Should work well on a 64K cpu system.

If you make N large enough it can work with pretty much any number of CPUs. The main drawback is that it's losing random bits the larger N is, but then 64k is not really remotely secure anyways.

Due to the later reason I doubt such a change is very interesting. Also there's the issue on fully preemptible kernels.

If you wanted a more secure port space what would like make more sense is to use IPv6 and use e.g. 32bit out of the local network address space for port randomization too.

-Andi

Signature · 1 line
[email protected]