smart_proxy_shellhooks 0.9.1 → 0.9.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
  SHA256:
3
- metadata.gz: 8fb140ee88a525e810ef2e989aaf54bed73747cdf3d4da434f23d3f82b5a9571
4
- data.tar.gz: 489d0ee9b913e06470ad6c0e05d148fa9321ed27be115608756cca81f08d6678
3
+ metadata.gz: 1e061eb911543192bd2bbe883ec1cd187c6fa4959caad88fed0b262e9eff07fb
4
+ data.tar.gz: f8ceeacfd512558776ae6b8f5599e8e3142e4484970dfafef67ce788ddf3fac8
5
5
  SHA512:
6
- metadata.gz: f6c37f82b64fece7c8f576bdc17a16bdec36b08c28327abb7c42cff40c158d834acf6f97a5b800f8c7ac22f15ff3a33abbced4a3132652aa163d73e8b74f1dab
7
- data.tar.gz: 7eb778176299851eaad9b27d06131317390c3107e4395e092a4cd3d87d482bd9d20f351af0992413316d4537d58806bc96038ed7bb910317eff9c93e4dac9b9d
6
+ metadata.gz: 79088ea74e01d619f1841345f0da3e0decddcd570a2b2458902be94a6a03c520c2868240908bf7a38d6284a0598a1ba62e7e3ff3b8574628204af3511be04a6c
7
+ data.tar.gz: 800ebeef19985c96fd2101328a2f1953090baedf9397d74922ba65fc3239ef069a6971949c547147cfe87b878121e94ad4dcfea002f8e3d7ec408dabd2a3aa9c
data/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # Smart Proxy Shell Hooks
2
2
 
3
- Provides an endpoint for foreman_webhooks plugin executing binaries (shell scripts, python scripts, anything). Remember CGI? :-)
3
+ Provides an endpoint for foreman_webhooks plugin executing binaries (shell scripts, python scripts, anything).
4
4
 
5
5
  ## Installation
6
6
 
7
- Install the plugin using the foreman-installer. Never enable this service via HTTP endpoint, only HTTPS with authentication using client certificate should be used.
7
+ Install the plugin using the foreman-installer. Never enable this service via HTTP endpoint, only HTTPS with authentication using client certificate and with trusted hosts should be used.
8
8
 
9
- Open up `/var/lib/foreman/shellhooks` to see some examples, these are harmless stubs that does nothing.
9
+ Open up `/var/lib/foreman-proxy/shellhooks` to see some examples, these are harmless stubs that do nothing as a starting point.
10
10
 
11
11
  ## Writing scripts
12
12
 
13
- Script must be placed in `/var/lib/foreman/shellhooks` having a name consisting of alphanums, dash or underscore. The file must be executable. To see list of availble and valid scripts matching the requirements, perform:
13
+ Script must be placed in `/var/lib/foreman-proxy/shellhooks` having a name consisting of alphanums, dash or underscore. The file must be executable. To see list of availble and valid scripts matching the requirements, perform:
14
14
 
15
15
  $ curl -s https://localhost:9090/shellhook/ | jq
16
16
  {
@@ -34,7 +34,7 @@ To execute an example script which prints input back to output (smart-proxy log)
34
34
 
35
35
  To find out if the script was executed, open up smart-proxy log:
36
36
 
37
- 2020-08-27T12:23:37 eabe1a74 [I] Started POST /shellhook/print_body
37
+ 2020-08-27T12:23:37 eabe1a74 [I] Started POST /shellhook/print_body
38
38
  2020-08-27T12:23:37 eabe1a74 [D] Headers: {"HTTP_HOST"=>"localhost:9090", "HTTP_USER_AGENT"=>"curl/7.69.1", "HTTP_ACCEPT"=>"*/*", "HTTP_VERSION"=>"HTTP/1.1"}
39
39
  2020-08-27T12:23:37 eabe1a74 [D] Body: This is a test
40
40
  2020-08-27T12:23:37 eabe1a74 [I] Finished POST /shellhook/print_body with 200 (0.68 ms)
@@ -66,5 +66,5 @@ This can be useful for passing database ID or other simple fields so standard JS
66
66
  * The return (exit) value is only logged into the smart-proxy logger.
67
67
  * Optionally HTTP headers X-Shellhook-Arg-1 to N are passed as arguments.
68
68
  * HTTP return code is 200 when script was executed (not output) or non-200 when the plugin failed (not script).
69
- * Keep in mind all the input is usafe, clean every individual data element or argument to prevent security vulnerability.
69
+ * Keep in mind all the input is unsafe, clean every individual data element or argument to prevent security vulnerability.
70
70
  * Example templates are shipped with foreman_webhooks plugin and few scripts with this plugin.
data/examples/print_args CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/bin/sh
2
2
  #
3
- # Prints all arguments
3
+ # Prints all arguments to stderr
4
4
  #
5
- echo "$@"
5
+ echo "$@" >&2
@@ -6,7 +6,6 @@ module Proxy::ShellHooks
6
6
 
7
7
  default_settings :directory => '/var/lib/foreman/shellhooks'
8
8
 
9
- http_rackup_path File.expand_path('shellhooks_http_config.ru', File.expand_path('../', __FILE__))
10
- https_rackup_path File.expand_path('shellhooks_http_config.ru', File.expand_path('../', __FILE__))
9
+ rackup_path File.expand_path('shellhooks_http_config.ru', __dir__)
11
10
  end
12
11
  end
@@ -8,6 +8,9 @@ module Proxy::ShellHooks
8
8
  include ::Proxy::Log
9
9
  helpers ::Proxy::Helpers
10
10
 
11
+ authorize_with_ssl_client
12
+ authorize_with_trusted_hosts
13
+
11
14
  get '/' do
12
15
  executable = []
13
16
  other = []
@@ -1,5 +1,5 @@
1
1
  module Proxy
2
2
  module ShellHooks
3
- VERSION = '0.9.1'
3
+ VERSION = '0.9.3'
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  ---
2
- # always enable HTTPS only
3
- #:enabled: https
2
+ # Use https for production deployments. http and true only make sense in development
4
3
  :enabled: false
5
- # directory with executables
4
+
5
+ # Directory with executables.
6
6
  :directory: /var/lib/foreman-proxy/shellhooks
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_shellhooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Zapletal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-05 00:00:00.000000000 Z
11
+ date: 2024-05-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides easy integration with 3rd parties for Foreman
14
14
  email: lzap+spam@redhat.com
@@ -50,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  requirements: []
53
- rubygems_version: 3.1.2
53
+ rubygems_version: 3.5.9
54
54
  signing_key:
55
55
  specification_version: 4
56
56
  summary: Run shell scripts via Foreman webhooks