Rewritemap question

E

Eric

Can anyone give me an example of using Rewritemap to block domains?
I want to be able to list domains in a text file to block

ie:
domain1.com
domain2.com
domain3.com
domain4.com


and the Rewrite rules would be "Forbidden"ing anything
coming from those domains. so 123.xx.domain1.com will be
forbidden but notice the map file only contains the base
domain.
Thanks
Eric
 
J

Jan Faerber

Eric loudly proclaimed:
Can anyone give me an example of using Rewritemap to block domains?
I want to be able to list domains in a text file to block

ie:

http://tinyurl.com/69q39

You asked this yesterday on alt.apache.configuration and found a solution.
I am sure there is a syntax for 'anything that ends in "click-network.com"
to be [F] or even just dropped'.
 
E

Eric

Jan said:
Eric loudly proclaimed:
Can anyone give me an example of using Rewritemap to block domains?
I want to be able to list domains in a text file to block

ie:

http://tinyurl.com/69q39

You asked this yesterday on alt.apache.configuration and found a solution.
I am sure there is a syntax for 'anything that ends in "click-network.com"
to be [F] or even just dropped'.
Thought i found a solution but it didnt work.
Eric
 
J

Jan Faerber

Eric loudly proclaimed:
Thought i found a solution but it didnt work.


Do you know Drag'N'Drop?
Drag your server out of the window and then drop it.
 
T

Toby Inkster

Eric said:
Can anyone give me an example of using Rewritemap to block domains?

This bit:
notice the map file only contains the base domain.

Makes your task so much more difficult.

If you really want to do it, it can be done with named pipes, assuming a
Unix server.
 
E

Eric

Toby said:
This bit:


Makes your task so much more difficult.

Yeh, i know, in fact what i am thinking is that i will write a C
program and use that instead, should be a simple thing to match the domain
in a map file to the var (if i understand this right anyway)
so if i do this:
hosts-deny prg:/mycustomCprog

and then
RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND [OR]
RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND
RewriteRule ^/.* - [F]

will the values of REMOTE_HOST and then REMOTE_ADDR var be passed to my C
prog via stdin? If i know those values then i can easily return a match by
just read & parse line in file (say it returns domain1.com)
checking strstr(PassedInREMOTE_HOST, "domain1.com)
if domain1.com is anywhere in that var then its a match.
Seems pretty straight forward, but maybe i misunderstand the flow there.
Thanks
Eric

If you really want to do it, it can be done with named pipes, assuming a
Unix server.
Yes, I'm on Linux - but named pipes? I know what they are but not sure how
to approach that.
Thanks
Eric
 
T

Toby Inkster

Eric said:
Yes, I'm on Linux - but named pipes? I know what they are but not sure how
to approach that.

Your C program is a better bet.

Named pipes are basically this:

You create a named pipe (aka "fifo") on the file system. A fifo
mostly looks just like any other file.

However, when a program tries to read the contents of that fifo, it
is reading the output of another program.

It's a messy solution though.
 
L

Leif K-Brooks

Eric said:
Byte=8 bits

No, an octet is eight bits; a byte is the smallest unit of memory
addressable by a particular system. Most computers today use eight-bit
bytes, but that's not set in stone.
 
E

Eric

Leif said:
No, an octet is eight bits; a byte is the smallest unit of memory
addressable by a particular system. Most computers today use eight-bit
bytes, but that's not set in stone.

Sorry, 8 bits is now and always has been a byte, 1024 bytes is a kilobyte
and 1024 kilobytes is a megabyte, but if you insist then you can keep right
on with your imaginary units such as kibibit mebibyte etc.. Why people feel
they have to change these standard computer units i dont know, it must make
them feel elite, intelectual or something.
Eric
 
X

xeno

Sorry, 8 bits is now and always has been a byte, 1024 bytes is a kilobyte
and 1024 kilobytes is a megabyte, but if you insist then you can keep right
on with your imaginary units such as kibibit mebibyte etc.. Why people feel
they have to change these standard computer units i dont know, it must make
them feel elite, intelectual or something.

Octet is the French word for byte and because the French consider
their language als the only international language, you get
discussions like this :)
 
O

Oli Filth

Eric said:
Sorry, 8 bits is now and always has been a byte,

No, not true. Leif's description was correct.

However, even if a system's smallest unit of addressable memory happens
to be, say, 14 bits, then it's typical to call that a 14-bit *word* and
still refer to 8 bit chunks as a byte.
 
T

Toby Inkster

Eric said:
Sorry, 8 bits is now and always has been a byte,

A lot of older computers had 6 or 7 bit bytes. Some older 36-bit computers
used 9-bit bytes. Such architectures have mostly been obsolete for 20 or
30 years though.

C99 (the standard for the C programming language) even explicitly allows
for architectures with non-8-bit bytes. It defines a byte has having "at
least 8 bits".
 
A

Andy Dingley

Sorry, 8 bits is now and always has been a byte,

Nope, plenty of 7 bit bytes around. That's why we had to start
talking about "octets", which are _always_ 8 bits. Bytes don't go over
8 bits, but parity bits can take the byte below 8 (the byte is the
piece _inside_ the stop, start and parity bits, not including them).

I've personally used 5 and 6 bit bytes, on a particularly obscure
Telex gateway (Baudot code is either 5 bit and modal, or an implied 6
bits). But that really is perverse.

The smallest unit of addressing is the _word_ though, which can range
from 1 bit to 40+ bits on systems I've used. A 16 bit machine might
have 16 bit words, but it still has 8 bit bytes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top