satorix-rails 1.1.3 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d4ef84ca0df1a11113cc1263bbf189175407c5d
4
- data.tar.gz: 6a34c381ffa8b434a6f353739d9051e902caf1ad
3
+ metadata.gz: 0b9d6f9e7b878b946c92879ecdca57539e17b726
4
+ data.tar.gz: 51f759acfe38d749d2d629f9c0c2d0aaba1c4a2a
5
5
  SHA512:
6
- metadata.gz: 2aa290ad8cd46ee7696287c1daf79e987c66ea8aff2d2ed6ebcb055585f1edbca268624251d11689b87b7e70308e11b095dc92819f56c70e8fafd2103ba0b663
7
- data.tar.gz: a4b6cd6a753369c3e176eee0ba3b120349970ba1cde599dbc66bb7c14d2cb2a15559c0048dc93f14f0e12a652c427564afec44ea4325afb437c45c2ff967310a
6
+ metadata.gz: 3061312baa499d9421499caf785bb7239c6199e1d8811f6b6fb996a1e31c65cafe5485fcef62b81a6d9e785313c1428bb8dc6fb363260bc00b6cfdd4cc4ecc79
7
+ data.tar.gz: 98dc15e19de99dc0e7f160aa5a265b9fee5525b87a6c3f4cc7d215990dd8dad9d14f4db91fb27690c8dbc5f5d2e5b50bd2e3542031ab10223a5f96f51fd38255
data/README.md CHANGED
@@ -6,22 +6,19 @@ By [Internet Exposure](https://www.iexposure.com/)
6
6
  [![coverage](http://gitlab.iexposure.com/satorix/satorix-rails/badges/master/coverage.svg)](http://gitlab.iexposure.com/satorix/satorix-rails/pipelines)
7
7
 
8
8
 
9
- [Satorix](http://gitlab.iexposure.com/satorix/satorix) is a full-featured CI/CD pipeline developed by Internet Exposure.
9
+ [Satorix](https://www.satorix.com): Get your app from local to live
10
10
 
11
- The satorix-rails gem provides a streamlined mechanism for a 12-factor capable Rails application to interact with the Satorix ecosystem.
11
+ The `satorix-rails` gem provides a streamlined mechanism for a 12-factor capable Rails application to interact with the Satorix ecosystem.
12
12
 
13
-
14
- ## Getting Started
13
+ ## Preparing your application
15
14
 
16
15
  Add Satorix to your Rails application by including it in your Gemfile with:
17
16
 
18
17
  ```ruby
19
- source 'https://gems.iexposure.com' do
20
- gem 'satorix-rails'
21
- end
18
+ gem 'satorix-rails'
22
19
  ```
23
20
 
24
- Run the bundle command to install it.
21
+ Run the `bundle` command to install it.
25
22
 
26
23
  Next, run the generator from a terminal at the root of your application:
27
24
 
@@ -29,7 +26,7 @@ Next, run the generator from a terminal at the root of your application:
29
26
  $ rails g satorix:install
30
27
  ```
31
28
 
32
- Congratulations, your application is now suitable for deployment into Satorix.
29
+ This creates a set of files that utilize environment variables created by default with Satorix. These include the [Phusion Passenger Rails app server](https://www.phusionpassenger.com/) and the Passenger built in Nginx web server.
33
30
 
34
31
  # Logging in Rails 4 and below
35
32
 
@@ -40,57 +37,62 @@ You will need to either:
40
37
  * add `gem 'rails_12factor', group: :production` to your Gemfile
41
38
  * Set `config.logger = Logger.new(STDOUT)` in `config/environments/production.rb`
42
39
 
40
+ # Configuring your application
43
41
 
44
- ## What's Included
42
+ You can configure your application on a per-environment basis using environment variables.
45
43
 
44
+ ### Default environment Variables
46
45
 
47
- ## Environment Variables
46
+ The following default environment variables are used by the `satorix-rails` generated files and can be managed through the Satorix Dashboard:
48
47
 
49
- You can configure your application on a per-environment basis using environment variables.
48
+ ##### SATORIX_CANONICAL_URI_HOST
50
49
 
51
- The following environment variables are used by the generated files:
50
+ *Optional*, a domain to rewrite all requests to by default. Setting this will make it so all requests to your site will go to the supplied domain.
52
51
 
53
- Using the Satorix Dashboard? You can relax, all of these variables are automatically configured for you.
52
+ Common setting:
54
53
 
55
- ##### SATORIX_AUTHENTICATION_USER_NAMES_AND_PASSWORDS
54
+ * `www.domain.dom`
56
55
 
57
- Optional
56
+ ##### SATORIX_CANONICAL_URI_PROTOCOL
58
57
 
59
- Hashed usernames:passwords, newline separated
58
+ *Optional*, the `HTTP` protocol to rewrite requests to.
60
59
 
61
- ##### SATORIX_AUTHENTICATION_ALLOWED_IPS
60
+ Valid settings:
62
61
 
63
- Optional
62
+ * `http`
63
+ * `https`
64
64
 
65
- Valid settings:
65
+ ##### SATORIX_PROXY_IPS
66
66
 
67
- * all (`all`)
68
- * single IP (`192.168.101.2`)
69
- * single IP range (`192.168.101.0/24`)
70
- * multiple IPs/ranges (`192.168.101.3 192.168.1.4`)
67
+ *Optional*, used to define proxy IP addresses, for services like CloudFlare. This will allow you to get the actual client IP address accessing your site in the logs and accessible to your application.
71
68
 
72
- ##### SATORIX_CANONICAL_URI_HOST
69
+ Valid settings:
73
70
 
74
- Optional
71
+ * Space separated list of IPs or network ranges (`103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 104.16.0.0/12 108.162.192.0/18 131.0.72.0/22 141.101.64.0/18 162.158.0.0/15 172.64.0.0/13 173.245.48.0/20 188.114.96.0/20 190.93.240.0/20 197.234.240.0/22 198.41.128.0/17 199.27.128.0/21`)
75
72
 
76
- If specified, t
73
+ ##### SATORIX_AUTHENTICATION_HTPASSWDS
77
74
 
78
- ##### SATORIX_CANONICAL_URI_PROTOCOL
75
+ *Optional*, used to control access to your site with HTTP Basic authentication. Needs to be generated in the format created by the Apache tool `htpasswd -nb username password` or using an [online generator](http://www.htaccesstools.com/htpasswd-generator/).
79
76
 
80
- Optional
77
+ Valid settings:
81
78
 
82
- ##### SATORIX_PROXY_IPS
79
+ * Newline separated list of username and hashed password (`username:$apr1$vAxBKb8N$m0en1zabtHktHeFyT3j9y`)
80
+
81
+ ##### SATORIX_AUTHENTICATION_ALLOWED_IPS
83
82
 
84
- was NGINX_ADDITIONAL_REAL_IPS
83
+ *Optional*, used to control access to your site by bypassing the above HTTP Basic authentication. If set to `all` no authentication will be required. Any IP addresses or networks added here will not need to supply the username and password to access the site.
85
84
 
86
- Used to define proxy IP addresses, for services like CloudFlare.
85
+ Valid settings:
87
86
 
87
+ * All (`all`)
88
+ * Single IP (`192.168.1.2`)
89
+ * Network range (`192.168.1.0/24`)
90
+ * Space separated list of multiple IPs or network ranges (`192.168.1.3 192.168.2.0/24`)
88
91
 
89
92
  ## Contributing
90
93
 
91
94
  Please coordinate contributions using the [official issue tracker](http://gitlab.iexposure.com/satorix/satorix-rails/issues).
92
95
 
93
-
94
96
  ## Testing
95
97
 
96
98
  This application is tested using [rspec](http://rspec.info/).
@@ -100,8 +102,7 @@ You can run the same tests that run during CI with:
100
102
  ```
101
103
  bundle exec rspec spec
102
104
  ```
103
-
104
-
105
+
105
106
  ## CI/CD
106
107
 
107
108
  Satorix is used to provide continuous integration and continuous deployment for this application.
@@ -110,9 +111,6 @@ CI is run against every push.
110
111
 
111
112
  CD is used to build and publish the gem for the master branch.
112
113
 
113
-
114
-
115
114
  ## License
116
115
 
117
-
118
116
  The Satorix gem is released under the terms described in the [LICENSE file](LICENSE).
@@ -13,7 +13,6 @@ module Satorix
13
13
 
14
14
  template 'install/config/passenger_standalone/nginx.conf.erb', 'config/passenger_standalone/nginx.conf.erb'
15
15
 
16
- template 'install/config/passenger_standalone/includes/htpasswd_source.erb', 'config/passenger_standalone/includes/htpasswd_source.erb'
17
16
  template 'install/config/passenger_standalone/includes/authentication.erb', 'config/passenger_standalone/includes/authentication.erb'
18
17
  template 'install/config/passenger_standalone/includes/page_level_redirects.erb', 'config/passenger_standalone/includes/page_level_redirects.erb'
19
18
  template 'install/config/passenger_standalone/includes/proxy_configuration.erb', 'config/passenger_standalone/includes/proxy_configuration.erb'
@@ -12,7 +12,7 @@ module Satorix
12
12
  # You can add your own logic to do whatever you want.
13
13
  def go
14
14
  # Uncomment the line below if you want to execute in the context of the app's buildpack.
15
- # Satorix::CI::Test::Shared::Buildpack.go
15
+ # Satorix::CI::Test::Shared::BuildpackManager.go
16
16
  puts "\n\nRunning BareBones#go..."
17
17
  end
18
18
 
@@ -13,7 +13,7 @@ module Satorix
13
13
  # You can add your own logic to do whatever you want.
14
14
  def go
15
15
  # Uncomment the line below if you want to execute in the context of the app's buildpack.
16
- # Satorix::CI::Test::Shared::Buildpack.go
16
+ # Satorix::CI::Test::Shared::BuildpackManager.go
17
17
 
18
18
  log_bench('Describing logging...') do
19
19
  describe_log
@@ -1,28 +1,41 @@
1
1
  # Authentication
2
- #
3
- # Allow listed networks to access without auth, otherwise require password
4
- <%%
5
- password_files = {}
6
2
 
7
- # Write out htpasswd file(s), from source files in config/passenger_standalone/includes
8
- # to allow dynamically generated htpasswd file(s), most likely from env vars.
9
- %w[htpasswd].each do |password_file|
10
- passenger_standalone_includes = File.expand_path(__dir__)
11
- password_files[password_file] = File.join( passenger_standalone_includes, password_file )
12
- contents = include_passenger_custom_template("#{ password_file }_source.erb")
13
- File.open(password_files[password_file], 'w') {|f| f.write(contents) }
3
+ <%%-
4
+ # The password_files hash defines which password files will be written out.
5
+ # The generated password files should be ignored from version control.
6
+ # Each desired password file should be specified as a key, with the value being a source for the file contents.
7
+ # The contents should include hashed username/password combinations, separated by whitespace.
8
+ # These can be generated using the htpasswd application, or an online tool like http://www.htaccesstools.com/htpasswd-generator/
9
+ # For more info, see: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/
10
+ password_files = {
11
+ 'htpasswd' => ENV['SATORIX_AUTHENTICATION_HTPASSWDS']
12
+ }
13
+
14
+ def password_file_location(filename)
15
+ passenger_standalone_includes_location = File.expand_path(__dir__)
16
+ File.join( passenger_standalone_includes_location, filename )
17
+ end
18
+
19
+ password_files.each do |filename, raw_contents|
20
+ contents = raw_contents.to_s.split.join("\n")
21
+ File.open(password_file_location(filename), 'w') {|f| f.write(contents) } unless contents.empty?
14
22
  end
15
- %>
16
23
 
24
+ allowed_without_auth = ENV['SATORIX_AUTHENTICATION_ALLOWED_IPS'].to_s.split
25
+ allowed_without_auth = ['all'] if allowed_without_auth.empty?
26
+ -%>
27
+
28
+ # Allow listed networks to access without auth, otherwise require password if defined
17
29
  location / {
18
30
  satisfy any;
19
- <%% ENV['SATORIX_AUTHENTICATION_ALLOWED_IPS'].to_s.split(' ').each do |target| -%>
31
+ <%% allowed_without_auth.each do |target| -%>
20
32
  allow <%%= target %>;
21
33
  <%% end -%>
22
- deny all;
34
+ deny all;
35
+ <%% if File.file?(password_file_location('htpasswd')) -%>
23
36
  auth_basic "Please Log In";
24
- auth_basic_user_file <%%= password_files['htpasswd'] %>;
37
+ auth_basic_user_file <%%= password_file_location('htpasswd') %>;
38
+ <%% end -%>
25
39
  }
26
40
 
27
-
28
41
  # End Authentication
@@ -21,7 +21,7 @@
21
21
  <%% end %>
22
22
 
23
23
  # Use the internal Flynn network set X-Forwarded-For header for access IPs.
24
- set_real_ip_from 100.100.0.0/16;
24
+ set_real_ip_from <%%= ENV['SATORIX_REAL_IP_FROM'] || '100.100.0.0/16' %>;
25
25
  real_ip_header X-Forwarded-For;
26
26
 
27
27
  # End Proxy Configuration
@@ -1,7 +1,7 @@
1
1
  module Satorix
2
2
  module Rails
3
3
  module Version
4
- VERSION = '1.1.3'
4
+ VERSION = '1.1.8'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: satorix-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Internet Exposure
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-11 00:00:00.000000000 Z
11
+ date: 2019-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: passenger
@@ -93,7 +93,6 @@ files:
93
93
  - lib/rails/generators/templates/install/.gitlab-ci.yml
94
94
  - lib/rails/generators/templates/install/Procfile
95
95
  - lib/rails/generators/templates/install/config/passenger_standalone/includes/authentication.erb
96
- - lib/rails/generators/templates/install/config/passenger_standalone/includes/htpasswd_source.erb
97
96
  - lib/rails/generators/templates/install/config/passenger_standalone/includes/page_level_redirects.erb
98
97
  - lib/rails/generators/templates/install/config/passenger_standalone/includes/proxy_configuration.erb
99
98
  - lib/rails/generators/templates/install/config/passenger_standalone/nginx.conf.erb
@@ -1,6 +0,0 @@
1
- <%%# This value should include hashed username/password combinations, separated by whitespace -%>
2
- <%%# These can be generated using the htpasswd application, or an online tool like http://www.htaccesstools.com/htpasswd-generator/ -%>
3
- <%%# For more info, see: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/ -%>
4
- <%%= ENV['SATORIX_AUTHENTICATION_HTPASSWDS'].to_s.split.join("\n") %>
5
-
6
-