Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
rudimentary htaccess security
Browse files Browse the repository at this point in the history
  • Loading branch information
mroi committed May 31, 2016
1 parent 6334297 commit 6bd7660
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
33 changes: 15 additions & 18 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
<FilesMatch "^\.ht.*">
deny from all
satisfy all
ErrorDocument 403 "Access to these files is forbidden!"
</FilesMatch>
DirectoryIndex index.cgi
AddHandler cgi-script .cgi

<FilesMatch "^data.yaml$">
deny from all
satisfy all
ErrorDocument 403 "Access to these files is forbidden!"
</FilesMatch>
RewriteEngine on
RewriteBase /

RewriteEngine On
RewriteRule \.git.* /data.yaml

Options +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex index.cgi
# add trailing slash to subdirectory requests
RewriteRule ^([^./]+)$ $1/ [R=permanent,L]


<FilesMatch "^(.*\.css|favicon\.ico|[^./]+)$">
Satisfy any
Allow from all
</FilesMatch>

ErrorDocument 500 /error.cgi
ErrorDocument 404 /not_found.cgi
ErrorDocument 401 /authorization_required.cgi
<Files data.yaml>
Deny from all
</Files>
4 changes: 4 additions & 0 deletions .htaccess.poll
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<FilesMatch "^(|index\.cgi)$">
Satisfy any
Allow from all
</FilesMatch>
1 change: 1 addition & 0 deletions index.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ if $cgi.include?("create_poll") && $cgi.include?("poll_url")
createnotice = _("A Poll with this address already exists.")
else Dir.mkdir(POLLURL)
Dir.chdir(POLLURL)
File.symlink("../.htaccess.poll",".htaccess")
File.symlink("../participate.rb","index.cgi")
["overview", "edit_columns", "delete_poll", "invite_participants"].each{|f|
File.symlink("../#{f}.rb","#{f}.cgi")
Expand Down

0 comments on commit 6bd7660

Please sign in to comment.