Skip to contentSkip to conversation

iptables v1.3.4: STRING match: You must specify `--algo'

DISCUSSION Jasbir Khehra 2 participants 3 messages Nov 7, 2005 – Nov 12, 2005 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi,
while running this command

# iptables -t nat -I PREROUTING -p tcp -s 192.168.2.20 -m string
--hex-string '0d0a0d0a594d5347' -j REJECT

Not able to get the different options for '--algo' parameter . Kernel 2.6.14 iptables v1.3.4 thanks - Jasbir

#1 lore raw
Quoted 7 lines · Jasbir Khehra

Hi,
while running this command

# iptables -t nat -I PREROUTING -p tcp -s 192.168.2.20 -m string
--hex-string '0d0a0d0a594d5347' -j REJECT

Not able to get the different options for '--algo' parameter . Kernel 2.6.14 iptables v1.3.4 thanks - Jasbir

--algo [bm|kmp]

bm: Boyer-Moore
kmp: Knuth-Pratt-Morris

Those are the algorithm implemented at the moment.

BTW, you should do that in the raw table, not nat. Nobody should use the nat table for filtering purposes.

Signature · 1 line
Pablo
#3 lore raw
In reply to a message not in the archive
Quoted 31 lines · Jasbir Khehra

On 11/8/05, *Pablo Neira* <[email protected] <mailto:[email protected]>> wrote:

    Jasbir Khehra wrote:
    > Hi,
    >    while  running this command
    > # iptables -t nat -I PREROUTING -p tcp -s 192.168.2.20
    <http://192.168.2.20> -m string
    > --hex-string '0d0a0d0a594d5347' -j REJECT
    >
    > Not able to get the different options for '--algo' parameter .
    > Kernel 2.6.14 iptables v1.3.4  thanks - Jasbir

    --algo [bm|kmp]

    bm: Boyer-Moore
    kmp: Knuth-Pratt-Morris

    Those are the algorithm implemented at the moment.

    BTW, you should do that in the raw table, not nat. Nobody should use the
    nat table for filtering purposes.

    --
    Pablo
Quoted 7 lines

Thankz Pablo for the reply and the "string" module :) . I redifined my rule now and after some googling found the right syntax for using the "--hex-string"

# iptables -t raw -A PREROUTING -s $source_ip -m string --algo bm
--hex-string "|0d 0a 59 4d 53 47|" -j DROP
Whats the initial position/counter for the "--from" parameter  0 or 1
and does it start from the IP header ?

Yes, the IP header. Use --from 0 for the initial position.

Signature · 1 line
Pablo