Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add pom and Mavenfile and revised readme

  • Loading branch information...
commit 22741938ee36d546725e1c1267937b0bfd4b9070 1 parent cf167a7
Christian Meier authored
2  .gitignore
View
@@ -1,2 +1,4 @@
target
+*.files
*.pom
+*~
14 README.textile
View
@@ -1,8 +1,8 @@
h1. Enforce SSL for you controllers
-p. with the advent of hijacking tools for dummies like "firesheep":http://codebutler.github.com/firesheep the need for securing your sessions with ssl is there.
+p. with the advent of hijacking tools for dummies like "firesheep":http://codebutler.github.com/firesheep the need for securing your sessions with ssl is there and it is important that every and any request goes over ssl. this plugin does make the server side *secure* by redirecting the browser to the ssl port if not used. the client side there is "HTTP_Strict_Transport_Security (HSTS)":http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security which is implemented by all modern browsers but it relies on a valid (not self-signed) certificate. with that HSTS header in place the browser uses only https requests to communicate with the server.
-p. this is derived from the "rails/ssl_requirement":http://github.org/rails/ssl_requirement and adopted a more strict approach: *secure everything and open it where needed*.
+p. this gem is derived from the "rails/ssl_requirement":http://github.org/rails/ssl_requirement and adopted a more strict approach: *secure everything and open it where needed*. also it adds HSTS support per default on production - you can turn it off per config.
p. info about the actual gem please look into the directory "enforce-ssl-gem":http://github.org/mkristian/enforce-ssl/tree/master/enforce-ssl-gem
@@ -12,12 +12,16 @@ p. the "demo":http://github.org/mkristian/enforce-ssl/tree/master/demo is a samp
h2. run all the tests + integrations-tests in one go
-p. first you need jruby for this ! then you need to install
+p. first you need jruby for this ! then you need to install ruby-maven
-bc. jruby -S gem 'ruby-maven'
+bc. jruby -S gem install ruby-maven
p. which allows to run the integration-tests from the demo with jetty.
p. now you can execute
-bc. rmvn verify
+bc. rmvn install
+
+h2. ruby-maven
+
+p. this gem comes with command *jetty-run* which runs a jetty server with a http port and https port so with this you "test" this rails plugin. in case you start the regular webrick on port 3000 (or any other then 8080) will not apply the ssl redirect, so you can develop your application as usual with those server.
4 enforce-ssl-gem/Mavenfile
View
@@ -0,0 +1,4 @@
+execute_in_phase(:install) do
+puts "hello"
+end
+properties['jruby.plugins.version'] = '0.25.0-SNAPSHOT'
30 enforce-ssl-gem/README.textile
View
@@ -1,33 +1,41 @@
h1. Enforce SSL for you controllers
-p. this is derived from the "rails/ssl_requirement":http://github.org/rails/ssl_requirement and adopted a more strict approach: *secure everything and open it where needed*.
-
-p. info about the actual gem please look into the directory "enforce-ssl-gem":http://github.org/mkristian/enforce-ssl/tree/master/enforce-ssl-gem
+p. this is derived from the "rails/ssl_requirement":http://github.org/rails/ssl_requirement and adopted a more strict approach: *secure everything and open it when and where needed*.
h2. usage
-p. it requires rails2. for installation add the gem in 'Gemfile'
+p. it requires rails3. for installation add the gem in _Gemfile_
bc. gem 'enforce-ssl'
-p. this activates the 'enforce-ssl' before_filter for all controllers, i.e.
+p. this activates the *enforce-ssl* before_filter for all controllers, i.e.
all requests which comes in as http will be redirected to the https url obeying the configured ssl port.
-h3. configure the ssl port
+h3. configure the ssl/no_ssl port
-p. configure the enforced ssl port with (default => { development => 3000, production => 443)
+p. configure the enforced ssl port with (default => { development => 8080/8443, production => 80/443)
bc. config.ssl_port = 8443
+ config.no_ssl_port = 8080
+
+p. for development you can do that in _config/environments/development.rb_.
+
+h3. configure HSTS - HTTP Strict Transport Security
+
+p. there are two config parameters for HSTS: hsts_include_sub_domain (default false) and hsts_max_age (default 31536000 which is one year in seconds).
+
+p. these configuration is *only used during production* so it sufficient to configure it in _config/environments/production.rb_
-p. for development you can do that in 'config/environments/development.rb'.
+bc. config.hsts_include_sub_domain = false
+ config.hsts_max_age = 31536000
h3. using a webserver which listens to http + https
-p. if your Gemfile allows to JRuby as interpreter then you can use the *jetty-run* from the *ruby-maven* gem (jruby only) to have both an http and an https port listing for requests.
+p. if your Gemfile allows to use JRuby as interpreter then you can use the *jetty-run* from the *ruby-maven* gem (jruby only) to have both an http and an https port listing for requests. that is how the defaults are set up.
-p. webrick can handle ssl as well here a blog which explains how to get ssl working for "webrick and rails3":http://www.nearinfinity.com/blogs/chris_rohr/configuring_webrick_to_use_ssl.html. but you have *only* ssl then !
+p. webrick can handle ssl as well. here a blog which explains how to get ssl working for "webrick and rails3":http://www.nearinfinity.com/blogs/chris_rohr/configuring_webrick_to_use_ssl.html. but you have *only* ssl then and you need to configure the ssl_port correctly.
-p. maybe other servers can offer you both ssl and none-ssl . . .
+p. maybe other servers can offer both ssl and none-ssl . . .
p. *NOTE*: use *https://* in your url when using the ssl port or webrick with ssl
13 enforce-ssl-gem/enforce-ssl.gemspec
View
@@ -17,17 +17,4 @@ Gem::Specification.new do |s|
# s.rdoc_options = ['--main','README.textile']
s.files += Dir['lib/**/*']
s.add_development_dependency 'rake', '0.8.7'
-
- s.post_install_message = <<-TEXT
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-configure the enforced ssl port with
-(default => { development => 3000, production => 443 }):
-
- config.ssl_port = 8443
-
-for development you can do that in 'config/environments/development.rb'.
-you can use 'jetty-run' from 'ruby-maven' gem (jruby only) to have both
-an http and an https port listing for requests.
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-TEXT
end
Please sign in to comment.
Something went wrong with that request. Please try again.