Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for multiple directories to deploy OOD extensions/customizations #3991

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/dashboard/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,17 @@ class Application < Rails::Application
config.autoload_paths << ::Configuration.config_root.join("lib").to_s
config.paths["app/views"].unshift ::Configuration.config_root.join("views").to_s
end

# Enable installed plugins only if configured by administrator
plugins_dir = Pathname.new(::Configuration.plugins_directory)
if plugins_dir.directory?
plugins_dir.children.select(&:directory?).each do |installed_plugin|
next unless installed_plugin.readable?

config.paths["config/initializers"] << installed_plugin.join("initializers").to_s
config.autoload_paths << installed_plugin.join("lib").to_s
config.paths["app/views"].unshift installed_plugin.join("views").to_s
Comment on lines +58 to +60
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should likely have additional checks here for root owned files in production. I just want to be extra doubly sure that what we load in production is indeed given by an administrator.

        init_dir = installed_plugin.join("initializers")
        safe_load = init_dir.children.all? { |f| File.stat(f.to_s).uid.zero? }
        config.paths["config/initializers"] << init_dir if safe_load

@treydock any additional thoughts here on loading trusted files?

Copy link
Contributor Author

@abujeda abujeda Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the need to make sure that the configuration is given by an admin, but why is this different from the ones we use for load_external_config?, ::Configuration.config_root (/etc/ood/config/apps/dashboard)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should patch those too, we just haven't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a change to verify that the plugin folders are owned by root when in production

end
end
end
end
5 changes: 3 additions & 2 deletions apps/dashboard/config/configuration_singleton.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ def string_configs
:rclone_extra_config => nil,
:default_profile => nil,
:project_size_timeout => '15',
:novnc_default_compression => '6',
:novnc_default_quality => '2'
:novnc_default_compression => '6',
:novnc_default_quality => '2',
:plugins_directory => '/etc/ood/config/plugins'
}.freeze
end

Expand Down
Loading