Code Monkey home page Code Monkey logo

docker-mid-server's Introduction

Docker Pulls Docker Cloud Build Status Build New MID Images

ServiceNow MID Server

This is the full collection of all Service-Now MID Server versions as Docker container.

A note on Apache Log4j Vulnerability (CVE-2021-44228)

According to KB1000959 the MID servers are not affected by this vulnerability.
However, as the MID Server does contain the files for log4j 2.14.0, theoretically the vulnerability is still present. Therefore the JndiLookup.class is removed from the log4j-core*.jar in all versions of the Docker MID server.
Make sure you pull the latest version of the Docker image.

Supported tags

  • latest MID of latest ServiceNow release
    • latest
  • [city]:
    • [city].latest
    • [city].[version]
    • [city].first, [city]

Examples:

  • sandiego:
    • sandiego.latest
    • sandiego.05-02-2022_1316
    • sandiego.first, sandiego

If you need to start a specific version of MID server please have a look at the available tags

If you're not sure what version you have, use the city-tag e.g. moers/mid-server:rome. The MID server will auto upgrade to the required version.

ARM64 Images

The upgrade process is not supported for ARM64 images. Therefore the ARM images are pinned to the exact version of the MID server and do not auto-upgrade.

Dockerfile

All versions are based on the same Dockerfile

Start a MID server instance

Mandatory parameters:

$ docker run -d --name docker-mid \
  --env SN_HOST_NAME=dev12345.service-now.com \
  --env USER_NAME=username \
  --env PASSWORD=password \
  moers/mid-server:latest

Supported Environment Variables

ENV SN_HOST_NAME "FQDN of the ServiceNow instance (replacement for $HOST)"
ENV USER_NAME "mid user name"
ENV PASSWORD "mid user password"
ENV HOSTNAME "the MID server name (suffixed by '-mid.docker') [optional]"
ENV PIN "disable auto upgrade and pin the mid to this version [optional]"
ENV PROXY "proxy-host [optional]"
ENV PROXY_PORT "proxy-port [optional]"
ENV CUSTOM_CA_CERT "custom cert in one line [optional]"
ENV CUSTOM_CA_ALIAS "alias used for the cert (default dockerExtraCaCerts) [optional]"
ENV HOST "the <host>.service-now.com subdomain [legacy]"
ENV EXT_PARAMS "additional parameters to be added or replaced in config.xml"

Custom Ca Certificate

If you run the MID server behind a company firewall and need to inject a self signed certificate following options are available:

  1. bind mount a custom.crt file to /opt/agent/custom_ca.crt
  2. replace the new lines in the certificate with \n and set it to the CUSTOM_CA_CERT var.

Extended Parameters

Use the EXT_PARAMS variable to add or update any parameter in the config.xml file.

Below JSON will add/update following parameter in the config.xml file:

  • <parameter name="mid.ssl.bootstrap.default.check_cert_revocation" value="false"/>
  • <parameter name="mid.ssl.bootstrap.default.target_endpoint" value="sn.local"/>
[
    {
        "name": "mid.ssl.bootstrap.default.target_endpoint",
        "value": "sn.local",
        "type": "add"
    },
    {
        "name": "mid.ssl.bootstrap.default.check_cert_revocation",
        "value": "false"
    }
]

Complete Example

$ docker run -d --name docker-mid-latest \
  --env SN_HOST_NAME=dev12345.service-now.com \
  --env USER_NAME=username \
  --env PASSWORD=password \
  --env PROXY=gateway.company.com \
  --env PROXY_PORT=8080 \
  -v "$(pwd)"/customer.crt:/opt/agent/custom_ca.crt \
  --env CUSTOM_CA_ALIAS=myCompanyCustomCrt \
  --env 'EXT_PARAMS=[{ "name": "mid.ssl.bootstrap.default.check_cert_revocation", "value": "false", "type":"update" }]' \
  --health-cmd='pgrep -af /opt/agent/bin/./wrapper-linux-x86-64 | grep `cat /opt/agent/work/mid.pid` || exit 1' \
  --health-interval=15s \
  --health-retries=6 \
  --health-timeout=5s \
  --health-start-period=30s \
  moers/mid-server:latest

Versions

To get the latest available MID server use
:latest

To get the latest available MID server for a specific ServiceNow release (city-tag) use:
:[city].latest

To get an MID server which will auto upgrade for a specific ServiceNow release use:
:[city]

To pin a MID server to a specific version use the correct version tag and set the PIN variable which will set the mid.pinned.version property e.g.
:newyork.06-19-2020_1844

docker-mid-server's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docker-mid-server's Issues

Error: latest not found: manifest unknown: manifest unknown

This looks really cool Boris! However I'm getting a error:

docker pull moers/mid-server

Using default tag: latest
Error response from daemon: manifest for moers/mid-server:
latest not found: manifest unknown: manifest unknown

Looking in it myself and will update when found solution.

incorrect permissions on log4j-core.jar

Deploying rome.latest fails during the upgrade step due to root:root permissions on /opt/agent/lib/log4j-core.jar:

/opt/agent/logs/dist_upgrade.log.0 shows:

09/05/22 08:34:34 (936)  |  INFO  |  /opt/agent/lib/log4j-core.jar cannot be deleted: /opt/agent/lib/log4j-core.jar (Permission denied)
586706ms left to timeout for deleting files. Retrying in 1000ms...
09/05/22 08:34:35 (937)  |  INFO  |  /opt/agent/lib/log4j-core.jar cannot be deleted: /opt/agent/lib/log4j-core.jar (Permission denied)
585705ms left to timeout for deleting files. Retrying in 1000ms...

Loops for 300s, resulting in container death:

DOCKER MONITOR: /opt/agent/logs/agent0.log.0 last updated 320 sec ago
DOCKER MONITOR: /opt/agent/logs/agent0.log.0 was not updated for 300sec, MID server potentially frozen.
DOCKER MONITOR: Stopping MID server process 1 now!
DOCKER: Stop MID server
ServiceNow MID Server is not running.

Permissions within /opt/agent/lib/:

-rwxr-xr-x.  1 mid  mid    301872 Jul 21 12:39 log4j-api.jar
-rwxr-xr-x.  1 root root  1770485 Jul 30 20:17 log4j-core.jar
-rwxr-xr-x.  1 mid  mid     23702 Jul 21 12:39 log4j-over-slf4j.jar

I suspect line 63 is the cause due to running after a chown -R mid:mid /opt/* on line 33:

RUN zip -q -d /opt/agent/lib/log4j-core*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class || true

Adding this line below 63 and rebuilding the image does resolve the issue:

RUN chown mid:mid /opt/agent/lib/log4j-core*.jar

It is likely there is a more elegant solution, but this has worked for us.

Docker local user "mid" not allowed to use apt-get.

Im trying to install nodejs but mid account seems like it doesn't have enough privilege. Are there other accounts/passwords I can use to install packages? Or is there a better way of installing additional requirements?

sandiego: stuck in upgrade loop ?

Usually, when creating a mid server container, it starts doing an upgrade. After that I manually rekey it and that's it. This worked with quebec and all before them. With sandiego however the container restarts endlessly after what looks like an unsuccessful upgrade. In Servicenow the mid server alternates endlessly between "Upgrading" and "Down" status.

The command used to create the container:
sudo docker run -d --name servicenow_mid --restart unless-stopped --env SN_HOST_NAME=acme.service-now.com --env USER_NAME=acme-mid --env PASSWORD=**** moers/mid-server:sandiego.latest

The user has the roles "mid_server" and "snc_internal", only allowed for webservices. To avoid any local permission issues, I temporarily made the user an admin.

There are a number of warnings in the logs (see attachment). Among those:

AutoUpgrade.3600 WARNING *** WARNING *** Unable to determine upgrade scenario with current=sandiego-12-22-2021__patch9a-hotfix1-01-31-2023_02-01-2023_1625 assigned=sandiego-12-22-2021__patch9a-12-12-2022_01-04-2023_0931

Maybe that's an indication ?

Is there something I can check to fix this issues ?

THX


Maybe related to this issue, the shutdown doesn't seem to complete gracefully. The typical last lines in the logs are:

03/02/23 09:25:24 (742) MIDServer MID Server stopped
03/02/23 09:25:24 (742) MIDServer the ServiceNow MID Server is now terminated
DOCKER MONITOR: /opt/agent/logs/agent0.log.0 last updated 6 sec ago
...
DOCKER MONITOR: /opt/agent/logs/agent0.log.0 last updated 307 sec ago
DOCKER MONITOR: /opt/agent/logs/agent0.log.0 was not updated for 300sec, MID server potentially frozen.
DOCKER MONITOR: Stopping MID server process 1 now!
DOCKER: Stop MID server

It always restarts because the logs are too old. Even though /opt/agent/work/mid.pid is gone. But maybe that's the intention.

PS. Great work ! It's so much easier for managing mid servers !

Missing ping utility

I am seeing an issue while running orlando.08-28-2020_1009 image
The service comes up and registers but it fails to send the config.
If I install the ping utility in the docker container then it starts working.

Issues running on Raspberry pi4

Getting stuck in a CrashLoopBackOff when trying to deploy with Kubernetes.

Here is my yaml file

apiVersion: apps/v1
kind: Deployment
metadata:
   name: mid-server-dev
   labels:
      app: mid-server-dev
spec:
   replicas: 1
   selector:
      matchLabels:
         app: mid-server-dev
   template:
      metadata:
         labels:
            app: mid-server-dev
      spec:
         containers:
         - name: mid-server
           image: moers/mid-server:madrid.latest
           env:
              - name: HOST
                value: midserverdev
              - name: USER_NAME
                value: miduser
              - name: PASSWORD
                value: 'midpass'
           imagePullPolicy: Always

Here are the events

Normal Scheduled 9m59s default-scheduler Successfully assigned default/mid-server-dev-767cf45b57-xdqwt to k8s-worker-02
Normal Pulled 8m52s kubelet Successfully pulled image "moers/mid-server:paris.latest" in 1m6.391426568s
Normal Pulled 8m44s kubelet Successfully pulled image "moers/mid-server:paris.latest" in 746.891844ms
Normal Pulled 8m26s kubelet Successfully pulled image "moers/mid-server:paris.latest" in 1.016216712s
Normal Created 8m1s (x4 over 8m47s) kubelet Created container mid-server
Normal Started 8m1s (x4 over 8m46s) kubelet Started container mid-server
Normal Pulled 8m1s kubelet Successfully pulled image "moers/mid-server:paris.latest" in 780.482185ms
Normal Pulling 7m10s (x5 over 9m58s) kubelet Pulling image "moers/mid-server:paris.latest"
Warning BackOff 4m52s (x19 over 8m43s) kubelet Back-off restarting failed container

Here is the processor architecture
Linux k8s-master 5.4.0-1023-raspi #26-Ubuntu SMP PREEMPT Thu Nov 12 14:58:33 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

Any suggestions on getting this to work on a Pi?

Missing ping utility

I am seeing an issue while running orlando.08-28-2020_1009 image
The service comes up and registers but it fails to send the config.
If I install the ping utility in the docker container then it starts working.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.