PDA

View Full Version : How can i stop ppl from uploading stupid files in wrong dirs ?


Mouton
03-12-2004, 04:57 PM
Got tired today of kids sending .nfo files in CD2 dirs... and trigerring imdb announces x times per upload.
So i stopped them liked that.

[VFS]
Upload = */CD?/*.nfo !*
Upload = */Sample/*.nfo !*
Upload = /DVDR/*/DVD?/*.nfo !*
Upload = /DVDR/*/DISC?/*.nfo !*

The match isn't case-sensitive, so those will match cd1 and CD1 and Cd1, etc.

*edit 2: Changed a little the DVD? and DISC? lines ;)

Flare2
03-12-2004, 04:58 PM
thx nice script

MatC
03-12-2004, 05:31 PM
Good idea :banana:

Zer0Racer
03-13-2004, 05:32 AM
To continue this little io tips n tricks...

To deny download of contents in nuked dirs, but allow nfo-files:
Download = */[[]NUKED]-*/*.nfo *
Download = */[[]NUKED]-* !*

To deny download of your site tags (if they are files, not dirs):
Download = */[[]Site]* !*

Change those to match your site.

Dunno how to deny download of dirs. I think ftp clients only take the name of the dir and makes MKD <that dir> on target, instead of RETR <dirname>. So the site tags (dirs) would still end up on other sites if users, without proper skiplist set, downloads from your site.

Another thing comes into mind that could be used - denying MKD in dirs like CD1, CD2 that would create Some.rel-ZERO/CD1/CD1 or similar:

MakeDir = /DVDR/*/DVD[1-9]/*/* !*
MakeDir = /DVDR/*/DISC[1-9]/*/* !*
MakeDir = */CD[1-9]/*/* !*

Edit: Added the DVD? and DISC? too. Stealing Moutons ideas here.
Edit2: Corrected dvdr rules etc.
Edit3: Replaced CD[123456789] (and CD?) with CD[1-9] etc.

Note: Why does it have to be [[]NUKED]-* instead of [NUKED]-* ?

[NUKED]-* would try to match dirs named N-*, U-*, K-* etc.

biboun
03-13-2004, 05:52 AM
Nice tips Mouton :banana: & ZeroRacer :cool:

epoke
03-13-2004, 07:03 AM
héhé thx i 'll try it today ;)

@tte

Mouton
03-13-2004, 01:01 PM
The right syntaxt for Zer0's suggestions for makedir would be:

MakeDir = /DVDR/*/DVD?/*/* !*
MakeDir = /DVDR/*/DISC?/*/* !*
MakeDir = */CD?/*/* !*

Otherwise, you won't even be able to MKD CDx dirs at all...

Zer0Racer
03-13-2004, 04:52 PM
Originally posted by Mouton
The right syntaxt for Zer0's suggestions for makedir would be:

MakeDir = /DVDR/*/DVD?/*/* !*
MakeDir = /DVDR/*/DISC?/*/* !*
MakeDir = */CD?/*/* !*

Otherwise, you won't even be able to MKD CDx dirs at all...

Ah, point taken. My syntax would mess upp dirs like /incoming/dvdr :) But please explain to me why it has to be with those double /*/* at the end. I wouldn't allow MKD in any DVD1, DISC1 dirs. Or am I missing something here?

Also to be more precise and only match numbers for the missing character could be to use CD[1-9] and DVD[1-9] etc.

Edit: Replaced CD[123456789] with CD[1-9].

mr_F_2
03-13-2004, 06:06 PM
zer0racer:

MakeDir = /DVDR/*/DISC?/*/* !*

Section = /DVDR
Releasename = /*
Disc# = /DISC?
Disc# Subdirectory = /*
Filename = /*

So it's like:

MakeDir = /Section/releasename(*)/Disc?/all_subdirs_arent_allowed(*)/nothing_is_allowed_for_filename(*)

hope that explains it for you

Zer0Racer
03-13-2004, 06:16 PM
Doesn't make sense since I wanna block MakeDir, not uploading files. If the dir is not there, no files can be uploaded in it. They would get permission denied on the MKD and No such file or directory on STOR to */DISC1/DISC1 or whatever.

Example:
MakeDir = /DVDR/*/DISC1/* !*

...would mean 'nobody has permission to create a dir inside any dir called DISC1 under /DVDR'

That should be enough.

Edit: Okay, the above doesn't work. Even though I think it should :)

mr_F_2
03-13-2004, 08:30 PM
because
MakeDir = /DVDR/*/DISC1/* !*

will block paths like this being created:
/DVDR/releasename/DISC1/*

meaning * as file wildcard, that's the way io works.

I see what you're saying "why does makedir need a wildcard for a file?"
My guess is because d1 doesn't have to modify the routine he uses to check if permissions. Considering many of other permissions can work with dirs and filenames, it only makes sense to use the same routine so as not having to write another routine.

MakeDir = /DVDR/*/DISC1/*/* !*
is necessary, as it means to block:
/DVDR/releasename/DISC1/any_subdir/*


I might be wrong, and that might not even make sense.

Zer0Racer
03-14-2004, 03:58 AM
After some testing and trying to understand the double /*/* I think if come up with something that 'works' in my head. :)

MakeDir = */CD[1-9]/* !* would indeed mean 'i wanna block MKD of anything matching this rule' Ie. MKD cd1 anywhere would match it.

Where as MakeDir = */CD[1-9]/*/* !* would match path called */CD[1-9]/* as above and the last /* would mean INSIDE any path matching */CD[1-9]/*.

It works like this even if it doesn't make perfect sense. :)

Zer0Racer
03-14-2004, 04:20 AM
To take things even further, and use my trial and error on */dir/* ...

To block any dir between CD4 and CD9 (anywhere) plus blocking MKD inside any CD1 -> CD9 dir (as above):

MakeDir = */CD[1-9]/*/* !*
MakeDir = */CD[4-9]/* !*

And maybe to never allow more than two dvdr discs:
MakeDir = /DVDR/*/DISC[1-9]/*/* !*
MakeDir = /DVDR/*/DVD[1-9]/*/* !*
MakeDir = /DVDR/*/DISC[3-9]/* !*
MakeDir = /DVDR/*/DVD[3-9]/* !*

Or if you never wanna allow more than 1 disc dvdr:
MakeDir = /DVDR/*/DISC[1-9]/* !*
MakeDir = /DVDR/*/DVD[1-9]/* !*

Basically the same set of rules used in different situations.

Update:
To block upload of files directly in section dir but still allow new dirs and upload in those new dirs...
Upload = /DVDR/*/*/* *
Upload = /DVDR/*/* !*
Upload = /REQUESTS/*/*/* *
Upload = /REQUESTS/*/* !*
etc.

Looks crazy, but it works.

Anymore ideas on what could be done?

Mouton
03-14-2004, 10:04 PM
Originally posted by Zer0Racer
But please explain to me why it has to be with those double /*/* at the end. I wouldn't allow MKD in any DVD1, DISC1 dirs. Or am I missing something here?In fact, to make it more understandable, the last star is not needed:

MakeDir = */CD?/*/* !*
should be
MakeDir = */CD?/*/ !*

But since * means anything, including nothing, having a trailing * doesn't change anything.

And that was also the problem with your old rules...
MakeDir = */CD?/* !*
is equivalent to
MakeDir = */CD?/ !*
and would match MKD /somedir/CD1/
so nobody could MKD a CD1 dir anywhere...

By adding another dir level, we deny MKD of any subdir inside a CD? dir:
MakeDir = */CD?/*/* !*
would match MKD /somedir/CD1/some.other.dir/
but not MKD /somedir/CD1/

zpr
05-26-2004, 04:38 PM
everything you guys wrote was cool stuff, so i added some in my ioftpd.ini

but got some problems... first my upload settings from ioftpd.ini:

Upload = */CD?/*.nfo !*
Upload = */Sample/*.nfo !*
Upload = /DVDR/*/DVD?/*.nfo !*
Upload = /DVDR/*/DISC?/*.nfo !*
Upload = /other_sections_here/*/*/* *
Upload = /other_sections_here/*/* !*
Upload = /REQUEST/*/*/* *
Upload = /REQUEST/*/* !*
Upload = * !-testtt *
Upload = * *

user 'testtt' should not be able to upload anywhere.

when i try to upload zip file in REQUEST dir i got disconnected from ftp, like this:

TYPE I
200 Type set to I.
PROT P
200 Protection set to: Private.
PORT 127,0,0,1,18,204
200 PORT command successful.
STOR up_test.zip
Connected. Negotiating SSL/TLS session.. (<- using auth ssl)
Connection lost: test_ftp

i reconnect, try to reupload and ffxp disconnects again

or maybe i fuxored some upload = ... settings, hm...

thx in advance.

regards