Added update module

This commit is contained in:
Alexey Berezhok
2026-05-03 00:54:14 +03:00
parent 54f549db62
commit 8add078e7c
9 changed files with 292 additions and 10 deletions

View File

@@ -1,5 +1,7 @@
#!/opt/brepo/ruby33/bin/ruby
require 'shellwords'
class BunkerwebWorker < Kernel::ModuleCoreWorker
MODULE_ID = "bunkerweb_module"
@@ -95,7 +97,7 @@ class BunkerwebWorker < Kernel::ModuleCoreWorker
if m_domain.nil? || m_ssl_cert.nil? || m_ssl_key.nil? || m_ssl_cert.empty? || m_ssl_key.empty?
log_return("Domain, SSL cert and SSL key must be specified. #{args}")
else
log("add ssl cert to bunkerweb protection")
log("update ssl cert to bunkerweb protection")
output = `/usr/local/hestia/bin/v-bunkerweb-module updssl #{m_domain} #{m_ssl_cert} #{m_ssl_key} shell`
exit_status = $?.exitstatus
if exit_status != 0
@@ -104,6 +106,21 @@ class BunkerwebWorker < Kernel::ModuleCoreWorker
ACTION_OK
end
end
when "deletessl"
m_domain = args[1].strip unless args[1].nil?
if m_domain.nil?
log_return("Domain should be specified. #{args}")
else
log("delete ssl cert to bunkerweb protection")
output = `/usr/local/hestia/bin/v-bunkerweb-module deletessl #{m_domain} shell`
exit_status = $?.exitstatus
if exit_status != 0
log_return("Command failed with status #{exit_status}")
else
ACTION_OK
end
end
when "list"
format = (args[1].nil? ? "shell" : args[1].strip)
log("list of services")
@@ -157,7 +174,6 @@ class BunkerwebWorker < Kernel::ModuleCoreWorker
hestia_print_array_of_hashes(result, format, "API_USERNAME,API_PASSWORD,ADMIN_USERNAME,ADMIN_PASSWORD")
ACTION_OK
when "configure"
require 'shellwords'
param1 = args[1]
param2 = args[2]
if param1 && param2 && !param1.strip.empty? && !param2.strip.empty?