satorix-rails 1.1.2 → 1.1.3

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: 0d4ef84ca0df1a11113cc1263bbf189175407c5d
4
+ data.tar.gz: 6a34c381ffa8b434a6f353739d9051e902caf1ad
5
5
  SHA512:
6
- metadata.gz: 32e46008825d1d80ad6d2e0e8f3623d4a6536902047067674b53943e5c27f7f10528989f5fb93e0932bf32a07d06ee44df6159168b4326484007239216c4a4f0
7
- data.tar.gz: 8ef2a83b2998fcacefe60d9a0712349ceab7f7c401b268ff703944937203ed19f738528a55196e560515faf3098aefe033f3c9240cbadde2d1b748d4aa0a12e9
6
+ metadata.gz: 2aa290ad8cd46ee7696287c1daf79e987c66ea8aff2d2ed6ebcb055585f1edbca268624251d11689b87b7e70308e11b095dc92819f56c70e8fafd2103ba0b663
7
+ data.tar.gz: a4b6cd6a753369c3e176eee0ba3b120349970ba1cde599dbc66bb7c14d2cb2a15559c0048dc93f14f0e12a652c427564afec44ea4325afb437c45c2ff967310a
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,7 @@ 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'
16
+ template 'install/config/passenger_standalone/includes/htpasswd_source.erb', 'config/passenger_standalone/includes/htpasswd_source.erb'
17
17
  template 'install/config/passenger_standalone/includes/authentication.erb', 'config/passenger_standalone/includes/authentication.erb'
18
18
  template 'install/config/passenger_standalone/includes/page_level_redirects.erb', 'config/passenger_standalone/includes/page_level_redirects.erb'
19
19
  template 'install/config/passenger_standalone/includes/proxy_configuration.erb', 'config/passenger_standalone/includes/proxy_configuration.erb'
@@ -1,14 +1,28 @@
1
-
2
1
  # Authentication
3
2
  #
4
3
  # Allow listed networks to access without auth, otherwise require password
4
+ <%%
5
+ password_files = {}
6
+
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) }
14
+ end
15
+ %>
5
16
 
6
- satisfy any;
7
- <%% ENV['SATORIX_AUTHENTICATION_ALLOWED_IPS'].to_s.split(' ').each do |target| %>
17
+ location / {
18
+ satisfy any;
19
+ <%% ENV['SATORIX_AUTHENTICATION_ALLOWED_IPS'].to_s.split(' ').each do |target| -%>
8
20
  allow <%%= target %>;
9
- <%% end %>
10
- deny all;
11
- auth_basic "Please Log In";
12
- auth_basic_user_file /app/config/passenger_standalone/includes/htpasswd;
21
+ <%% end -%>
22
+ deny all;
23
+ auth_basic "Please Log In";
24
+ auth_basic_user_file <%%= password_files['htpasswd'] %>;
25
+ }
26
+
13
27
 
14
28
  # End Authentication
@@ -0,0 +1,6 @@
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
+
@@ -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.3'
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.3
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-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: passenger
@@ -93,7 +93,7 @@ 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
96
+ - lib/rails/generators/templates/install/config/passenger_standalone/includes/htpasswd_source.erb
97
97
  - lib/rails/generators/templates/install/config/passenger_standalone/includes/page_level_redirects.erb
98
98
  - lib/rails/generators/templates/install/config/passenger_standalone/includes/proxy_configuration.erb
99
99
  - lib/rails/generators/templates/install/config/passenger_standalone/nginx.conf.erb
@@ -1 +0,0 @@
1
- iestaging:$apr1$b4UNgid/$jVoc0rRDzUfmldUp9.DK8.