tenable / integration-jira-cloud

67 stars 52 forks source link

Setting up docker or service #164

Closed infosecwatchman closed 4 months ago

infosecwatchman commented 2 years ago

Hello, I've seen mentioned you can setup a docker or service to keep the integration running. I thought the easiest method would be to make it a docker, but is there any documentation to help this get setup, or any recommendations?

infosecwatchman commented 2 years ago

Since, when running the tenable-jira command doesn't show any result if it's successful, can someone check if my config and dockerfile is correct. Will the binary continue to run with the config, something like, pull vulns and create tickets from the past 24 hours, sleep for 24 hours, and reinitiate. Dockerfile.txt config.yaml.txt

SteveMcGrath commented 2 years ago

your approach will yield to a much larger image than necessary, maybe consider doing this:

FROM python:3.9-alpine

RUN apk add --no-cache git
RUN git clone https://github.com/tenable/integration-jira-cloud.git \
 && pip install ./integration-jira-cloud

CMD ["tenable-jira", "/config.yaml"]

which could then be built and run like so:

❯ docker build -t jira .
[+] Building 19.7s (7/7) FINISHED
 => [internal] load build definition from Dockerfile                       0.4s
 => => transferring dockerfile: 292B                                       0.0s
 => [internal] load .dockerignore                                          0.7s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for docker.io/library/python:3.9-alpine       0.6s
 => CACHED [1/3] FROM docker.io/library/python:3.9-alpine@sha256:e80214a7  0.0s
 => [2/3] RUN apk add --no-cache git                                       2.2s
 => [3/3] RUN git clone https://github.com/tenable/integration-jira-clou  14.6s
 => exporting to image                                                     1.3s
 => => exporting layers                                                    1.0s
 => => writing image sha256:8e2dbb9a19e7be415c9f52e58f1fa9e357211c15e551e  0.1s
 => => naming to docker.io/library/jira                                    0.1s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
❯ docker run --rm -it -v $(pwd)/config.yaml:/config.yaml jira
2022-02-16 15:32:05,588 root INFO Tenable2JiraCloud Version 1.2.3
2022-02-16 15:32:05,588 root INFO Using configuration file /config.yml
2022-02-16 15:32:05,589 root INFO Running on Python3.9.10Linux/aarch64
2022-02-16 15:32:05,589 root DEBUG Severity Prioritization set to: {'critical': 1, 'high': 2, 'medium': 3, 'low': 4}
2022-02-16 15:32:05,590 tenable.io.TenableIO DEBUG Request: {"method": "GET", "url": "https://cloud.tenable.com/session", "params": {}, "body": {}}
2022-02-16 15:32:05,591 urllib3.connectionpool DEBUG Starting new HTTPS connection (1): cloud.tenable.com:443
2022-02-16 15:32:05,901 urllib3.connectionpool DEBUG https://cloud.tenable.com:443 "GET /session HTTP/1.1" 200 None
2022-02-16 15:32:05,905 tenable_jira.jira.Jira DEBUG Request: {"method": "GET", "url": "https://tenable-dev.atlassian.net/rest/api/3/project/VMNGT10", "params": {}, "body": {}}
2022-02-16 15:32:05,909 urllib3.connectionpool DEBUG Starting new HTTPS connection (1): tenable-dev.atlassian.net:443