emasser 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 071f8617e2cb3f474beffbaab601a70efe914cf71a0a8a66bc519cb034b6ef2f
4
- data.tar.gz: 004b1a45e63677cdf10740e129b0e1e4d4be8bc61e52db87b43e21f7364f564b
3
+ metadata.gz: 18e0147d78cbeb98b610045c09b4ce03c5a941379e803bac7a3ecffdff566566
4
+ data.tar.gz: fa0c7a1c0b0864dc727eb358839c7825c219e5ace076c1df88ea7e03912ac9e7
5
5
  SHA512:
6
- metadata.gz: '00986c06011736c7a3633bc946d0b14bb4564f733cc275668ab82319a13bf3dddefa58a0c6b6087d1c0a244353af0f1a903656506992ea609b98fa935338cd70'
7
- data.tar.gz: b992847867a78bc81d5de0ec9a2c2c066d0ee275949a0e027f9fe70d4e83dc62886a6e55fa0c7ff885349aae2e50b2929418cb63d4cd275b4b6bb4dfda136fc2
6
+ metadata.gz: ae4215cf7639312137b9418dd0af7c75164a0db000cefe91bbb17c61849d72058a1932d6a4b87234455506bc3353cdf385028aebb5e822e813a684b92a8f6536
7
+ data.tar.gz: 639dfe19211d633dfed0ba1d66c1180d5efaac0c999226ff1fb6d5444cbd4885fde4a71ffc982bcd858e1a104c3ed6089b4bf69589e27d7831585a88182d9871
data/.dockerignore CHANGED
@@ -1,11 +1,8 @@
1
- # git
2
- .git
3
- .gitignore
4
- CHANGELOG.md
1
+ # VS Code
2
+ .vscode/
5
3
 
6
- # ci
7
- .gitlab-ci.yml
4
+ # doc
5
+ doc/
8
6
 
9
7
  # code
10
- spec
11
- .env
8
+ spec/
data/.env-example CHANGED
@@ -2,7 +2,7 @@ export EMASSER_API_KEY_API_KEY=<API key>
2
2
  export EMASSER_API_KEY_USER_UID=<unique identifier of the eMASS user EMASSER_API_KEY_API_KEY belongs to>
3
3
  export EMASSER_HOST=<FQDN of the eMASS server>
4
4
  export EMASSER_KEY_FILE_PATH=<path to your emass key in PEM format>
5
- export EMASSER_CERT_FILE_PATH=<path to your emass certficate in PEM format>
5
+ export EMASSER_CERT_FILE_PATH=<path to your emass certificate in PEM format>
6
6
  export EMASSER_KEY_PASSWORD=<password for the key given in EMASSER_KEY_FILE_PATH>
7
7
  export EMASSER_CLIENT_SIDE_VALIDATION=<client side validation - true or false>
8
8
  export EMASSER_VERIFY_SSL=<verify SSL - true or false>
@@ -1,5 +1,5 @@
1
- name-template: 'v$NEXT_PATCH_VERSION'
2
- tag-template: 'v$NEXT_PATCH_VERSION'
1
+ name-template: '$NEXT_PATCH_VERSION'
2
+ tag-template: '$NEXT_PATCH_VERSION'
3
3
  categories:
4
4
  - title: 'Features'
5
5
  labels:
@@ -0,0 +1,28 @@
1
+ name: Push emasser CLI to Docker Hub on every merge to master and tag as latest
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+
7
+
8
+ jobs:
9
+ docker:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Set up Docker Buildx
13
+ uses: docker/setup-buildx-action@v1
14
+ - name: Login to DockerHub
15
+ uses: docker/login-action@v1
16
+ with:
17
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
18
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
19
+ - name: Checkout the emasser Repository
20
+ uses: actions/checkout@v2
21
+ - name: Build and push
22
+ id: docker_build
23
+ uses: docker/build-push-action@v2
24
+ with:
25
+ context: .
26
+ file: Dockerfile
27
+ push: true
28
+ tags: mitre/emasser:latest
@@ -0,0 +1,35 @@
1
+ name: Push emasser to Docker Hub on every release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ docker:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Set up Docker Buildx
12
+ uses: docker/setup-buildx-action@v1
13
+ - name: Login to DockerHub
14
+ uses: docker/login-action@v1
15
+ with:
16
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
17
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
18
+ - name: Run string replace
19
+ uses: frabert/replace-string-action@master
20
+ id: format-tag
21
+ with:
22
+ pattern: 'v'
23
+ string: "${{ github.event.release.tag_name }}"
24
+ replace-with: ''
25
+ flags: 'g'
26
+ - name: Checkout the emasser Repository
27
+ uses: actions/checkout@v2
28
+ - name: Build and push
29
+ id: docker_build
30
+ uses: docker/build-push-action@v2
31
+ with:
32
+ context: .
33
+ file: Dockerfile
34
+ push: true
35
+ tags: mitre/emasser:release-latest,mitre/emasser:${{ steps.format-tag.outputs.replaced }}
@@ -34,9 +34,9 @@ jobs:
34
34
  run: |
35
35
  gem push --KEY rubygems --host https://rubygems.org *.gem
36
36
  gem push --KEY rubygems --host https://rubygems.org emass_client/ruby_client/*.gem
37
- - name: Publish to GPR
38
- run: |
39
- gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
40
- gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} emass_client/ruby_client/*.gem
41
- env:
42
- OWNER: mitre
37
+ # - name: Publish to GPR
38
+ # run: |
39
+ # gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
40
+ # gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} emass_client/ruby_client/*.gem
41
+ # env:
42
+ # OWNER: mitre
data/.gitignore CHANGED
@@ -11,8 +11,9 @@
11
11
 
12
12
  **/*.un~
13
13
 
14
- emassing/test/test_example.zip
15
14
  .DS_Store
16
15
  .byebug_history
17
16
  .env
17
+ key.pem
18
+ client.pem
18
19
  *.gem
data/Dockerfile CHANGED
@@ -1,10 +1,42 @@
1
- FROM ruby:2.5
1
+ # Buld from ruby 2.7.5 image
2
+ FROM ruby:2.7.5 as build
2
3
 
4
+ LABEL name="emasser" \
5
+ vendor="MITRE" \
6
+ version="${EMASSER_VERSION}" \
7
+ release="1" \
8
+ url="https://github.com/mitre/emasser" \
9
+ description="Emasser is a command-line interface (CLI) that aims to automate routine business use-cases and provide utility surrounding the Enterprise Mission Assurance Support Service (eMASS) by leveraging its representational state transfer (REST) application programming interface (API)." \
10
+ docs="https://mitre.github.io/emasser/" \
11
+ run="docker run -d --name ${NAME} ${IMAGE} <args>"
12
+
13
+ # Set the base directory that will be used from now on
3
14
  WORKDIR /emasser
4
15
 
16
+ # Install dependency
17
+ RUN gem install bundler -v '2.3.5'
18
+ RUN apt update && apt install -y build-essential
5
19
  COPY . .
6
-
7
20
  RUN bundle install
21
+ WORKDIR /emasser/emass_client/ruby_client
22
+ RUN gem build emass_client.gemspec
23
+ WORKDIR /emasser
24
+ RUN gem build emasser.gemspec
25
+ RUN mkdir gems
26
+ RUN mv emass_client/ruby_client/emass_client*.gem gems/emass_client.gem
27
+ RUN mv emasser*.gem gems/emasser.gem
28
+
29
+ FROM ruby:2-alpine
30
+
31
+ # Use the line below when testing creating the container locally
32
+ # RUN sed -i 's/https/http/g' /etc/apk/repositories
33
+ COPY --from=build /emasser/gems /emass-gems
34
+
35
+ RUN apk add build-base libcurl && gem install /emass-gems/emass_client.gem && gem install /emass-gems/emasser.gem
36
+
37
+ VOLUME [ "/data" ]
38
+ WORKDIR /data
39
+
40
+ ENTRYPOINT ["emasser"]
8
41
 
9
- ENTRYPOINT ["bundle", "exec", "exe/emasser"]
10
42
  CMD ["-h"]
data/Gemfile.lock CHANGED
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- emasser (1.0.1)
4
+ emasser (1.0.3)
5
5
  activesupport (~> 6.1.4)
6
- colorize
7
- dotenv
8
- emass_client
9
- rubyzip
10
- thor
6
+ colorize (~> 0.8.1)
7
+ dotenv (~> 2.7.6)
8
+ emass_client (~> 1.0)
9
+ rubyzip (~> 2.3.2)
10
+ thor (~> 1.1.0)
11
11
 
12
12
  PATH
13
13
  remote: emass_client/ruby_client
14
14
  specs:
15
- emass_client (1.0.1)
15
+ emass_client (1.0.3)
16
16
  json (~> 2.1, >= 2.1.0)
17
17
  typhoeus (~> 1.0, >= 1.0.1)
18
18
 
@@ -36,7 +36,7 @@ GEM
36
36
  dotenv (2.7.6)
37
37
  ethon (0.15.0)
38
38
  ffi (>= 1.15.0)
39
- ffi (1.15.4)
39
+ ffi (1.15.5-x64-mingw32)
40
40
  i18n (1.8.11)
41
41
  concurrent-ruby (~> 1.0)
42
42
  json (2.6.1)
@@ -44,7 +44,7 @@ GEM
44
44
  parallel (1.21.0)
45
45
  parser (3.1.0.0)
46
46
  ast (~> 2.4.1)
47
- rainbow (3.0.0)
47
+ rainbow (3.1.1)
48
48
  rake (13.0.6)
49
49
  regexp_parser (2.2.0)
50
50
  rexml (3.2.5)
@@ -92,12 +92,11 @@ GEM
92
92
 
93
93
  PLATFORMS
94
94
  x64-mingw32
95
- x86_64-darwin-20
96
95
 
97
96
  DEPENDENCIES
98
- bundler (~> 2.1)
97
+ bundler (~> 2.3)
99
98
  bundler-audit (~> 0.7)
100
- byebug
99
+ byebug (~> 11.1.3)
101
100
  emass_client!
102
101
  emasser!
103
102
  rake (~> 13.0)
@@ -109,4 +108,4 @@ DEPENDENCIES
109
108
  yaml (~> 0.2.0)
110
109
 
111
110
  BUNDLED WITH
112
- 2.2.32
111
+ 2.3.5
data/README.md CHANGED
@@ -1,4 +1,9 @@
1
1
  # emasser
2
+ ![GitHub Release Date](https://img.shields.io/github/release-date/mitre/emasser?label=Release%20Date)
3
+ ![GitHub release (latest by date)](https://img.shields.io/github/v/release/mitre/emasser?label=Release%20Version)
4
+ [![Gem Version](https://badge.fury.io/rb/emasser.svg)](https://badge.fury.io/rb/emasser)
5
+
6
+
2
7
  ![emasser Testing](https://github.com/mitre/emasser/actions/workflows/test-cli.yml/badge.svg)
3
8
  ![CodeQL Vulnerabilities and Errors](https://github.com/mitre/emasser/actions/workflows/codeql-analysis.yml/badge.svg)
4
9
  ![Docs Generation](https://github.com/mitre/emasser/actions/workflows/generate_docs.yml/badge.svg)
@@ -31,7 +36,7 @@ This project is actively looking for user stories, features to build, and intera
31
36
 
32
37
  ## Roadmap
33
38
 
34
- Emasser is currently in MVP development and we are targeting all the features listed in Current and In Development for version 1.0. The Road Map are things that the team and community have talked about as possible great additions but feedback on which should come first, second, and third are what we would love feedback on from you.
39
+ Emasser is currently in MVP development and we are targeting all the features listed in Current and In Development for version 1.0.X. The Road Map are things that the team and community have talked about as possible great additions but feedback on which should come first, second, and third are what we would love feedback on from you.
35
40
 
36
41
  * Update a system's record with met/not met NIST 800-53 Security and Privacy controls and/or common control indicators (CCI) based on scan results expressed in [Heimdall Data Format (HDF)](https://saf.mitre.org/#/normalize).
37
42
  * Resolve a particular plan of action and milestone (POA&M) based on scan results or git-ops workflow.
@@ -49,27 +54,83 @@ Runtime Dependencies:
49
54
  * Ruby version 2.7 or greater.
50
55
  * `rubyzip (latest version)`
51
56
  * `emass_client (latest version)`
52
- * On Windows the `cURL` binary is required (libcurl.dll). Options to install cURL for the emasser CLI to work are:
53
- - Download the curl for windows zip file from [curl x.x.x for Windows](https://curl.se/windows/)
54
- - Go into the archive and browse to /bin
55
- - Locate libcurl_x64.dll (it may be just libcurl.dll)
57
+ * On Windows the `cURL` binary is required (libcurl.dll). To install cURL:
58
+ - Download cURL for windows from [curl x.x.x for Windows](https://curl.se/windows/)
59
+ - Go into the archive and browse to the /bin directory
60
+ - Locate libcurl_x64.dll (it may be named just libcurl.dll)
56
61
  - Extract the file into the Ruby installation /bin directory
57
62
  - Rename the file to `libcurl.dll` if it has the `_x64` suffix
58
63
  - Install [cURL for windows](https://community.chocolatey.org/packages/curl) and add the installation directory to the PATH.
59
64
 
60
65
 
61
- To install:
66
+ To install (via github):
62
67
  ```bash
63
68
  git clone <path to emasser git> emasser
64
69
  cd emasser
65
- gem build *.gemspec
66
- gem install *.gem
70
+ ```
71
+ - Build the emasser gem
72
+ ```bash
73
+ gem build *.gemspec
74
+ gem install *.gem
75
+ ```
76
+ - Build the emass_client gem
77
+ ```bash
78
+ cd emass_client/ruby_client
79
+ gem build *.gemspec
80
+ gem install *.gem
81
+ ```
82
+
83
+ To install (via published RubyGems):
84
+ ```bash
85
+ gem install emasser
86
+ ```
87
+
88
+ **Note:** To run in development mode there isn't a need to build the gem, simply clone from the emasser repository and use:
89
+ ```
90
+ bundle exec exe/emasser [command]
91
+ ```
92
+
93
+ ## Using Docker
94
+ ### Run the emasser Docker Container
95
+ - To run the emasser container use:
96
+ ```
97
+ docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest
98
+ ```
99
+ - To run the emasser container in a `Windows terminal (cmd)` use:
100
+ ```
101
+ docker run --rm -v %cd%/path-to-secrets:/data mitre/emasser:latest
102
+ ```
103
+ **Notes:**
104
+ - Docker Options
105
+ - `--rm` Automatically remove the container when it exits
106
+ - `-v` Bind mount a volume
107
+ - path-to-secrets
108
+ - Path to the `.env` file and the appropriate eMASS certificates (key. pem and client.pem). See [Editing Environment Variables Configuration](https://github.com/mitre/emasser/wiki/Editing-Environment-Variables-Configuration)
109
+
110
+ ### Run emasser API client commands
111
+ - To list all GET, POST, PUT, or DELETE commands use:
112
+ ```
113
+ docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest get help
114
+ ```
115
+ ```
116
+ docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest post help
117
+ ```
118
+ ```
119
+ docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest put help
120
+ ```
121
+ ```
122
+ docker run --rm -v $PWD/path-to-secrets:/data mitre/emasser:latest delete help
123
+ ```
124
+
125
+ ### Delete (remove) the Docker Container
126
+ ```
127
+ docker rmi -f mitre/emasser
67
128
  ```
68
129
 
69
130
  ## Use
70
131
 
71
132
  **Requirement 1 & 2: Authentication and Authorization:**
72
- `emasser` requires authentication to eMASS as well as authorization to use the eMASS API. This authentication and authorization is **not** a function of `emasser` and needs to be handled directly with discussions with eMASS. `emasser` will accept credentials that are created based on those discussions.
133
+ `emasser` requires authentication to eMASS as well as authorization to use the eMASS API. This authentication and authorization is **not** a function of `emasser` and needs to be handled directly with discussions with [eMASS](https://www.dcsa.mil/is/emass/). `emasser` will accept credentials that are created based on those discussions.
73
134
 
74
135
  **Approve API Client for Actionable Requests**
75
136
  Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions.
@@ -83,7 +144,7 @@ To establish an account with eMASS and/or acquire an api-key/user-uid, contact o
83
144
  ## Design
84
145
 
85
146
  **Interactions with eMASS API:**
86
- `emasser` leverages a MITRE dependency, `emass_client`, which provides a REST API client based on a MITRE-created [OpenAPI](https://www.openapis.org/) version 3 specification based on the official eMASS version 2.3 API documentation. This design enables REST API clients to be generated in [any supported programming language](https://swagger.io/tools/swagger-codegen/). This design decision enables `emass_client` to generate a Ruby client for `emasser` and a TypeScript client that is included with [Heimdall Enterprise Server](https://github.com/mitre/heimdall2).
147
+ `emasser` leverages a MITRE dependency, `emass_client`, which provides a REST API client based on a MITRE-created [OpenAPI](https://www.openapis.org/) version 3 specification for the official eMASS version 3.2 API documentation. This design enables REST API clients to be generated in [any supported programming language](https://swagger.io/tools/swagger-codegen/). This design decision enables `emass_client` to generate a Ruby client for `emasser` and a TypeScript client that is included with [Heimdall Enterprise Server](https://github.com/mitre/heimdall2).
87
148
 
88
149
  **Business Logic:**
89
150
  Because interactions with the API are handled by a dependency, the bulk of `emasser` is business logic for accepting user input/output, reading data from eMASS or from input, transforming data, and routing data to the appropriate eMASS API endpoint. This business logic is organized into Ruby Classes and Modules based on the command or subcommand requested by the user.
data/docs/features.md CHANGED
@@ -3,13 +3,15 @@
3
3
  ## Required Environment Variables
4
4
  To facilitate setting the required environment variables the emasser CLI utilized the zero-dependency module to load these variables from a .env file. An .env-example file is provided with the required fields (listed below).
5
5
 
6
- emasser environment variables required:
6
+ emasser environment variables (required):
7
7
  * EMASSER_API_KEY_API_KEY=`<API key>`
8
8
  * EMASSER_API_KEY_USER_UID=`<unique identifier for the API Key (EMASSER_API_KEY_API_KEY)`
9
9
  * EMASSER_HOST=`<FQDN of the eMASS server>`
10
10
  * EMASSER_KEY_FILE_PATH=`<path to your eMASS key in PEM format>`
11
11
  * EMASSER_CERT_FILE_PATH=`<path to your eMASS certificate in PEM format>`
12
12
  * EMASSER_KEY_PASSWORD=`<password for the key given in EMASSER_KEY_FILE_PATH>`
13
+
14
+ emasser environment variables (optional):
13
15
  * EMASSER_CLIENT_SIDE_VALIDATION=`<client side validation - true or false>`
14
16
  * EMASSER_VERIFY_SSL=`<verify SSL - true or false>`
15
17
  * EMASSER_VERIFY_SSL_HOST=`<verify host SSL - true or false>`
@@ -19,7 +21,7 @@ emasser environment variables required:
19
21
  - To invoke any boolean parameters use --parameterName for TRUE and --no-parameterName for FALSE
20
22
  - The eMASS API provides the capability of updating multiple entries within several endpoints, however this CLI only supports updating one entry at the time.
21
23
 
22
- ## Invoking emmaser CLI Commands
24
+ ## Invoking emasser CLI Commands
23
25
 
24
26
  The CLI invoke commands listed in this document shows them when executing from the source code (after a pull from GitHub). If an executable (.gem) is created the command to invoke the endpoint is different. For example:
25
27
  - Invoking the GET systems endpoint from the source code is:
data/emasser.gemspec CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.version = Emasser::VERSION
8
8
  spec.authors = ['Amndeep Singh Mann', 'George Dias', 'Kyle Fagan', 'Robert Clark', 'Aaron Lippold']
9
9
  spec.email = ['saf@mitre.org']
10
+ spec.licenses = ['Apache-2.0']
10
11
 
11
12
  spec.summary = 'Provide an automated capability for invoving eMASS API endpoints'
12
13
  spec.description = 'emasser can be used as a gem or used from the command line to access eMASS via thei API.'
@@ -22,17 +23,17 @@ Gem::Specification.new do |spec|
22
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
24
 
24
25
  spec.add_runtime_dependency 'activesupport', '~> 6.1.4'
25
- spec.add_runtime_dependency 'colorize'
26
- spec.add_runtime_dependency 'dotenv'
27
- spec.add_runtime_dependency 'rubyzip'
28
- spec.add_runtime_dependency 'emass_client'
29
- spec.add_runtime_dependency 'thor'
26
+ spec.add_runtime_dependency 'colorize', '~> 0.8.1'
27
+ spec.add_runtime_dependency 'dotenv', '~> 2.7.6'
28
+ spec.add_runtime_dependency 'rubyzip', '~> 2.3.2'
29
+ spec.add_runtime_dependency 'thor', '~> 1.1.0'
30
+ spec.add_runtime_dependency 'emass_client', '~> 1.0'
30
31
 
31
- spec.add_development_dependency 'bundler', '~> 2.1'
32
+ spec.add_development_dependency 'bundler', '~> 2.3'
32
33
  spec.add_development_dependency 'bundler-audit', '~> 0.7'
33
- spec.add_development_dependency 'byebug'
34
- spec.add_development_dependency 'rspec', '~>3.10.0'
35
- spec.add_development_dependency 'yaml', '~>0.2.0'
34
+ spec.add_development_dependency 'byebug', '~> 11.1.3'
35
+ spec.add_development_dependency 'rspec', '~> 3.10.0'
36
+ spec.add_development_dependency 'yaml', '~> 0.2.0'
36
37
  spec.add_development_dependency 'rake', '~> 13.0'
37
38
  spec.add_development_dependency 'rubocop', '~> 1.7'
38
39
  spec.add_development_dependency 'rubocop-minitest', '~> 0.10'
data/lib/emasser/cli.rb CHANGED
@@ -16,6 +16,18 @@ module Emasser
16
16
  elsif ARGV[0].to_s.include? 'del'
17
17
  require 'emasser/delete'
18
18
  register(Emasser::Delete, 'delete', 'delete [RESOURCE]', 'Deletes resources')
19
+ elsif (ARGV[0].to_s.include? '-v') || (ARGV[0].to_s.include? '-V')
20
+ puts "emasser version: #{Emasser::VERSION}".green
21
+ exit
22
+ elsif ARGV[0].to_s.include? 'hello'
23
+ user_name = ENV['USERNAME'] || 'rookie'
24
+ puts "Hello #{user_name} - enjoy using emasser!".cyan
25
+ exit
26
+ end
27
+
28
+ def help
29
+ puts 'Emasser commands:'.yellow
30
+ puts ' emasser [get, put, post, delete, -v, or -V]'.yellow
19
31
  end
20
32
 
21
33
  def self.exit_on_failure?
@@ -8,14 +8,27 @@ module Emasser
8
8
  def self.raise_unless_present(env)
9
9
  ENV.fetch(env) { raise Emasser::ConfigurationMissingError.new(env) }
10
10
  rescue Emasser::ConfigurationMissingError => e
11
- puts e.message.red
12
- puts 'See emasser environment variables requirements in emasser CLI Features'
11
+ if (ARGV[0].to_s.include? '-v') || (ARGV[0].to_s.include? '-V')
12
+ puts "emasser version: #{Emasser::VERSION}".green
13
+ else
14
+ puts "\n", e.message.red
15
+ puts 'Create a .env file containing required variables, place it in the root directory where the emasser command is executed'.yellow
16
+ puts 'Required environment variables are:'.yellow
17
+ puts ' export EMASSER_API_KEY_API_KEY=<API key>'.green
18
+ puts ' export EMASSER_API_KEY_USER_UID=<unique identifier of the eMASS user EMASSER_API_KEY_API_KEY belongs to>'.green
19
+ puts ' export EMASSER_HOST=<FQDN of the eMASS server>'.green
20
+ puts ' export EMASSER_KEY_FILE_PATH=<path to your emass key in PEM format>'.green
21
+ puts ' export EMASSER_CERT_FILE_PATH=<path to your emass certficate in PEM format>'.green
22
+ puts ' export EMASSER_KEY_PASSWORD=<password for the key given in EMASSER_KEY_FILE_PATH>'.green, "\n"
23
+ puts 'See emasser environment variables requirements in emasser CLI Features for more information (https://mitre.github.io/emasser/docs/features.html).', "\n"
24
+ end
13
25
  exit
14
26
  end
15
27
  # rubocop: enable Style/RaiseArgs
16
28
 
17
29
  # rubocop: disable Style/TernaryParentheses, Style/IfWithBooleanLiteralBranches
18
30
  EmassClient.configure do |config|
31
+ # Required env variables
19
32
  config.api_key['api-key'] = raise_unless_present('EMASSER_API_KEY_API_KEY')
20
33
  config.api_key['user-uid'] = raise_unless_present('EMASSER_API_KEY_USER_UID')
21
34
  config.scheme = 'https'
@@ -24,10 +37,11 @@ module Emasser
24
37
  config.key_file = raise_unless_present('EMASSER_KEY_FILE_PATH')
25
38
  config.cert_file = raise_unless_present('EMASSER_CERT_FILE_PATH')
26
39
  config.key_password = raise_unless_present('EMASSER_KEY_PASSWORD')
27
- config.client_side_validation = (raise_unless_present('EMASSER_CLIENT_SIDE_VALIDATION') == 'false') ? false : true
28
- config.verify_ssl = (raise_unless_present('EMASSER_VERIFY_SSL') == 'false') ? false : true
29
- config.verify_ssl_host = (raise_unless_present('EMASSER_VERIFY_SSL_HOST') == 'false') ? false : true
30
- config.debugging = (ENV.fetch('EMASSER_DEBUGGING', false) == 'true') ? true : false
40
+ # Optional env variables
41
+ config.client_side_validation = (ENV.fetch('EMASSER_CLIENT_SIDE_VALIDATION', 'true').eql? 'true') ? true : false
42
+ config.verify_ssl = (ENV.fetch('EMASSER_VERIFY_SSL', 'true').eql? 'true') ? true : false
43
+ config.verify_ssl_host = (ENV.fetch('EMASSER_VERIFY_SSL_HOST', 'true').eql? 'true') ? true : false
44
+ config.debugging = (ENV.fetch('EMASSER_DEBUGGING', 'false') == 'false') ? false : true
31
45
  end
32
46
  # rubocop: enable Style/TernaryParentheses, Style/IfWithBooleanLiteralBranches
33
47
  end
@@ -47,7 +47,7 @@ module Emasser
47
47
  end
48
48
 
49
49
  # Delete a POAM -----------------------------------------------------------
50
- desc 'remove', 'Add one or many POA&M items in a system'
50
+ desc 'remove', 'Delete one or many POA&M items in a system'
51
51
  long_desc Help.text(:poam_del_mapper)
52
52
 
53
53
  # Required parameters/fields
@@ -110,7 +110,7 @@ module Emasser
110
110
  true
111
111
  end
112
112
 
113
- desc 'remove', 'Remove one or many artifacts in a system'
113
+ desc 'remove', 'Delete one or many artifacts in a system'
114
114
  long_desc Help.text(:artifact_del_mapper)
115
115
 
116
116
  # Required parameters/fields
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Emasser
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emasser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amndeep Singh Mann
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: exe
14
14
  cert_chain: []
15
- date: 2022-01-03 00:00:00.000000000 Z
15
+ date: 2022-01-14 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -32,86 +32,86 @@ dependencies:
32
32
  name: colorize
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - ">="
35
+ - - "~>"
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 0.8.1
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - ">="
42
+ - - "~>"
43
43
  - !ruby/object:Gem::Version
44
- version: '0'
44
+ version: 0.8.1
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: dotenv
47
47
  requirement: !ruby/object:Gem::Requirement
48
48
  requirements:
49
- - - ">="
49
+ - - "~>"
50
50
  - !ruby/object:Gem::Version
51
- version: '0'
51
+ version: 2.7.6
52
52
  type: :runtime
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - ">="
56
+ - - "~>"
57
57
  - !ruby/object:Gem::Version
58
- version: '0'
58
+ version: 2.7.6
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rubyzip
61
61
  requirement: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - ">="
63
+ - - "~>"
64
64
  - !ruby/object:Gem::Version
65
- version: '0'
65
+ version: 2.3.2
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - ">="
70
+ - - "~>"
71
71
  - !ruby/object:Gem::Version
72
- version: '0'
72
+ version: 2.3.2
73
73
  - !ruby/object:Gem::Dependency
74
- name: emass_client
74
+ name: thor
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - ">="
77
+ - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: '0'
79
+ version: 1.1.0
80
80
  type: :runtime
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - ">="
84
+ - - "~>"
85
85
  - !ruby/object:Gem::Version
86
- version: '0'
86
+ version: 1.1.0
87
87
  - !ruby/object:Gem::Dependency
88
- name: thor
88
+ name: emass_client
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ">="
91
+ - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: '1.0'
94
94
  type: :runtime
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - ">="
98
+ - - "~>"
99
99
  - !ruby/object:Gem::Version
100
- version: '0'
100
+ version: '1.0'
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: bundler
103
103
  requirement: !ruby/object:Gem::Requirement
104
104
  requirements:
105
105
  - - "~>"
106
106
  - !ruby/object:Gem::Version
107
- version: '2.1'
107
+ version: '2.3'
108
108
  type: :development
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - "~>"
113
113
  - !ruby/object:Gem::Version
114
- version: '2.1'
114
+ version: '2.3'
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: bundler-audit
117
117
  requirement: !ruby/object:Gem::Requirement
@@ -130,16 +130,16 @@ dependencies:
130
130
  name: byebug
131
131
  requirement: !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - ">="
133
+ - - "~>"
134
134
  - !ruby/object:Gem::Version
135
- version: '0'
135
+ version: 11.1.3
136
136
  type: :development
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
- - - ">="
140
+ - - "~>"
141
141
  - !ruby/object:Gem::Version
142
- version: '0'
142
+ version: 11.1.3
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: rspec
145
145
  requirement: !ruby/object:Gem::Requirement
@@ -254,6 +254,8 @@ files:
254
254
  - ".github/workflows/draft-release.yml"
255
255
  - ".github/workflows/generate_docs.yml"
256
256
  - ".github/workflows/gh-pages.yml"
257
+ - ".github/workflows/push-to-docker-mail.yml"
258
+ - ".github/workflows/push-to-docker.yml"
257
259
  - ".github/workflows/release.yml"
258
260
  - ".github/workflows/rubocop.yml"
259
261
  - ".github/workflows/test-cli.yml"
@@ -321,7 +323,8 @@ files:
321
323
  - lib/emasser/put.rb
322
324
  - lib/emasser/version.rb
323
325
  homepage: https://saf.mitre.org
324
- licenses: []
326
+ licenses:
327
+ - Apache-2.0
325
328
  metadata: {}
326
329
  post_install_message:
327
330
  rdoc_options: []