Saturday 26 September 2020

It's been a while, tinkering with IBM MQ and scripting ...

 I'd been asked about scripting access to IBM MQ ... as it's been a while since last I worked with it, I decided to install MQ 9 onto a Linux VM, and have a quick play .....

So my VM is running Ubuntu 18.04.4, and, therefore, I downloaded the appropriate MQ 9.2 image: -

IBM_MQ_9.2.0_UBUNTU_X86-64.tar.gz

Having accepted the license: -

./mqlicense.sh accept

and installed the binaries: -

dpkg --list | grep IBM

ii  ibmmq-amqp                             9.2.0.0                                         amd64        IBM MQ AMQP Service

ii  ibmmq-ams                              9.2.0.0                                         amd64        IBM MQ Advanced Message Security

ii  ibmmq-bcbridge                         9.2.0.0                                         amd64        IBM MQ Blockchain Bridge

ii  ibmmq-client                           9.2.0.0                                         amd64        IBM MQ Client FileSet

ii  ibmmq-explorer                         9.2.0.0                                         amd64        IBM MQ Explorer

ii  ibmmq-ftbase                           9.2.0.0                                         amd64        IBM MQ Managed File Transfer Base Component

ii  ibmmq-ftlogger                         9.2.0.0                                         amd64        IBM MQ Managed File Transfer Logger

ii  ibmmq-fttools                          9.2.0.0                                         amd64        IBM MQ Managed File Transfer Tools

ii  ibmmq-gskit                            9.2.0.0                                         amd64        IBM MQ GSKit FileSet

ii  ibmmq-java                             9.2.0.0                                         amd64        IBM MQ Java, JMS and Web Services support

ii  ibmmq-jre                              9.2.0.0                                         amd64        IBM MQ Java JRE

ii  ibmmq-man                              9.2.0.0                                         amd64        IBM MQ Man Pages FileSet

ii  ibmmq-msg-cs                           9.2.0.0                                         amd64        IBM MQ Messages (Czech) FileSet

ii  ibmmq-msg-de                           9.2.0.0                                         amd64        IBM MQ Messages (German) FileSet

ii  ibmmq-msg-es                           9.2.0.0                                         amd64        IBM MQ Messages (Spanish) FileSet

ii  ibmmq-msg-fr                           9.2.0.0                                         amd64        IBM MQ Messages (French) FileSet

ii  ibmmq-msg-hu                           9.2.0.0                                         amd64        IBM MQ Messages (Hungarian) FileSet

ii  ibmmq-msg-it                           9.2.0.0                                         amd64        IBM MQ Messages (Italian) FileSet

ii  ibmmq-msg-ja                           9.2.0.0                                         amd64        IBM MQ Messages (Japanese) FileSet

ii  ibmmq-msg-ko                           9.2.0.0                                         amd64        IBM MQ Messages (Korean) FileSet

ii  ibmmq-msg-pl                           9.2.0.0                                         amd64        IBM MQ Messages (Polish) FileSet

ii  ibmmq-msg-pt                           9.2.0.0                                         amd64        IBM MQ Messages (Brazilian Portuguese) FileSet

ii  ibmmq-msg-ru                           9.2.0.0                                         amd64        IBM MQ Messages (Russian) FileSet

ii  ibmmq-msg-zh-cn                        9.2.0.0                                         amd64        IBM MQ Messages (Simplified Chinese) FileSet

ii  ibmmq-msg-zh-tw                        9.2.0.0                                         amd64        IBM MQ Messages (Traditional Chinese) FileSet

ii  ibmmq-runtime                          9.2.0.0                                         amd64        IBM MQ Runtime FileSet

ii  ibmmq-samples                          9.2.0.0                                         amd64        IBM MQ Samples FileSet

ii  ibmmq-sdk                              9.2.0.0                                         amd64        IBM MQ SDK FileSet

ii  ibmmq-server                           9.2.0.0                                         amd64        IBM MQ Server FileSet

ii  ibmmq-sfbridge                         9.2.0.0                                         amd64        IBM MQ SalesForce Bridge

ii  ibmmq-web                              9.2.0.0                                         amd64        IBM MQ REST API and Console

ii  ibmmq-xrservice                        9.2.0.0                                         amd64        IBM MQ Telemetry Service

I switched to the mqm user: -

su - mqm

and created and started a Queue Manager: -

crtmqm -u SYSTEM.DEAD.LETTER.QUEUE QM_MDB

strmqm QM_MDB

A quick bit of validation: -

dspmqver 

Name:        IBM MQ
Version:     9.2.0.0
Level:       p920-L200709
BuildType:   IKAP - (Production)
Platform:    IBM MQ for Linux (x86-64 platform)
Mode:        64-bit
O/S:         Linux 4.15.0-117-generic
O/S Details: Ubuntu 18.04.4 LTS (Bionic Beaver)
InstName:    Installation1
InstDesc:    
Primary:     No
InstPath:    /opt/mqm
DataPath:    /var/mqm
MaxCmdLevel: 920
LicenseType: Production

dspmq

QMNAME(QM_MDB)                                            STATUS(Running)

and then a spot of scripting using runmqsc : -

Display Queue Manager

echo "DISPLAY QMGR" | runmqsc `dspmq | awk '{print $1}' | sed 's/QMNAME//g' | sed 's/[()]//g'`

5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager QM_MDB.


     1 : DISPLAY QMGR
AMQ8408I: Display Queue Manager details.
   QMNAME(QM_MDB)                          ACCTCONO(DISABLED)
   ACCTINT(1800)                           ACCTMQI(OFF)
   ACCTQ(OFF)                              ACTIVREC(MSG)
   ACTVCONO(DISABLED)                      ACTVTRC(OFF)
   ADVCAP(ENABLED)                         ALTDATE(2020-09-24)
   ALTTIME(10.05.08)                       AMQPCAP(YES)
   AUTHOREV(DISABLED)                      CCSID(1208)
   CERTLABL(ibmwebspheremqqm_mdb)          CERTVPOL(ANY)
   CHAD(DISABLED)                          CHADEV(DISABLED)
   CHADEXIT( )                             CHLEV(DISABLED)
   CHLAUTH(ENABLED)                        CLWLDATA( )
   CLWLEXIT( )                             CLWLLEN(100)
   CLWLMRUC(999999999)                     CLWLUSEQ(LOCAL)
   CMDEV(DISABLED)                         CMDLEVEL(920)
   COMMANDQ(SYSTEM.ADMIN.COMMAND.QUEUE)    CONFIGEV(DISABLED)
   CONNAUTH(SYSTEM.DEFAULT.AUTHINFO.IDPWOS)
   CRDATE(2020-09-24)                      CRTIME(10.05.08)
   CUSTOM( )                               DEADQ(SYSTEM.DEAD.LETTER.QUEUE)
   DEFCLXQ(SCTQ)                           DEFXMITQ( )
   DESCR( )                                DISTL(YES)
   IMGINTVL(60)                            IMGLOGLN(OFF)
   IMGRCOVO(YES)                           IMGRCOVQ(YES)
   IMGSCHED(MANUAL)                        INHIBTEV(DISABLED)
   IPADDRV(IPV4)                           LOCALEV(DISABLED)
   LOGGEREV(DISABLED)                      MARKINT(5000)
   MAXHANDS(256)                           MAXMSGL(4194304)
   MAXPROPL(NOLIMIT)                       MAXPRTY(9)
   MAXUMSGS(10000)                         MONACLS(QMGR)
   MONCHL(OFF)                             MONQ(OFF)
   PARENT( )                               PERFMEV(DISABLED)
   PLATFORM(UNIX)                          PSMODE(ENABLED)
   PSCLUS(ENABLED)                         PSNPMSG(DISCARD)
   PSNPRES(NORMAL)                         PSRTYCNT(5)
   PSSYNCPT(IFPER)                         QMID(QM_MDB_2020-09-24_10.05.08)
   REMOTEEV(DISABLED)                      REPOS( )
   REPOSNL( )                              REVDNS(ENABLED)
   ROUTEREC(MSG)                           SCHINIT(QMGR)
   SCMDSERV(QMGR)                          SPLCAP(ENABLED)
   SSLCRLNL( )                             SSLCRYP( )
   SSLEV(DISABLED)                         SSLFIPS(NO)
   SSLKEYR(/var/mqm/qmgrs/QM_MDB/ssl/key)
   SSLRKEYC(0)                             STATACLS(QMGR)
   STATCHL(OFF)                            STATINT(1800)
   STATMQI(OFF)                            STATQ(OFF)
   STRSTPEV(ENABLED)                       SUITEB(NONE)
   SYNCPT                                  TREELIFE(1800)
   TRIGINT(999999999)                      VERSION(09020000)
   XRCAP(YES)                           
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

Display Channels

echo "DISPLAY CHANNEL(*)" | runmqsc `dspmq | awk '{print $1}' | sed 's/QMNAME//g' | sed 's/[()]//g'`

5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager QM_MDB.


     1 : DISPLAY CHANNEL(*)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.ADMIN.SVRCONN)           CHLTYPE(SVRCONN)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.AUTO.RECEIVER)           CHLTYPE(RCVR)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.AUTO.SVRCONN)            CHLTYPE(SVRCONN)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.DEF.AMQP)                CHLTYPE(AMQP)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.DEF.CLUSRCVR)            CHLTYPE(CLUSRCVR)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.DEF.CLUSSDR)             CHLTYPE(CLUSSDR)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.DEF.RECEIVER)            CHLTYPE(RCVR)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.DEF.REQUESTER)           CHLTYPE(RQSTR)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.DEF.SENDER)              CHLTYPE(SDR)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.DEF.SERVER)              CHLTYPE(SVR)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.DEF.SVRCONN)             CHLTYPE(SVRCONN)
AMQ8414I: Display Channel details.
   CHANNEL(SYSTEM.DEF.CLNTCONN)            CHLTYPE(CLNTCONN)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

Display Queues

echo "DISPLAY QUEUE(*)" | runmqsc `dspmq | awk '{print $1}' | sed 's/QMNAME//g' | sed 's/[()]//g'`

5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager QM_MDB.


     1 : DISPLAY QUEUE(*)
AMQ8409I: Display Queue details.
   QUEUE(Q_MDB)                            TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.ACCOUNTING.QUEUE)    TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.ACTIVITY.QUEUE)      TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.CHANNEL.EVENT)       TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.COMMAND.EVENT)       TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.COMMAND.QUEUE)       TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.CONFIG.EVENT)        TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.LOGGER.EVENT)        TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.PERFM.EVENT)         TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.PUBSUB.EVENT)        TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.QMGR.EVENT)          TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.STATISTICS.QUEUE)    TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.TRACE.ACTIVITY.QUEUE)
   TYPE(QLOCAL)                         
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.ADMIN.TRACE.ROUTE.QUEUE)   TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.AMQP.COMMAND.QUEUE)        TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.AUTH.DATA.QUEUE)           TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.BROKER.ADMIN.STREAM)       TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.BROKER.CONTROL.QUEUE)      TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.BROKER.DEFAULT.STREAM)     TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.BROKER.INTER.BROKER.COMMUNICATIONS)
   TYPE(QLOCAL)                         
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.CHANNEL.INITQ)             TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.CHANNEL.SYNCQ)             TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.CHLAUTH.DATA.QUEUE)        TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.CICS.INITIATION.QUEUE)     TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.CLUSTER.COMMAND.QUEUE)     TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.CLUSTER.HISTORY.QUEUE)     TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.CLUSTER.REPOSITORY.QUEUE)
   TYPE(QLOCAL)                         
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.CLUSTER.TRANSMIT.MODEL.QUEUE)
   TYPE(QMODEL)                         
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.CLUSTER.TRANSMIT.QUEUE)    TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.DDELAY.LOCAL.QUEUE)        TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.DEAD.LETTER.QUEUE)         TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.DEFAULT.ALIAS.QUEUE)       TYPE(QALIAS)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.DEFAULT.INITIATION.QUEUE)
   TYPE(QLOCAL)                         
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.DEFAULT.LOCAL.QUEUE)       TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.DEFAULT.MODEL.QUEUE)       TYPE(QMODEL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.DEFAULT.REMOTE.QUEUE)      TYPE(QREMOTE)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.DOTNET.XARECOVERY.QUEUE)   TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.DURABLE.MODEL.QUEUE)       TYPE(QMODEL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.DURABLE.SUBSCRIBER.QUEUE)
   TYPE(QLOCAL)                         
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.HIERARCHY.STATE)           TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.INTER.QMGR.CONTROL)        TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.INTER.QMGR.FANREQ)         TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.INTER.QMGR.PUBS)           TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.INTERNAL.REPLY.QUEUE)      TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.INTERNAL.REQUEST.QUEUE)    TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.JMS.TEMPQ.MODEL)           TYPE(QMODEL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.MQEXPLORER.REPLY.MODEL)    TYPE(QMODEL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.MQSC.REPLY.QUEUE)          TYPE(QMODEL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.NDURABLE.MODEL.QUEUE)      TYPE(QMODEL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.PENDING.DATA.QUEUE)        TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.PROTECTION.ERROR.QUEUE)    TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.PROTECTION.POLICY.QUEUE)   TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.REST.REPLY.QUEUE)          TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.RETAINED.PUB.QUEUE)        TYPE(QLOCAL)
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.SELECTION.EVALUATION.QUEUE)
   TYPE(QLOCAL)                         
AMQ8409I: Display Queue details.
   QUEUE(SYSTEM.SELECTION.VALIDATION.QUEUE)
   TYPE(QLOCAL)                         
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

Display Listeners

echo "DISPLAY LISTENER(*)" | runmqsc `dspmq | awk '{print $1}' | sed 's/QMNAME//g' | sed 's/[()]//g'`

5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager QM_MDB.


     1 : DISPLAY LISTENER(*)
AMQ8630I: Display listener information details.
   LISTENER(SYSTEM.DEFAULT.LISTENER.TCP)
AMQ8630I: Display listener information details.
   LISTENER(TCP.LISTENER)               
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

You get the picture ....

For the record, this is how I'm getting the Queue Manager name from the dspmq command: -

QMNAME(QM_MDB)                                            STATUS(Running)


dspmq | awk '{print $1}' | sed 's/QMNAME//g' | sed 's/[()]//g'

QM_MDB

In other words, using awk to extract the first column, which is the Queue Manager name, albeit wrapped up with QMNAME() and then using a pair of sed commands to remove (a) the word QMNAME and (b) the opening / closing brackets.

I'm sure there's 73 different ways ....

but that worked for me ...

Of course, all of that could be put into a Bash script: -

cat queryMQ.sh 

#!/bin/bash

echo $1 | runmqsc `dspmq | awk '{print $1}' | sed 's/QMNAME//g' | sed 's/[()]//g'`

./queryMQ.sh "DISPLAY LISTENER(*)"

5724-H72 (C) Copyright IBM Corp. 1994, 2020.
Starting MQSC for queue manager QM_MDB.


     1 : DISPLAY LISTENER(*)
AMQ8630I: Display listener information details.
   LISTENER(SYSTEM.DEFAULT.LISTENER.TCP)
AMQ8630I: Display listener information details.
   LISTENER(TCP.LISTENER)               
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

Again, you get the point .....

For more information on MQ commands etc., please check out the Knowledge Center.

Friday 25 September 2020

Apple AirPods Suck ... no, read on, it's not what you think....

 For the record, I totally love my Apple AirPods, and am on my second pair since they were first released ....

I haven't (yet) got the AirPods Pro, but that's next year's purchase ....

Meantime, I was a little worried that (a) I was going deaf in my left ear and/or (b) my left AirPod wasn't working properly ...

Now I listen to a lot of audio through my AirPods, mostly spoken-word podcasts, but occasionally Apple Music ....

The symptom ... I'd noticed that the sound from the left-hand AirPod was way lower than that from the right-hand AirPod ...

I'd tried my normal tried-and-tested approach of: -

  • Gently cleaning them with a screen wipe, getting rid of dirt and ( alas ) earwax from the outside of both AirPods
  • Using a plastic toothpick to gently prise out the ( alas ) earwax from the speaker grills ( 3x ) of each AirPod
  • Using a plastic toothpick / spiked stick to ensure that the little "breathing hole" was clear on each AirPod
  • Using a cotton bud to clean out each "channel" of the AirPod's charging case
but .... NO DICE

I did double-check that the audio balance on my iPhone was correctly set, with a 50:50 balance between left and right ...

I also tried playing audio with only the left AirPod inserted, but it was oh-so-quiet ( sorry, Bjork )

The solution ?

Suck the AirPods ....

Yeah, I know, right ! That's just GROSS !

But it worked ...

I found the tip here 

I assume that the small amount of suction pulled any ( alas ) earwax out of the interior of the speaker grills, the bits that I couldn't ever possibly clean from the outside ...

Anyway, it worked ...

And, hey, it's my earwax !

Gross but true

Monday 21 September 2020

Debugging Kubernetes DNS

This is totally cribbed from here -> Debugging DNS Resolution


 Create dnsutils.yaml file

cat << EOF > ~/dnsutils.yaml
apiVersion: v1
kind: Pod
metadata:
  name: dnsutils
  namespace: default
spec:
  containers:
  - name: dnsutils
    image: gcr.io/kubernetes-e2e-test-images/dnsutils:1.3
    command:
      - sleep
      - "3600"
    imagePullPolicy: IfNotPresent
  restartPolicy: Always
EOF

Validate YAML


cat ~/dnsutils.yaml

apiVersion: v1
kind: Pod
metadata:
  name: dnsutils
  namespace: default
spec:
  containers:
  - name: dnsutils
    image: gcr.io/kubernetes-e2e-test-images/dnsutils:1.3
    command:
      - sleep
      - "3600"
    imagePullPolicy: IfNotPresent
  restartPolicy: Always


Apply to cluster


kubectl apply -f ~/dnsutils.yaml


pod/dnsutils created


Check running pods


kubectl get pods


NAME                                  READY   STATUS      RESTARTS   AGE

dnsutils                              1/1     Running     0          47s


Use dnsutils to lookup default K8s servicename


kubectl exec -ti dnsutils -- nslookup kubernetes.default


Server: 10.96.0.10

Address: 10.96.0.10#53


Name: kubernetes.default.svc.cluster.local

Address: 10.96.0.1


Use dnsutils to inspect /etc/resolv.conf


kubectl exec -ti dnsutils -- cat /etc/resolv.conf


nameserver 10.96.0.10

search default.svc.cluster.local svc.cluster.local cluster.local

options ndots:5


Use dnsutils to get help for the ping command


kubectl exec -ti dnsutils -- ping --help


BusyBox v1.26.2 (2018-05-30 13:53:45 GMT) multi-call binary.


Usage: ping [OPTIONS] HOST


Send ICMP ECHO_REQUEST packets to network hosts


-4,-6 Force IP or IPv6 name resolution

-c CNT Send only CNT pings

-s SIZE Send SIZE data bytes in packets (default:56)

-t TTL Set TTL

-I IFACE/IP Use interface or IP address as source

-W SEC Seconds to wait for the first response (default:10)

(after all -c CNT packets are sent)

-w SEC Seconds until ping exits (default:infinite)

(can exit earlier with -c CNT)

-q Quiet, only display output at start

and when finished

-p Pattern to use for payload


Use dnsutils to ping google.com


kubectl exec -ti dnsutils -- ping www.google.com


PING www.google.com (172.217.2.100): 56 data bytes

64 bytes from 172.217.2.100: seq=0 ttl=114 time=1.216 ms

64 bytes from 172.217.2.100: seq=1 ttl=114 time=1.328 ms

64 bytes from 172.217.2.100: seq=2 ttl=114 time=1.344 ms

64 bytes from 172.217.2.100: seq=3 ttl=114 time=1.278 ms

64 bytes from 172.217.2.100: seq=4 ttl=114 time=1.483 ms

64 bytes from 172.217.2.100: seq=5 ttl=114 time=1.393 ms

64 bytes from 172.217.2.100: seq=6 ttl=114 time=1.227 ms

64 bytes from 172.217.2.100: seq=7 ttl=114 time=1.343 ms

^C

--- www.google.com ping statistics ---

8 packets transmitted, 8 packets received, 0% packet loss

round-trip min/avg/max = 1.216/1.326/1.483 ms


Use dnsutils to send only 5 pings to google.com


kubectl exec -ti dnsutils -- ping -c 5 www.google.com


PING www.google.com (172.217.2.100): 56 data bytes

64 bytes from 172.217.2.100: seq=0 ttl=114 time=1.382 ms

64 bytes from 172.217.2.100: seq=1 ttl=114 time=1.480 ms

64 bytes from 172.217.2.100: seq=2 ttl=114 time=1.414 ms

64 bytes from 172.217.2.100: seq=3 ttl=114 time=1.326 ms

64 bytes from 172.217.2.100: seq=4 ttl=114 time=1.276 ms


--- www.google.com ping statistics ---

5 packets transmitted, 5 packets received, 0% packet loss

round-trip min/avg/max = 1.276/1.375/1.480 ms


Use dnsutils to ping google.com with a 5-second Time To Live (TTL)


kubectl exec -ti dnsutils -- ping -t 5 www.google.com


PING www.google.com (172.217.2.100): 56 data bytes

^C

--- www.google.com ping statistics ---

276 packets transmitted, 0 packets received, 100% packet loss


Use dnsutils to ping google.com with a 5 second wait


kubectl exec -ti dnsutils -- ping -w 5 www.google.com


PING www.google.com (172.217.2.100): 56 data bytes

64 bytes from 172.217.2.100: seq=0 ttl=114 time=1.153 ms

64 bytes from 172.217.2.100: seq=1 ttl=114 time=1.660 ms

64 bytes from 172.217.2.100: seq=2 ttl=114 time=1.312 ms

64 bytes from 172.217.2.100: seq=3 ttl=114 time=1.144 ms

64 bytes from 172.217.2.100: seq=4 ttl=114 time=1.289 ms


--- www.google.com ping statistics ---

5 packets transmitted, 5 packets received, 0% packet loss

round-trip min/avg/max = 1.144/1.311/1.660 ms


Delete pod

delete pod dnsutils

pod "dnsutils" deleted


SSL and Ciphers on my Synology DiskStation

 Whilst tinkering with my Synology DS-414 Network Attached Storage (NAS), I was trying/failing to SSH into the box: -

ssh -p 8822 admin@diskstation

I was seeing: -

Unable to negotiate with 192.168.1.17 port 8822: no matching cipher found. Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc

Thankfully this is easy to mitigate - I merely needed to see what ciphers my Mac had: -

ssh -Q cipher

3des-cbc
aes128-cbc
aes192-cbc
aes256-cbc
rijndael-cbc@lysator.liu.se
aes128-ctr
aes192-ctr
aes256-ctr
aes128-gcm@openssh.com
aes256-gcm@openssh.com
chacha20-poly1305@openssh.com

and then choose my favourite: -

ssh -p 8822 -c aes256-cbc admin@diskstation

admin@diskstation's password: 
admin@DiskStation:~$ 

Once I added my SSH public key: -

vi ~/.ssh/authorized_keys 

I was off to the races !

Playing with Overcast podcasting app on iOS 14

 I'm not a total fan of the updated  Podcasts app on iOS 14, in terms of the new UI/UX, specifically the melange of Listen Now / Up Next, Latest Episodes and Recently Played.

I may get used to it, and/or Apple may update it further in an iOS 14 fix pack ....

Meantime, I'm tinkering with Overcast, and needed to find a way to export my huge array of podcasts from the Apple app.

Now that we live in a post-iTunes world, the options to export the podcasts from the app appears to have gone ....

Happily, this post did the trick: -

Exporting podcasts from iOS app as OPML

providing a rather useful little Bash script.

TBH I had not realised that macOS keeps its podcasts in a SQLite database: -

ls -al ~/Library/Group\ Containers/243LU875E5.groups.com.apple.podcasts/Documents/

total 65824

drwxr-xr-x@ 7 hayd  staff       224 21 Sep 12:28 .

drwx------  5 hayd  staff       160  5 Nov  2019 ..

-rw-r--r--@ 1 hayd  staff  33411072 21 Sep 12:28 MTLibrary.sqlite

-rw-r--r--@ 1 hayd  staff     32768 21 Sep 08:51 MTLibrary.sqlite-shm

-rw-r--r--@ 1 hayd  staff     32768 21 Sep 12:28 MTLibrary.sqlite-wal

-rw-r--r--@ 1 hayd  staff      1045 21 Sep 11:19 play_queue_restoration.data

-rw-r--r--@ 1 hayd  staff       236 21 Sep 12:28 upnext_items.data

and the Bash script allowed me to export that to an Outline Processor Markup Language (OPML) file: -

<?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
  <head><title>Podcast Subscriptions</title></head>
  <body>
    <outline text="feeds">
<outline type="rss" text="The Perfect Scam" title="The Perfect Scam" xmlUrl="http://perfectscam.aarp.libsynpro.com/rss" htmlUrl="https://www.aarp.org/podcasts/the-perfect-scam" />
<outline type="rss" text="No Country For Young Women" title="No Country For Young Women" xmlUrl="https://podcasts.files.bbci.co.uk/p063zy3c.rss" htmlUrl="http://www.bbc.co.uk/programmes/p063zy3c" />
<outline type="rss" text="WSJ Tech News Briefing" title="WSJ Tech News Briefing" xmlUrl="https://video-api.wsj.com/podcast/rss/wsj/tech-news-briefing" htmlUrl="https://www.wsj.com/podcasts/tech-news-briefing" />
<outline type="rss" text="iMore show" title="iMore show" xmlUrl="http://feeds.feedburner.com/PhoneDifferentPodcast" htmlUrl="http://www.imore.com/imore-show" />
<outline type="rss" text="Wild Wild Tech" title="Wild Wild Tech" xmlUrl="https://feeds.megaphone.fm/wildwildtech" htmlUrl="https://www.studio71.com/us/podcasts/" />
<outline type="rss" text="The Food Chain" title="The Food Chain" xmlUrl="https://podcasts.files.bbci.co.uk/p028z2z0.rss" htmlUrl="http://www.bbc.co.uk/programmes/p028z2z0" />
<outline type="rss" text="PodCTL - Enterprise Kubernetes" title="PodCTL - Enterprise Kubernetes" xmlUrl="http://www.buzzsprout.com/110399.rss" htmlUrl="http://blog.openshift.com" />
<outline type="rss" text="Friday Night Comedy from BBC Radio 4" title="Friday Night Comedy from BBC Radio 4" xmlUrl="http://downloads.bbc.co.uk/podcasts/radio4/fricomedy/rss.xml" htmlUrl="http://www.bbc.co.uk/programmes/p02pc9pj" />
<outline type="rss" text="Daily Tech News Show" title="Daily Tech News Show" xmlUrl="http://feeds.feedburner.com/DailyTechNewsShow" htmlUrl="http://www.dailytechnewsshow.com/" />
<outline type="rss" text="MacBreak Weekly (Audio)" title="MacBreak Weekly (Audio)" xmlUrl="http://leoville.tv/podcasts/mbw.xml" htmlUrl="https://twit.tv/shows/macbreak-weekly" />
<outline type="rss" text="The Archers Omnibus" title="The Archers Omnibus" xmlUrl="http://downloads.bbc.co.uk/podcasts/radio4/archersomni/rss.xml" htmlUrl="http://www.bbc.co.uk/programmes/b006qnkc" />
<outline type="rss" text="Command Line Heroes" title="Command Line Heroes" xmlUrl="https://feeds.pacific-content.com/commandlineheroes" htmlUrl="https://www.redhat.com/en/command-line-heroes" />
<outline type="rss" text="Comedy of the Week" title="Comedy of the Week" xmlUrl="http://www.bbc.co.uk/programmes/p02pc9x6/episodes/downloads.rss" htmlUrl="http://www.bbc.co.uk/programmes/p02pc9x6" />
<outline type="rss" text="Newsjack" title="Newsjack" xmlUrl="http://www.bbc.co.uk/programmes/b00kvs8r/episodes/downloads.rss" htmlUrl="http://www.bbc.co.uk/programmes/b00kvs8r" />
<outline type="rss" text="Tech Tent" title="Tech Tent" xmlUrl="http://www.bbc.co.uk/programmes/p01plr2p/episodes/downloads.rss" htmlUrl="http://www.bbc.co.uk/programmes/p01plr2p" />
<outline type="rss" text="Kermode and Mayo&apos;s Film Review" title="Kermode and Mayo&apos;s Film Review" xmlUrl="http://www.bbc.co.uk/programmes/b00lvdrj/episodes/downloads.rss" htmlUrl="http://www.bbc.co.uk/programmes/b00lvdrj" />
<outline type="rss" text="World Wise Web" title="World Wise Web" xmlUrl="https://podcasts.files.bbci.co.uk/w13xttzz.rss" htmlUrl="http://www.bbc.co.uk/programmes/w13xttzz" />
<outline type="rss" text="Risky Business" title="Risky Business" xmlUrl="http://risky.biz/feeds/risky-business/" htmlUrl="https://risky.biz/" />
<outline type="rss" text="Techmeme Ride Home" title="Techmeme Ride Home" xmlUrl="http://feeds.feedburner.com/TechmemeRideHome" htmlUrl="https://www.ridehome.info/podcast/techmeme-ride-home/" />
<outline type="rss" text="The Missing Cryptoqueen" title="The Missing Cryptoqueen" xmlUrl="https://podcasts.files.bbci.co.uk/p07nkd84.rss" htmlUrl="http://www.bbc.co.uk/programmes/p07nkd84" />
<outline type="rss" text="The CyberWire Daily" title="The CyberWire Daily" xmlUrl="https://thecyberwire.libsyn.com/rss" htmlUrl="https://thecyberwire.com/podcasts/daily-podcast" />
<outline type="rss" text="From Our Own Correspondent Podcast" title="From Our Own Correspondent Podcast" xmlUrl="http://www.bbc.co.uk/programmes/p02nrtpm/episodes/downloads.rss" htmlUrl="http://www.bbc.co.uk/programmes/p02nrtpm" />
<outline type="rss" text="Rocket" title="Rocket" xmlUrl="https://www.relay.fm/rocket/feed" htmlUrl="https://www.relay.fm/rocket" />
<outline type="rss" text="Chit Chat Across the Pond" title="Chit Chat Across the Pond" xmlUrl="https://podfeet.com/ccatp/ccatp-rss.xml" htmlUrl="http://podfeet.com/ccatp" />
<outline type="rss" text="The Checklist by SecureMac" title="The Checklist by SecureMac" xmlUrl="https://checklist.libsyn.com/rss" htmlUrl="http://securemac.com/checklist" />
<outline type="rss" text="In A Few Minutes" title="In A Few Minutes" xmlUrl="https://inafewminutes.libsyn.com/rss" htmlUrl="https://macosken.squarespace.com/inafewminutes" />
<outline type="rss" text="Kubernetes Podcast from Google" title="Kubernetes Podcast from Google" xmlUrl="https://kubernetespodcast.com/feeds/audio.xml" htmlUrl="https://kubernetespodcast.com" />
<outline type="rss" text="API: Aiden and Peter Integration Podcast" title="API: Aiden and Peter Integration Podcast" xmlUrl="https://feed.pippa.io/public/shows/5e1704c99b6e1973086002e4" htmlUrl="https://shows.acast.com/api" />
<outline type="rss" text="The Curious Cases of Rutherford &amp; Fry" title="The Curious Cases of Rutherford &amp; Fry" xmlUrl="https://podcasts.files.bbci.co.uk/b07dx75g.rss" htmlUrl="http://www.bbc.co.uk/programmes/b07dx75g" />
<outline type="rss" text="Mac OS Ken" title="Mac OS Ken" xmlUrl="http://macosken.libsyn.com/rss" htmlUrl="http://macosken.com" />
<outline type="rss" text="NosillaCast Apple Podcast" title="NosillaCast Apple Podcast" xmlUrl="https://www.podfeet.com/NosillaCast/rss.xml" htmlUrl="https://www.podfeet.com" />
<outline type="rss" text="Moral Maze" title="Moral Maze" xmlUrl="https://podcasts.files.bbci.co.uk/b006qk11.rss" htmlUrl="http://www.bbc.co.uk/programmes/b006qk11" />
<outline type="rss" text="Know a Little More" title="Know a Little More" xmlUrl="https://rss.acast.com/know-a-little-more" htmlUrl="http://www.dailytechnewsshow.com/" />
<outline type="rss" text="Tech News Now" title="Tech News Now" xmlUrl="https://feeds.megaphone.fm/CBS3434812209" htmlUrl="https://www.cnet.com/" />
<outline type="rss" text="Darknet Diaries" title="Darknet Diaries" xmlUrl="https://feeds.megaphone.fm/darknetdiaries" htmlUrl="https://darknetdiaries.com/" />
<outline type="rss" text="Big Technology Podcast" title="Big Technology Podcast" xmlUrl="https://feeds.redcircle.com/ee25c9f0-5d25-41ac-8c9c-89bb28f32974" htmlUrl="https://redcircle.com/shows/big-technology-podcast" />
<outline type="rss" text="This Week in Tech (Audio)" title="This Week in Tech (Audio)" xmlUrl="http://leoville.tv/podcasts/twit.xml" htmlUrl="https://twit.tv/shows/this-week-in-tech" />
<outline type="rss" text="People Fixing the World" title="People Fixing the World" xmlUrl="https://podcasts.files.bbci.co.uk/p04grdbc.rss" htmlUrl="http://www.bbc.co.uk/programmes/p04grdbc" />
<outline type="rss" text="Smashing Security" title="Smashing Security" xmlUrl="https://feeds.fireside.fm/smashingsecurity/rss" htmlUrl="http://www.smashingsecurity.com" />
<outline type="rss" text="The News Quiz Extra" title="The News Quiz Extra" xmlUrl="https://podcasts.files.bbci.co.uk/b010m2mj.rss" htmlUrl="http://www.bbc.co.uk/programmes/b010m2mj" />
<outline type="rss" text="Security Now (Audio)" title="Security Now (Audio)" xmlUrl="http://leoville.tv/podcasts/sn.xml" htmlUrl="https://twit.tv/shows/security-now" />
<outline type="rss" text="The Infinite Monkey Cage" title="The Infinite Monkey Cage" xmlUrl="http://downloads.bbc.co.uk/podcasts/radio4/timc/rss.xml" htmlUrl="http://www.bbc.co.uk/programmes/b00snr0w" />
    </outline>
  </body>
</opml>

which I exported to iCloud Drive, and then opened it directly into Overcast using the Share button on my iPhone.

Nice!

Saturday 12 September 2020

TIL checking your routing tables on Ubuntu

 So, in the past, I've used tools such as ifconfig and route and netstat, but TIL something new ...

I was trying to debug a networking problem with a container running on one of my Secure Service Container (SSC) instances on an IBM z14.

Whilst the container was creating, networking was more like notworking.

Via direct access to the SSC, I could open a shell inside the running container, and poke about within its internals.

Whilst it had an IP address, as per:

ip address

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

    link/ether e2:3d:3e:bb:d0:81 brd ff:ff:ff:ff:ff:ff

    inet 172.16.148.4/24 brd 172.16.148.255 scope global eth0

       valid_lft forever preferred_lft forever


and a DNS configuration: -

cat /etc/resolv.conf

# Generated by RunQ

nameserver 8.8.8.8

I wasn't able to ping the outside world, whether 8.8.8.8 or anything else.

I suspect the routing table, but didn't have netstat or route installed and, of course, without internet access could not install them using apt-get update && apt-get install -y 

So what to do ?

At this point, I discovered ip route which goes alongside ip address as per this: -

ip route

default via 172.16.148.1 dev eth0 

172.16.148.0/24 dev eth0 proto kernel scope link src 172.16.148.4 

This (a) showed the routing table and (b more importantly, showed me what I was doing wrong ....

This was the WRONG subnet.

Without going down a rabbit hole, the Docker network that the SSC was using was WRONG :-(

Once I sorted this out, all was well ....

And ip route is now in the kitbag......

Thursday 10 September 2020

More fun with adding users on Ubuntu

 Following my earlier post: -

TIL passwd on Ubuntu no longer supports the stdin option 

I found a better way ...

groupadd wasadmins

adduser --quiet --disabled-password --ingroup wasadmins -shell /bin/bash --home /home/wasadmin --gecos "wasadmin" wasadmin

echo "wasadmin:passw0rd!" | chpasswd

The main benefit of this is that, unlike useradd, the adduser command sets up the new user's profile, by copying from /etc/skel etc.

Nice!

MainframerZ - On YouTube

We had a great event last week, and it's now available on YouTube: -

REPLAY: MainframerZ Meetup 2nd September 2020

Just planning the next event ...

Keep an eye on the MainframerZ page ...

TIL passwd on Ubuntu no longer supports the stdin option

 In the past, I've used the passwd command in scripts to set a default password for new Linux accounts, as per this example: -

groupadd wasadmins

useradd -g wasadmins -d /home/wasadmin wasadmin

echo "passw0rd" | passwd wasadmin --stdin

( remembering that this is for NON-PROD boxes ONLY )

However, things appear to have changed, as that didn't work on Ubuntu 18.0.4

lsb_release -a

No LSB modules are available.

Distributor ID: Ubuntu

Description: Ubuntu 18.04.4 LTS

Release: 18.04

Codename: bionic

as the --stdin option is not supported, as per this: -

echo "passw0rd" | passwd wasadmin --stdin

passwd: unrecognized option '--stdin'
Usage: passwd [options] [LOGIN]

Options:
  -a, --all                     report password status on all accounts
  -d, --delete                  delete the password for the named account
  -e, --expire                  force expire the password for the named account
  -h, --help                    display this help message and exit
  -k, --keep-tokens             change password only if expired
  -i, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -l, --lock                    lock the password of the named account
  -n, --mindays MIN_DAYS        set minimum number of days before password
                                change to MIN_DAYS
  -q, --quiet                   quiet mode
  -r, --repository REPOSITORY   change password in REPOSITORY repository
  -R, --root CHROOT_DIR         directory to chroot into
  -S, --status                  report password status on the named account
  -u, --unlock                  unlock the password of the named account
  -w, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS
  -x, --maxdays MAX_DAYS        set maximum number of days before password
                                change to MAX_DAYS

Thankfully the internet provided an alternate: -


specifically this: -

echo "wasadmin:passw0rd!" | chpasswd

which worked a treat.

I also had to add the -m switch to my useradd command to force it to create a home directory, so we now have this: -

groupadd wasadmins
useradd -g wasadmins -d /home/wasadmin -m wasadmin
echo "wasadmin:passw0rd!" | chpasswd

which does the job nicely!

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...