satorix-rails 1.1.2 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea69f318d33aa1f658b2189bfe2027a407657d67
4
- data.tar.gz: 931a8ed3d24b835e268c740ae3aaf9aaa2eb6403
3
+ metadata.gz: ee5e2a9bca28a5625d0d6c611c585d1d6b32b02a
4
+ data.tar.gz: 678aed79747a3c59bcdca0a9f2cf435feaa5823a
5
5
  SHA512:
6
- metadata.gz: 32e46008825d1d80ad6d2e0e8f3623d4a6536902047067674b53943e5c27f7f10528989f5fb93e0932bf32a07d06ee44df6159168b4326484007239216c4a4f0
7
- data.tar.gz: 8ef2a83b2998fcacefe60d9a0712349ceab7f7c401b268ff703944937203ed19f738528a55196e560515faf3098aefe033f3c9240cbadde2d1b748d4aa0a12e9
6
+ metadata.gz: 83da29607fba4219c0377040617fe74a45b4d8c473ced5ad3d07e9e5454c6929b8a23a8fb2339a66ea5a2fa391642123d13d007d83ab7790f640034826ad51eb
7
+ data.tar.gz: 9ef8a25c787bf82dfa15f7ac41d338209c54cd084c33921797e15f5449f633e40e64a585f3ff066d257f0eba8cee79be51d34b0bc9ca73431d060b220ee0dc36
data/.gitignore CHANGED
@@ -7,3 +7,7 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+
11
+ # Rubymine files
12
+ /.idea
13
+ /config/initializers/rubymine_passenger_debug.rb
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.4.1
1
+ ruby-2.4.5
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- ruby File.open("#{ File.dirname(__FILE__) }/.ruby-version", &:gets).strip[/ruby-(.+)/i, 1]
1
+ ruby "#{ File.open("#{ File.dirname(__FILE__) }/.ruby-version", &:gets).strip[/ruby-(.+)/i, 1] }"
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
@@ -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', 'config/passenger_standalone/includes/htpasswd'
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,14 +1,41 @@
1
-
2
1
  # Authentication
3
- #
4
- # Allow listed networks to access without auth, otherwise require password
5
2
 
6
- satisfy any;
7
- <%% ENV['SATORIX_AUTHENTICATION_ALLOWED_IPS'].to_s.split(' ').each do |target| %>
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?
22
+ end
23
+
24
+ allowed_without_auth = ENV['SATORIX_AUTHENTICATION_ALLOWED_IPS'].to_s.split
25
+ allowed_without_auth = ['any'] if allowed_without_auth.empty?
26
+ -%>
27
+
28
+ # Allow listed networks to access without auth, otherwise require password if defined
29
+ location / {
30
+ satisfy any;
31
+ deny all;
32
+ <%% allowed_without_auth.each do |target| -%>
8
33
  allow <%%= target %>;
9
- <%% end %>
10
- deny all;
11
- auth_basic "Please Log In";
12
- auth_basic_user_file /app/config/passenger_standalone/includes/htpasswd;
34
+ <%% end -%>
35
+ <%% if File.file?(password_file_location('htpasswd')) -%>
36
+ auth_basic "Please Log In";
37
+ auth_basic_user_file <%%= password_file_location('htpasswd') %>;
38
+ <%% end -%>
39
+ }
13
40
 
14
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,6 +1,3 @@
1
- # passenger start --nginx-config-template config/passenger_standalone/nginx.conf.erb --debug-nginx-config
2
-
3
-
4
1
  ##########################################################################
5
2
  # Passenger Standalone is built on the same technology that powers
6
3
  # Passenger for Nginx, so any configuration option supported by Passenger
@@ -8,13 +5,12 @@
8
5
  # this by direct editing the Nginx configuration template that is used by
9
6
  # Passenger Standalone.
10
7
  #
11
- # This file is the original template. DO NOT EDIT THIS FILE DIRECTLY.
12
- # Instead, make a copy of this file and pass the `--nginx-config-template`
13
- # parameter to Passenger Standalone.
14
- #
15
8
  # Learn more about using the Nginx configuration template at:
16
9
  # https://www.phusionpassenger.com/library/config/standalone/intro.html#nginx-configuration-template
17
10
  #
11
+ # To test this configuration template run:
12
+ # passenger start --nginx-config-template config/passenger_standalone/nginx.conf.erb --debug-nginx-config
13
+ #
18
14
  # *** NOTE ***
19
15
  # If you customize the template file, make sure you keep an eye on the
20
16
  # original template file and merge any changes. New Phusion Passenger
@@ -22,8 +18,17 @@
22
18
  ##############################################################
23
19
 
24
20
  <%%
25
- def include_passenger_custom_template(template)
26
- ERB.new(File.read( File.join( File.dirname(__FILE__), 'includes', template ) )).result(binding)
21
+ def include_passenger_custom_template(template, indent = 0, the_binding = get_binding)
22
+ path = File.join(File.dirname(__FILE__), 'includes', template)
23
+ erb = ERB.new(File.read(path), nil, "-", next_eoutvar)
24
+ erb.filename = path
25
+ result = erb.result(the_binding)
26
+
27
+ # Set indenting
28
+ result.gsub!(/^/, " " * indent)
29
+ result.gsub!(/\A +/, '')
30
+
31
+ result
27
32
  end
28
33
 
29
34
  def use_canonical?
@@ -108,9 +113,9 @@ http {
108
113
  <%%= include_passenger_internal_template('server.erb', 8, true, binding) %>
109
114
  <%%= include_passenger_internal_template('rails_asset_pipeline.erb', 8, false) %>
110
115
 
111
- <%%= include_passenger_custom_template('page_level_redirects.erb') %>
112
- <%%= include_passenger_custom_template('proxy_configuration.erb') %>
113
- <%%= include_passenger_custom_template('authentication.erb') %>
116
+ <%%= include_passenger_custom_template('page_level_redirects.erb', 8, binding) %>
117
+ <%%= include_passenger_custom_template('proxy_configuration.erb', 8, binding) %>
118
+ <%%= include_passenger_custom_template('authentication.erb', 8, binding) %>
114
119
 
115
120
  ### BEGIN your own configuration options ###
116
121
  # This is a good place to put your own config options.
@@ -1,7 +1,7 @@
1
1
  module Satorix
2
2
  module Rails
3
3
  module Version
4
- VERSION = '1.1.2'
4
+ VERSION = '1.1.7'
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.2
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Internet Exposure
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2019-09-13 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
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 +0,0 @@
1
- iestaging:$apr1$b4UNgid/$jVoc0rRDzUfmldUp9.DK8.