Blog

  • Cool Things I learned last week

    For those following along with my work, I’ve compiled a list of interesting items I’ve run across in the last week:

    Install minikube on an IBM PowerVM running RHEL 8.6 or 8.7

    Want to learn how to install minikube on an IBM Power system running RHEL? Check out this new blog on the IBM Power Developer eXchange, which provides step-by-step instructions on how to identify the software dependencies needed to download, build, and install minikube on Power

    https://community.ibm.com/community/user/powerdeveloper/blogs/vijay-puliyala/2023/01/23/install-minikube-on-ibm-powervm

    Learn the Compliance Operator

    There is a nice self-paced lab to learn the compliance-operator

    https://github.com/JAORMX/lab-compliance-operator
  • Compliance Operator Quick Notes

    If you’re processing Credit Card Payments on the OpenShift Container Platform, the Payment Card Industry and the Data Security Standard is a must on your cluster.

    With Red Hat’s release of the Compliance Operator v0.1.59, they added support for IBM Power Systems.

    I wanted to share a couple of notes about the Compliance Operator:

    1. The Compliance Operator supports the ocp4-cisocp4-cis-nodeocp4-pci-dss-node and ocp4-pci-dss profiles.
    2. The Compliance Operator sources the profiles which have a set of rules from ComplianceAsCode/content. For instance, you can see the OpenShift profiles at products/ocp4/profiles/.
    3. The Compliance Operator PCI-DSS profiles support v3.2.1.
    4. If you see a profile with a postfix of -node, it’s focus is on the Operating System.
    5. If you see no -node on the profile name, it’s focus is on the Kubernetes and OpenShift platform.

    Clarification 2023-FEB-07 I learned the -node and node were actually there due to limitations in oscap, together they represent the same profile and are expected to be applied together.

    I hope this quick notes help you.

    References
    1. Medium/Aditi Jadhav: Using the Compliance Operator to support PCI-DSS on OpenShift Container Platform on Power
    2. Power Developer Exchange: OpenShift Compliance Operator 0.1.59 now supports PCI-DSS on Power
    3. PCI-DSS v3.2.1 Standard
    4. Supported compliance profiles
  • My MachineConfigPool is … Stuck

    My teammate was investigating an SSHD config change and hit a stuck MachineConfigPool. Here are some steps we followed to get it unstuck.

    Steps

    1. Verify that the MachineConfigPool is stuck updating
    ❯ oc get mcp
    NAME     CONFIG                                             UPDATED   UPDATING   DEGRADED   MACHINECOUNT   READYMACHINECOUNT   UPDATEDMACHINECOUNT   DEGRADEDMACHINECOUNT   AGE
    master   rendered-master-0de63bfa1c0db0777031adddb3286fbc   False     True       True       3              0                   0                     3                      9d
    worker   rendered-worker-38e4049eaf0b7fca848408378092e607   True      False      False      3              3                   3                     0                      9d
    
    1. Find out for one of your nodes in the mcp that is stuck (for instance, master-0)
    ❯ oc get pods -n openshift-machine-config-operator --field-selector spec.nodeName=master-0
    NAME                          READY   STATUS    RESTARTS   AGE
    machine-config-daemon-t8x8j   2/2     Running   2          35h
    machine-config-server-kfx8n   1/1     Running   1          35h
    
    1. Check the logs and grab the rendered-master
    ❯ oc logs pod/machine-config-daemon-tgnss -n openshift-machine-config-operator
    ...
    E0124 07:19:26.746977  780508 on_disk_validation.go:208] content mismatch for file "/etc/ssh/sshd_config" (-want +got):
      bytes.Join({
    -       "\n#\t",
    +       "#       ",
            "$OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $\n\n# Th",
            "is is the sshd server system-wide configuration file.  See\n# ssh",
            ... // 1437 identical bytes
            "keys and .ssh/authorized_keys2\n# but this is overridden so insta",
            "llations will only check .ssh/authorized_keys\nAuthorizedKeysFile",
    -       `       `,
    +       "      ",
            ".ssh/authorized_keys\n\n#AuthorizedPrincipalsFile none\n\n#Authorize",
            "dKeysCommand none\n#AuthorizedKeysCommandUser nobody\n\n# For this ",
            ... // 2258 identical bytes
            "E LC_MEASUREMENT\nAcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE\nAcc",
    ...
    +       "\n",
      }, "")
    E0124 07:19:26.747042  780508 writer.go:200] Marking Degraded due to: unexpected on-disk state validating against rendered-master-0de63bfa1c0db0777031adddb3286fbc: content mismatch for file "/etc/ssh/sshd_config"
    I0124 07:19:28.973484  780508 daemon.go:1248] Current+desired config: rendered-master-0de63bfa1c0db0777031adddb3286fbc
    ...
    
    1. OK, this looks like a problem with the whitespace, and inspect the URL decoded version’s whites pace vim :set list
    > oc get mc rendered-master-0de63bfa1c0db0777031adddb3286fbc -o yaml > out.yaml
    

    You may have to update the white space.

    1. Check the reasons for the failure if the whitespace doesn’t fix it.
    > oc describe mcp master
    
    Message:
        Node master-0 is reporting: 
            "unexpected on-disk state validating against rendered-master-0de63bfa1c0db0777031adddb3286fbc: 
            mode mismatch for file: \"/etc/ssh/sshd_config\"; 
            expected: -rw-------/384/0600; received: -rw-r--r--/420/0644", 
            Node master-1 is reporting: "unexpected on-disk state validating 
            against rendered-master-0de63bfa1c0db0777031adddb3286fbc: content 
            mismatch for file \"/etc/ssh/sshd_config\"", Node master-2 is reporting:
            "unexpected on-disk state validating against 
            rendered-master-0de63bfa1c0db0777031adddb3286fbc: content mismatch for file 
            \"/etc/ssh/sshd_config\""
    

    In this case, the local files were edited while preparing the ideal sshd_config and needed a forced update.

    1. Force the machine-config to refresh files.
    > touch /run/machine-config-daemon-force
    1. You should see the states change after the node reboots.
    Events:
      Type    Reason            Age    From                                    Message
      ----    ------            ----   ----                                    -------
      Normal  AnnotationChange  5m19s  machineconfigcontroller-nodecontroller  Node master-0 now has machineconfiguration.openshift.io/state=Done
    
      degradedMachineCount: 2
      machineCount: 3
      observedGeneration: 500
      readyMachineCount: 0
      unavailableMachineCount: 2
      updatedMachineCount: 0

    If you need to select a file from the rendered config:

    > oc get mc rendered-master-0de63bfa1c0db0777031adddb3286fbc -o yaml | yq -r '.spec.config[].files[] | select(.path == "/etc/ssh/sshd_config").contents.source'
    data:,%0A%23%09$OpenBSD:%20sshd_config%2Cv%201.103
    ...

    References

  • How to use OpenScap Scanner on a Mac

    For those, not yet using openscap-scanner on their systems, OpenSCAP is an security auditing framework that utilizes the Extensible Configuration Checklist Description Format (XCCDF) and the openscap-scanner executes over the security profile on a target system.

    One gotcha, I have a Mac, and the tool is not natively supported on the Mac. I decided to use it through a fedora container running in Podman.

    Here are the steps to running on a Mac with complianceascode/content‘s release.

    Steps

    1. Download the Docker File
    2. Build the Image
    $ podman build -f Dockerfile -t ocp-power.xyz/compliance/openscap-wrapper:latest
    ...
    
    1. Download the content files scap-security-guide-0.1.65.zip
    $ curl -O -L https://github.com/ComplianceAsCode/content/releases/download/v0.1.65/scap-security-guide-0.1.65.zip
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100  130M  100  130M    0     0  2752k      0  0:00:48  0:00:48 --:--:-- 5949k
    
    1. Unzip the scap-security-guide-0.1.65.zip file.
    $ unzip scap-security-guide-0.1.65.zip
    
    1. Rename the directory scap-security-guide-0.1.65 to scap
    $ mv scap-security-guide-0.1.65 scap
    
    1. List the profiles in a specific XML.
    $ podman run --rm -v ./scap:/scap ocp-power.xyz/compliance/openscap-wrapper:latest oscap info --profiles /scap/ssg-ocp4-ds.xml
    xccdf_org.ssgproject.content_profile_cis-node:CIS Red Hat OpenShift Container Platform 4 Benchmark
    xccdf_org.ssgproject.content_profile_cis:CIS Red Hat OpenShift Container Platform 4 Benchmark
    xccdf_org.ssgproject.content_profile_e8:Australian Cyber Security Centre (ACSC) Essential Eight
    xccdf_org.ssgproject.content_profile_high-node:NIST 800-53 High-Impact Baseline for Red Hat OpenShift - Node level
    xccdf_org.ssgproject.content_profile_high:NIST 800-53 High-Impact Baseline for Red Hat OpenShift - Platform level
    xccdf_org.ssgproject.content_profile_moderate-node:NIST 800-53 Moderate-Impact Baseline for Red Hat OpenShift - Node level
    xccdf_org.ssgproject.content_profile_moderate:NIST 800-53 Moderate-Impact Baseline for Red Hat OpenShift - Platform level
    xccdf_org.ssgproject.content_profile_nerc-cip-node:North American Electric Reliability Corporation (NERC) Critical Infrastructure Protection (CIP) cybersecurity standards profile for the  Red Hat OpenShift Container Platform - Node level
    xccdf_org.ssgproject.content_profile_nerc-cip:North American Electric Reliability Corporation (NERC) Critical Infrastructure Protection (CIP) cybersecurity standards profile for the  Red Hat OpenShift Container Platform - Platform level
    xccdf_org.ssgproject.content_profile_pci-dss-node:PCI-DSS v3.2.1 Control Baseline for Red Hat OpenShift Container Platform 4
    xccdf_org.ssgproject.content_profile_pci-dss:PCI-DSS v3.2.1 Control Baseline for Red Hat OpenShift Container Platform 4
    
    1. Details on the profile
    $ podman run --rm  -v ./scap:/scap ocp-power.xyz/compliance/openscap-wrapper:latest oscap info --profile xccdf_org.ssgproject.content_profile_cis-node /scap/ssg-ocp4-ds.xml
    Document type: Source Data Stream
    Imported: 2022-12-02T19:09:36
    
    Stream: scap_org.open-scap_datastream_from_xccdf_ssg-ocp4-xccdf.xml
    Generated: (null)
    Version: 1.3
    Profile
            Title: CIS Red Hat OpenShift Container Platform 4 Benchmark
            Id: xccdf_org.ssgproject.content_profile_cis-node
    
            Description: This profile defines a baseline that aligns to the Center for Internet Security® Red Hat OpenShift Container Platform 4 Benchmark™, V1.1.  This profile includes Center for Internet Security® Red Hat OpenShift Container Platform 4 CIS Benchmarks™ content.  Note that this part of the profile is meant to run on the Operating System that Red Hat OpenShift Container Platform 4 runs on top of.  This profile is applicable to OpenShift versions 4.6 and greater.
    
    1. Now, I can run more advanced commands on the profiles on my Mac.
    $ podman run --rm  -v ./scap:/scap ocp-power.xyz/compliance/openscap-wrapper:latest oscap oval generate report /scap/ssg-ocp4-ds.xml 2>&1
    

    References

    1. OpenScap Downloads
    2. OpenScap source code
    3. OpenScap Manual Source
    4. OpenScap Manual Published

    Notes

    Note, I found I had to do the following on my Mac to get the volume to mount.

    $ podman machine stop
    $ podman machine set --rootful
    $ podman machine start
    $ sudo /opt/homebrew/Cellar/podman/4.3.1/bin/podman-mac-helper install
    $ podman machine stop; podman machine start
    
  • Access to Power Systems for Development

    Linda, a colleague on IBM Power Systems development, assembled a nice compendium of resources for developing solutions on IBM Power (ppc64le) architecture. To read more click on the link, and review the details

    Want access to IBM Power Hardware for development efforts? We have compiled a list of cloud, emulation, and on-prem options for you to choose from. Click the link to access all the tools you need to get started. 

    IBM #PowerSystems #IBMCloud #OpenSourceSoftware #IT Infrastructure #PDeX

    https://community.ibm.com/community/user/powerdeveloper/blogs/linda-alkire-kinnunen/2022/08/08/accelerate-your-open-source-development-with-acces 

    Note: for most of what I work on QEMU turns out to be sufficient.

  • Using Ghost on OpenShift Container Platform

    To demonstrate a multi-tiered web application, I used ghost, the microblogging platform to deploy the application using kustomize. Kustomize is a higher-level orchestration of the steps to deploy an application with environment specific overlays.

    Steps

    1. Clone the repository
    git clone https://github.com/prb112/openshift-demo.git
    
    1. Install kustomize
    $ brew install kustomize
    
    1. Login to your cluster using oc.

    2. Generate a randomized password

    $ ENV_PASS=$(openssl rand -hex 10)
    $ echo ${ENV_PASS}
    

    Note, save the output…

    1. Generate the working url for the cluster/ghost app.
    $ export WEB_DOMAIN=https://web-route-ghost.apps.$(oc get ingress.config.openshift.io cluster -o yaml | grep domain | awk '{print $NF}')
    $ echo ${WEB_DOMAIN}
    
    1. Change to the ghost/deploy directory using cd openshift-demo/ghost/deploy

    2. Create the secret for the database

    $ cat secrets/01_db_secret.yml | sed "s|ENV_PASS|${ENV_PASS}|" | oc apply -f -
    
    1. Create the configmap for the Ghost app URL.
    $ cat secrets/02_web_cm.yml | sed "s|WEB_DOMAIN|${WEB_DOMAIN}|" | oc apply -f -
    
    1. Create the deployment for the website
    $ oc apply -k overlays/dev
    namespace/ghost configured
    service/db-service unchanged
    service/web unchanged
    persistentvolumeclaim/db-pvc unchanged
    persistentvolumeclaim/web-content unchanged
    deployment.apps/ghost-db unchanged
    deployment.apps/web unchanged
    route.route.openshift.io/web-route unchanged
    
    1. To clean it up you can run…
    $ oc delete -k overlays/dev
    namespace "ghost" deleted
    service "db-service" deleted
    service "web" deleted
    persistentvolumeclaim "db-pvc" deleted
    persistentvolumeclaim "web-content" deleted
    deployment.apps "ghost-db" deleted
    deployment.apps "web" deleted
    route.route.openshift.io "web-route" deleted
    
    1. To see your website URL, you can grab the config map.
    $ oc get cm -o yaml
    
    1. Navigate to the URL, such as https://web-route-ghost.apps.xyz.zzz.zyz.com/ghost/ to start setting up your site.

    Note, if I had time, I would have generated a non-privileged user for MySQL and used that on the MySQL instance.

    References

    1. https://elixm.com/how-to-deploy-ghost-blog-with-kubernetes/
    2. https://hub.docker.com/_/ghost
    3. https://hub.docker.com/_/mysql
    4. https://github.com/openshift-cs/ghost-example/blob/master/ghost_template.yaml
  • Support for detecting nx-gzip coprocessor feature in Node Feature Discovery

    The Kubernetes add-on Node Feature Discovery is enhanced with a new coprocessor feature and support for detecting the NX-GZIP on Power 10. This work supports the use of libnxz/power-gzip feature.

    We setup Kubernetes 1.25 on a Power10 RHEL 9.1 PowerVM. We built the feature and submitted the PR on behalf of IBM. You’ll need RHEL 9.1 as an operating system on Power 10.

    When the Worker or Control Plane node has Node Feature Discovery enabled on a Power 10 PowerVM with Red Hat Enterprise Linux 9.1 or higher, the label coprocessor.nx_gzip is present on the node. You can see more details in the PR 956

  • Downloading oc-compliance on ppc64le

    My team is working with the OpenShift Container Platforms Optional Operator – Compliance Operator. The Compliance Operator has a supporting tool oc-compliance.

    One tricky element was downloading the oc-compliance plugin and I’ve documented the steps here to help

    Steps

    1. Navigate to https://console.redhat.com/openshift/downloads#tool-pull-secret

    If Prompted, Login with your Red Hat Network id.

    1. Under Tokens, select Pull secret, then click Download

    2. Copy the pull-secret to your working directory

    3. Make the .local/bin directory to drop the plugin.

    $ mkdir -p ~/.local/bin
    
    1. Run the oc-compliance-rhel8 container image.
    $ podman run --authfile pull-secret --rm -v ~/.local/bin:/mnt/out:Z --arch ppc64le registry.redhat.io/compliance/oc-compliance-rhel8:stable /bin/cp /usr/bin/oc-compliance /mnt/out/
    Trying to pull registry.redhat.io/compliance/oc-compliance-rhel8:stable...
    Getting image source signatures
    Checking if image destination supports signatures
    Copying blob 847f634e7f1e done  
    Copying blob 7643f185b5d8 done  
    Copying blob d6050ae37df3 done  
    Copying config 2f0afdf522 done  
    Writing manifest to image destination
    Storing signatures
    
    1. Check the file is ppc64le
    $ file ~/.local/bin/oc-compliance 
    /root/.local/bin/oc-compliance: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked, interpreter /lib64/ld64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=d5bff511ee48b6cbc6afce6420e780da2f0eacdc, not stripped
    

    If it doesn’t work, you can always verify your architecture of the machine podman is running on:

    $ arch
    ppc64le
    

    It should say ppc64le.

    You’ve seen how to download the ppc64le build.

    References

  • OpenShift on Power Blogs…

    Recently, I started a leadership position on a new squad focused on OpenShift on IBM Power Systems. Two of my teammates have posted blogs about their work:

    1. Configuring Seccomp Profile on OpenShift Container Platform for Security and Compliance on Power from Aditi covers the ins and outs of configuring the seccomp profile, and tells you why you should care and how you can configure it with your workload.
    2. Encrypting etcd data on Power from Gaurav covers encrypting the etcd data store on OpenShift and how to go through some common operations related to etcd management when it’s encrypted.
    3. Encrypting OpenShift Container Platform Disks on Power Systems from Gaurav covers encryption concepts, how to setup an external tang cluster on IBM PowerVS, how to setup a cluster on IBM PowerVS and how to confirm the encrypted disk setup.
    4. OpenShift TLS Security Profiles on IBM Power from Gaurav covers the setting up of TLS inside OpenShift and verifying the settings.
    5. Lessons Learned using Security Context Constraints OpenShift from Aditi covers key things she learned from using Security Context Constraints
    6. Securing NFS Attached Storage Notes from Aditi covers restricting the use of NFS mounts/securing the attached storage.
    7. Using the Compliance Operator to support PCI-DSS on OpenShift Container Platform on Power from Aditi dives into the PCI-DSS profile with the Compliance Operator.
    8. Configuring a PCI-DSS compliant OpenShift Container Platform cluster on IBM Power from Gaurav dives into configuring a compliance cluster with recipes to enable proper configuration.

    I hope you found these as useful as I did. Best wishes, PB

  • Tweak for GoLang PowerPC Build

    As many know, Go is a designed to build architecture and operating system specific binaries. These architecture and operating system specific binaries are called a target. One can target GOARCH=ppc64le GOOS=linux go build to build for the specific OS. There is a nice little tweak which considers the architectures version and optimizes the selection of the ASM (assembler code) uses when building the code.

    To use the Power Architecture ppc64le for a specific target, you can use GOPPC64:

    1. power10 – runs with Power 10 only.
    2. power9 – runs with Power 9 and Power 10.
    3. power8 (the default) and runs with 8,9,10.

    For example the command is GOARCH=ppc64le GOOS=linux GOPPC64=power9 go build

    This may help with some various results.

    References