Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

prevent script execution upload directories php shtml

// description of your code here

<Directory "/Library/MediaWiki/web/images">
   # Ignore .htaccess files
   AllowOverride None
 
   # Serve HTML as plaintext, don't execute SHTML
   AddType text/plain .html .htm .shtml
 
   # Don't run arbitrary PHP code.
   php_admin_flag engine off
 
   # If you've other scripting languages, disable them too.
</Directory>

Update to ClamAV 0.94

Compile ClamAV from source on Mac OS X, but apply the following changes to /private/var/clamavadmin/clamd.conf.
# cf. man 5 clamd.conf after update

# delete the following two lines in /private/var/clamavadmin/clamd.conf
ArchiveMaxFileSize 100M
ArchiveMaxCompressionRatio 0

# add the following two lines to /private/var/clamavadmin/clamd.conf
MaxFileSize 300M
MaxScanSize 150M

References:
- What's New: ClamAV 0.94
- What's New: ClamAV 0.94.1

Protect .svn directories using htaccess

// block access to .svn dirs
// should be done server-wide if you can (another snippet)

<IfModule mod_rewrite.c>
  RewriteRule ^(.*/)?\.svn/ - [F,L]
  ErrorDocument 403 "Access Forbidden"
</IfModule>

Protect .svn directories server-wide (Apache)

// protect ".svn" and "CVS" dirs (could add more)
// for server-wide protection; goes in httpd.conf
// there's a separate snippet for .htaccess-based code

<DirectoryMatch "^/.*/(\.svn|CVS)/">
  Order deny,allow
  Deny from all 
</DirectoryMatch>

FIND INSECURE 777 PERMISSION FILES ON CPANEL SERVER

// FIND INSECURE 777 PERMISSION FILES ON CPANEL SERVER

find /home/*/public_html/ -perm 0777 -ls
find /home*/public_html/ -uid 99 -ls

Using HTTP conditions and url.access-deny to have Lighttpd block some user agents and referers

# deny access for Indy Library a Tester
$HTTP["useragent"] =~ "Indy" { url.access-deny = ( "" ) }
 
# deny access for a hydrocodone containing refer 
$HTTP["referer"] =~ "hydrocodone" { url.access-deny = ( "" ) }