-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix_subs_after_migration
- Loading branch information
Showing
41 changed files
with
488 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
engines/instance_verification/config/environments/production.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# :nocov: | ||
module InstanceVerification | ||
class Application < Rails::Application | ||
config.cache_config_file = '/var/lib/rmt/rmt-cache-trim.sh' | ||
config.repo_cache_dir = '/run/rmt/cache/repository' | ||
cache_config_content = [ | ||
"REPOSITORY_CLIENT_CACHE_DIRECTORY=#{config.repo_cache_dir}", | ||
'REPOSITORY_CACHE_EXPIRY_MINUTES=20' | ||
].join("\n") | ||
File.write(config.cache_config_file, cache_config_content) | ||
end | ||
end | ||
# :nocov: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# The test environment is used exclusively to run your application's | ||
# test suite. You never need to work with it otherwise. Remember that | ||
# your test database is "scratch space" for the test suite and is wiped | ||
# and recreated between test runs. Don't rely on the data there! | ||
|
||
Rails.application.configure do | ||
config.cache_config_file = Rails.root.join('engines/registry/spec/data/rmt-cache-trim.sh') | ||
config.repo_cache_dir = 'repo/cache' | ||
config.registry_cache_dir = 'registry/cache' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# :nocov: | ||
module Registry | ||
class Application < Rails::Application | ||
# registry config needed | ||
config.autoloader = :classic | ||
config.registry_private_key = OpenSSL::PKey::RSA.new( | ||
File.read('/etc/rmt/ssl/internal-registry.key') | ||
) | ||
config.registry_public_key = config.registry_private_key.public_key | ||
config.access_policies = '/etc/rmt/access_policies.yml' | ||
end | ||
end | ||
# :nocov: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# The test environment is used exclusively to run your application's | ||
# test suite. You never need to work with it otherwise. Remember that | ||
# your test database is "scratch space" for the test suite and is wiped | ||
# and recreated between test runs. Don't rely on the data there! | ||
|
||
Rails.application.configure do | ||
config.access_policies = 'engines/registry/spec/data/access_policies.yml' | ||
config.registry_private_key = OpenSSL::PKey::RSA.new(2048) | ||
config.registry_public_key = config.registry_private_key.public_key | ||
config.autoload_paths << Rails.root.join('engines/registry/spec/support/') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,34 @@ | ||
module Registry | ||
class << self | ||
def remove_auth_cache(registry_cache_key) | ||
cache_path = File.join(Rails.application.config.registry_cache_dir, registry_cache_key) | ||
File.unlink(registry_cache_path) if File.exist?(cache_path) | ||
end | ||
end | ||
|
||
class Engine < ::Rails::Engine | ||
isolate_namespace Registry | ||
config.generators.api_only = true | ||
|
||
config.after_initialize do | ||
Api::Connect::V3::Systems::ActivationsController.class_eval do | ||
before_action :handle_auth_cache, only: %w[index] | ||
|
||
def handle_auth_cache | ||
unless ZypperAuth.verify_instance(request, logger, @system) | ||
render(xml: { error: 'Instance verification failed' }, status: :forbidden) | ||
end | ||
end | ||
end | ||
|
||
Api::Connect::V3::Systems::SystemsController.class_eval do | ||
before_action :remove_auth_cache, only: %w[deregister] | ||
|
||
def remove_auth_cache | ||
registry_cache_key = [request.remote_ip, @system.login].join('-') | ||
Registry.remove_auth_cache(registry_cache_key) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.