# This is a sample Configuration-File for ProFTP.
# It establishes a single server with Upload-Directory 
# and Ratios for Anonymous.
#
# Tested with Proftpd <http://www.proftpd.org/> 1.3.1_rc2-r3
# 
# Additional read proftpd(1), proftpd.conf(5) or
# http://www.proftpd.org/docs/
#
# Basic's
ServerName					"Welcome on my ftp-Server"
ServerType					standalone
DefaultServer					on
ServerIdent					on "Welcome on my own ftp"

# Default Port (RFC 1700)
Port                            		21

# _I am_ the Boss!
ServerAdmin					bofh@3d-crew.com

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask                           		022

# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances                    		30

# Set the user and group that the server normally runs at.
User                            		nobody
Group                           		nogroup

# chroot() all User
DefaultRoot 					~/

# maximum command length permitted
CommandBufferSize 				70

# Well.. i think it's better to hide the real permissions 
# before => drwxr-xr-x   5 ftp         users        4096 Feb 24 05:28 advisories
# after  => drwxr-xr-x   5 dreckskind  dreckskind   4096 Feb 24 04:28 advisories
DirFakeUser                   			on	dreckskind
DirFakeGroup                  			on	dreckskind
DirFakeMode 					0640

# Disallow clients from any access to hidden files.
<Limit READ DIRS>
	IgnoreHidden                        	on
</Limit>

# U can use "Magic Cookies" in this Messages. Following Cokkies
# at disposal:
# %T aktuelle Zeit
# %F verfuegbarer Platz auf dem Dateisystem
# %C aktuelles Verzeichnis
# %R Remote Rechner Name
# %L Lokaler Rechner Name
# %u Benutzername, der vom ident Protokoll uebergeben wurde
# %U Benutzername, der beim Login uebergeben wurde
# %M maximale Anzahl von Verbindungen
# %N aktuelle Anzahl von Verbindungen
# %E Email Adresse vom Admin
# %x der Name der Benutzer Klasse
# %y aktuelle Anzahl der Verbindung in der Klasse des Users
# %z maximale Anzahl der Verbindung in der Klasse des Users 
DisplayConnect					/home/ftp/.msg/.connect
DisplayLogin					.msg/.login
DisplayQuit					/home/ftp/.msg/.quit
DisplayReadme					INDEX
DisplayGoAway					/home/ftp/.msg/.goaway
AccessDenyMsg					"-= : { Access for %u denided } : =-"
AccessGrantMsg 					"-= : { Access for %u allowed } : =-"

# Timeout's
TimeoutIdle					800
TimeoutLogin					300
TimeoutNoTransfer				800
TimeoutStalled					0

# Connections
MaxClients					100 "sry, zuviel User"
MaxClientsPerHost				10  "Wieviel denn noch?!"
MaxLoginAttempts				5   "[x] go away"

# Logging
TransferLog					/var/log/proftp
LogFormat         				default "%h %l %u %t \"%r\" %s %b"
LogFormat                       		auth    "%v [%P] %h %t \"%r\" %s"
LogFormat                       		write   "%h %l %u %t \"%r\" %s %b"
ExtendedLog             			/var/log/proftp/proftpd-access.log WRITE,READ write
ExtendedLog             			/var/log/proftp/proftpd-auth.log AUTH auth

# `ls */../*/../*/../*/../*/../*/../*/../*/../*/../*/../*/../*/../*'
# `ls -a *...*/../*' 
# `quote %pass' 
# nope.. not on _my_ Server!
DenyFilter					"%"
DenyFilter					"ls ///////////////////////////////////"
DenyFilter					"\\*/"

# U can use Commands who include this regex
PathAllowFilter               			^[a-zA-Z0-9][a-zA-Z0-9\.\_-]{0,69}$

# MaxLoad
# Syntax: MaxLoad number|"none" [message]
#   The system load is the average number of processes ready to run during the
#   last minute; this number varies from system to system.
MaxLoad						10.0 "Server is busy.. seek elsewhere"

# GzipFS
# Syntax: GzipFS path [compression-factor]
GzipFS 						/home/ftp/uploads 9

# Normally, we want files to be overwriteable but do _not_ display Files
# owned by User dope (i. e. `.login', `.connect', ..)
<Directory /*>
  AllowOverwrite                		on
  HideUser					dope
</Directory>

# AOL..?! huh.. [x] go away!
<Limit LOGIN>
	Order					deny,allow
	Deny 					from .aol.com
        Allow					from all
</Limit LOGIN>

# Limit WRITE everywhere in the anonymous chroot
<Limit WRITE>
    	DenyAll
</Limit>

##### Begin Configuration for /home/ftp/uploads/ #####
# Legend:
# * CWD 	(Change Working Directory)
# * MKD 	(MaKe Directory)
# * RTFR 	(ReName FRom) 
# * RNTO 	(ReName TO)
# * DELE 	(DELEte File)
# * RMD 	(ReMove Directory)
# * RETR 	(Transfer a file from the server to the client)
# * STOR 	(Transfer a file from the client to the server)
# * SITE_CHMOD 	(Change the permissions of files on the server) 
# * READ 	(All FTP commands which deal with file reading (directory
#		listing not included). i.e. RETR, STAT, etc)
# * WRITE 	(All FTP commands which deal with file or directory
#		write/creation/deletion (MKD and RMD included))
# * DIRS 	(All FTP commands which deal with directory listing. 
#	        i.e LIST and NLST)
# * ALL		(ALL FTP commands (identical to READ WRITE DIRS). Note
#		this group has the lowest precedence of all, it will 
#		not override a limit generated by another command-group)
#
# don't forget following
# => chmod -R 777 uploads 
# => chown -R root uploads
# => chgrp -R root uploads
<Directory /home/ftp/uploads/*>
	# Deny Commands
	<Limit MKD RTFR DELE RMD RETR STOR SITE_CHMOD>
       		DenyAll
    	</Limit>

	# Allowed Commands
    	<Limit CWD>
       		AllowAll
    	</Limit>
</Directory>
##### End Configuration for /home/ftp/uploads/ #####


##### Begin Configuration for /home/ftp/uploads/$USER/ #####
<Directory /home/ftp/uploads/cat/*>
	# allow to resume uploads
	AllowStoreRestart			on

	# Allow
     	<Limit CDW STOR>
 		AllowAll
     	</Limit>

	# Deny *g*
     	<Limit MKD RMD DELE RETR RNTO SITE_CHMOD>
        	DenyAll
     	</Limit>
</Directory>

<Directory /home/ftp/uploads/doomshammer/*>
	# allow to resume uploads
	AllowStoreRestart			on
	
	# Allow
     	<Limit CDW STOR>
        	AllowAll
     	</Limit>

	# Deny *g*
     	<Limit MKD RMD DELE RETR RNTO SITE_CHMOD>
        	DenyAll
     	</Limit>
</Directory>

<Directory /home/ftp/uploads/dnode/*>
	# allow to resume uploads
	AllowStoreRestart			on

	# Allow
     	<Limit CDW STOR>
        	AllowAll
     	</Limit>

	# Deny *g*
     	<Limit MKD RMD DELE RETR RNTO SITE_CHMOD>
        	DenyAll
     	</Limit>
</Directory>
##### End Configuration for /home/ftp/uploads/$USER/ #####


##### Begin BOfH Mode #####
<Anonymous /home/ftp/>
# AOL..?! huh.. [x] go away!
<Limit LOGIN>
	Order                               	deny,allow
	Deny                                	from .aol.com
	Deny					from .msn.com
	Deny					from .hotmail.com
	Allow                               	from all
</Limit LOGIN>

	# enough is enough
	MaxClients				10 	"Sorry, max %m users -- please go away!"
	MaxClientsPerHost			2 	"Sorry, Anonymous may not connect more than one time."
	DisplayLogin				.msg/.alogin
	DisplayQuit				.msg/.aquit
	DisplayGoAway				.msg/.aaway
	DisplayFirstChdir			.msg/.upload
	AccessGrantMsg				".:{ Kiddie-Access granted for %u }:."
	AccessDenyMsg				".:{ [x] Piss off and go away %u ! }:."

	# User, Group and Usernames for Anonymous-login's
	User					ftp
	Group					ftp
        UserAlias				anonymous ftp

	# Hide files and fake permissions
	HideUser                      		dope
	DirFakeUser             		on kiddieuser
	DirFakeGroup            		on kiddiegrp
	DirFakeMode             		0644

# Limit WRITE everywhere in the anonymous chroot
<Limit WRITE>
	DenyAll
</Limit>

	# *sing* hello hello.. turn the ratios on.. (it was a Song from the
	# Shakespere Sister ;))
	# FileRatio  -> 1:1 (one File up -> one File down)
	# ByteRatio  -> 1:1 (one Byte up -> one Byte down)
	# Credits    -> 0:0 (no present's for uploaded Files)
	# (the `*' include the User's `anonymous' and `ftp')
	Ratios                       		on
	LeechRatioMsg                		".: { Ratio aktiv } :."
	UserRatio				* 1 0 1 0
	ByteRatioErrMsg              		"This file is %i big, you know...."
	FileRatioErrMsg 			"hey Dude.. _first_ upload -> _then_ download...."


	# 2K/s max, less than 64KB at full speed an after 64KB xfer _forced_ down to 2K/s
	RateReadBPS             		2024
	RateReadFreeBytes       		64000
	RateReadHardBPS         		on

	# huh.. u want upload shit? 
	PathDenyFilter                          "\\.(js|vbs|shs|scr|exe)$"
	PathDenyFilter                          "(^|/)[-.]"
	PathDenyFilter				"((^|/)[-.])|(\\.(js|vbs|shs|scr|exe)$)"
	PathDenyFilter                          "(\.ftpaccess)|(\.htaccess)$"

	# Only allow filenames containing alphanumeric characters
	PathAllowFilter               		^[a-zA-Z0-9][a-zA-Z0-9\.\_-]{0,69}$

	# hhmmm.. i think it's better to disable this "feature"
	ShowSymlinks				off
<Directory /home/ftp/uploads/anonymous/>

	# As anonymous u can do zero, nijente, nada, _nothing_ :�
	<Limit RTFR MKD RMD DELE RETR SITE_CHMOD>
		DenyAll
	</Limit>

	# U only can Upload here
	<Limit STOR>
		AllowAll
	</Limit>
 </Directory>
</Anonymous>
##### End BOfH Mode #####
