├── Dockerfile-agent ├── README.md ├── archive ├── README.md ├── mft-containers │ ├── README.md │ ├── README_pbagent.md │ ├── agent │ │ ├── Dockerfile-agent │ │ ├── MQMFTCredentials.xml │ │ ├── ProtocolBridgeCredentials.xml │ │ ├── mft-monitor-agent.sh │ │ ├── mft-stop-container.sh │ │ └── mqft.sh │ └── server │ │ ├── Dockerfile-server │ │ ├── createAgent.mqsc │ │ ├── deleteAgent.mqsc │ │ ├── mqft_setupAgent.sh │ │ ├── mqft_setupCoordination.sh │ │ └── setupQMForMFTAgents.mqsc ├── mft-cp4i │ ├── AgentSetup │ │ ├── Dockerfile-agent │ │ ├── MQMFTCredentials.xml │ │ ├── ProtocolBridgeCredentials.xml │ │ ├── mft-monitor-agent.sh │ │ ├── mft-stop-container.sh │ │ └── mqft.sh │ ├── QMgrSetup │ │ ├── createAgent.mqsc │ │ ├── deleteAgent.mqsc │ │ ├── mqft_setupAgent.sh │ │ ├── mqft_setupCoordination.sh │ │ └── setupQMForMFTAgents.mqsc │ ├── README.md │ ├── README_pbagent.md │ ├── mft_agentredit_Deployment-pba-agent.yaml │ └── mft_agentredit_Deployment.yaml ├── mft-kubernetes-cos │ ├── README.md │ ├── mftdeployment.yaml │ ├── pvc.yaml │ └── scenario.JPG ├── mft-kubernetes │ ├── README_pbagent.md │ ├── Readme.md │ ├── mft_agentredit_Deployment-dest.yaml │ ├── mft_agentredit_Deployment-pba-agent.yaml │ ├── mft_agentredit_Deployment-src.yaml │ └── mqadvdeployment.yaml └── scenario.JPG ├── cmd ├── agentalive │ └── agentalive.go ├── agentready │ └── agentready.go ├── mqfts │ └── mqfts.go └── runagent │ ├── agentconfig.go │ ├── agentconfig_test.go │ ├── commandconfig.go │ ├── commandconfig_test.go │ ├── configutils.go │ ├── configutils_test.go │ ├── constants.go │ ├── container.go │ ├── coordinationconfig.go │ ├── coordinationconfig_test.go │ ├── data │ ├── agent.properties │ ├── certificate.crt │ ├── ocpagcfg.json │ ├── template_agent.properties │ ├── test_agcfg.json │ ├── test_pba.xml │ └── test_pba_template.xml │ ├── envvars.go │ ├── license.go │ ├── license_test.go │ ├── logging.go │ ├── mirror.go │ ├── post_init.go │ ├── process.go │ ├── protocolbridgeproperties.go │ ├── runagent.go │ ├── runagent_test.go │ ├── signals.go │ └── tls.go ├── credentialsexit └── BridgeCredentialExit │ ├── .classpath │ ├── .project │ └── src │ ├── MANIFEST.MF │ └── com │ └── ibm │ └── bridgecredentialexit │ ├── ProtocolBridgeCredentials.json │ ├── ProtocolBridgeCredentials.prop │ ├── ProtocolBridgeCredsNoAssoc.json │ ├── ProtocolBridgeCredsNoPwd.json │ ├── ProtocolBridgeCustomCredentialExit.java │ └── TestPBAExit.java ├── external-how-to-docs ├── agentconfig.md ├── agentdeployment.md ├── build.md ├── connectmqexplorer.md ├── custompbacred.md ├── images │ ├── IBM Cloud Bucket details.png │ ├── connect1.png │ ├── connect10.png │ ├── connect11.png │ ├── connect2.png │ ├── connect3.png │ ├── connect4.png │ ├── connect5.png │ ├── connect6.png │ ├── connect7.png │ ├── connect8.png │ └── connect9.png ├── run-with-podman │ ├── bridgeagentconfig.json │ ├── bridgeagentcrede.json │ ├── qmconfig.mqsc │ ├── run-test.sh │ ├── setauth.sh │ └── sourceagentconfig.json ├── sample-deployments │ ├── agentconfig.yaml │ ├── bridge-agent-config.yaml │ ├── dest-agent-config.yaml │ ├── dest-agent-deployment.yaml │ ├── ocp-clean.sh │ ├── ocp-deploy.sh │ ├── pba-cust-cred-map.yaml │ ├── pvc-dest.yaml │ ├── pvc-source.yaml │ ├── qm.yaml │ ├── qmconfig.yaml │ ├── readme.md │ ├── source-agent-config.yaml │ └── source-agent-deployment.yaml ├── usage-ocp.md └── usage-podman.md ├── go.mod ├── go.sum ├── lab ├── README.md └── mftlab.tar └── pkg ├── logger ├── logger.go └── logger_test.go └── utils ├── messages.go └── utils.go /archive/README.md: -------------------------------------------------------------------------------- 1 | # MFT on Cloud 2 | This repository helps you onboard MFT on to cloudy platforms such as Docker and Kubernetes. 3 | 4 | **Recommended Getting Started approach would be:** 5 | 1. mft-containers 6 | 2. mft-kubernetes 7 | 8 | You can get started in each of the folders in above mentioned order. 9 | 10 | If you need further enhancements or find some problems with existing, please raise them as issues and we'll look after them. 11 | -------------------------------------------------------------------------------- /archive/mft-containers/README_pbagent.md: -------------------------------------------------------------------------------- 1 | --- 2 | copyright: 3 | years: 2017, 2020 4 | lastupdated: "2020-05-19" 5 | --- 6 | 7 | # MQ Managed File Transfer for Containers 8 | 9 | ### Protocol Bridge Agent setup for MFT Containers 10 | 11 | 4. We will create pba agent as part of this document to demonstrate mft agents in container. This agents is named **AGENTPBA**. As a first step of agent configuration, we have to create their congfiguration on coordination queue manager. 12 | ``` 13 | docker exec -ti /etc/mqm/mft/mqft_setupAgent.sh AGENTPBA 14 | ``` 15 | **Note:** 16 | 1. QM1-Container-id is the id of the queue manager container created in above section. 17 | 2. **mqft_setupAgent.sh** script requires MFT agent name as input parameter. 18 | 19 | 5. Once the docker-agent build is successful, run a new container of it, which is agent in container. 20 | ``` 21 | docker run --env MQ_QMGR_NAME=QM1 --env MQ_QMGR_HOST= --env MQ_QMGR_PORT=1414 --env MQ_QMGR_CHL=MFT.SVRCONN --env MFT_AGENT_NAME=AGENTPBA --env IS_PBA_AGENT=true --env PROTOCOL_FILE_SERVER_TYPE= --env SERVER_HOST_NAME= --env SERVER_TIME_ZONE= --env SERVER_PLATFORM= --env SERVER_LOCALE= --env SERVER_FILE_ENCODING= -d --name=AGENTPBA mftagentredist 22 | ``` 23 | - Above command creates a template file **ProtocolBridgeProperties.xml**, in the agent configuration directory MQ_DATA_PATH/mqft/config/coordination_queue_manager/agents/bridge_agent_name. The command also creates an entry in the file for the default protocol file server, if a default was specified when the command was run. 24 | - To Specify more than one server configuration in the **ProtocolBridgeProperties.xml** file you will have to [`docker exec`](https://docs.docker.com/engine/reference/commandline/exec/) into the pba agent container and modify the file and then save a copy the updated docker container for the further use. To do this you can use the `docker commit` command which saves the container state along with all its changes. for more information [click here](https://docs.docker.com/engine/reference/commandline/commit/) . 25 | 26 | **Note:** 27 | 1. : Is the IP Address of the docker host. This could be found out by running `docker inspect` command and look for ipv4address field. 28 | 2. MQ_QMGR_NAME=QM1: Is the queue manager we created and configured as coordination queue manager in above section. 29 | 3. mftagentredist: Is the docker image of mft redistributable agents. 30 | 4. the \"" are the configuration values required for setting up the PBA Agent. For more detailed information [click here](https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.ref.adm.doc/create_bridge_agent_cmd.htm) . 31 | 5. modify the **ProtocolBridgeCredentials.xml** file with your server credentials before building the docker image. -------------------------------------------------------------------------------- /archive/mft-containers/agent/Dockerfile-agent: -------------------------------------------------------------------------------- 1 | # © Copyright IBM Corporation 2015, 2018 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | FROM ubuntu:16.04 15 | 16 | COPY *-IBM-MQFA-Redist-LinuxX64.tar.gz *.sh /tmp/ 17 | COPY *.xml /usr/local/bin/ 18 | RUN export DEBIAN_FRONTEND=noninteractive \ 19 | # Install additional packages required by MQ, this install process and the runtime scripts 20 | && apt-get update -y \ 21 | && apt-get install -y --no-install-recommends \ 22 | bash \ 23 | bc \ 24 | ca-certificates \ 25 | coreutils \ 26 | curl \ 27 | debianutils \ 28 | file \ 29 | findutils \ 30 | gawk \ 31 | grep \ 32 | libc-bin \ 33 | lsb-release \ 34 | mount \ 35 | passwd \ 36 | procps \ 37 | sed \ 38 | tar \ 39 | util-linux \ 40 | inotify-tools \ 41 | locales \ 42 | s3fs \ 43 | # Download and extract the MQ installation files 44 | && mkdir -p /var/mqm/mft \ 45 | && useradd mftadmin \ 46 | && echo mftadmin:passw0rd | chpasswd \ 47 | && mv /tmp/*.sh /usr/local/bin/ \ 48 | && chmod +x /usr/local/bin/*.sh \ 49 | && cd /var/mqm/mft \ 50 | && mv /tmp/*-IBM-MQFA-Redist-LinuxX64.tar.gz /var/mqm/mft/ \ 51 | && tar -zxvf ./*.tar.gz \ 52 | && apt-get update \ 53 | # Remove tar.gz files unpacked by RPM postinst scripts 54 | && find /var/mqm/mft -name '*.tar.gz' -delete \ 55 | # Apply any bug fixes not included in base Ubuntu or MQ image. 56 | # Don't upgrade everything based on Docker best practices https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run 57 | && apt-get upgrade -y libkrb5-26-heimdal \ 58 | && apt-get upgrade -y libexpat1 \ 59 | # End of bug fixes 60 | && rm -rf /var/lib/apt/lists/* \ 61 | && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ 62 | && locale-gen 63 | 64 | ENTRYPOINT ["mqft.sh"] 65 | -------------------------------------------------------------------------------- /archive/mft-containers/agent/MQMFTCredentials.xml: -------------------------------------------------------------------------------- 1 | 2 | 23 | 24 | 75 | 76 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /archive/mft-containers/agent/ProtocolBridgeCredentials.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /archive/mft-containers/agent/mft-monitor-agent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- mode: sh -*- 3 | # © Copyright IBM Corporation 2015, 2017 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | cd /var/mqm/mft/bin 20 | 21 | state() 22 | { 23 | ftePingAgent -m ${MQ_QMGR_NAME} -w 10 ${MFT_AGENT_NAME} | awk -F ':' '/BFGCL0213I/{print $1}; NR in nr' 24 | } 25 | trap "source mft-stop-container.sh" SIGTERM SIGINT 26 | echo "Monitoring MFT Agent" ${MFT_AGENT_NAME} 27 | 28 | # Loop until "ftePingAgent" says the MFT Agent is running 29 | until [ "`state`" == "BFGCL0213I" ]; do 30 | sleep 1 31 | done 32 | ftePingAgent -m ${MQ_QMGR_NAME} -w 10 ${MFT_AGENT_NAME} 33 | echo "IBM MFT Agent ${MFT_AGENT_NAME} is now fully running" 34 | 35 | until [ "`state`" != "BFGCL0213I" ]; do 36 | sleep 5 37 | done 38 | 39 | fteListAgents -p ${MQ_QMGR_NAME} 40 | -------------------------------------------------------------------------------- /archive/mft-containers/agent/mft-stop-container.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- mode: sh -*- 3 | # © Copyright IBM Corporation 2015, 2017 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | /opt/mqm/mft/bin/fteStopAgent -m ${MQ_QMGR_NAME} ${MFT_AGENT_NAME} -------------------------------------------------------------------------------- /archive/mft-containers/agent/mqft.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- mode: sh -*- 3 | # © Copyright IBM Corporation 2015, 2020 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | su mftadmin 19 | cd /var/mqm/mft/bin 20 | 21 | export PATH=$PATH:/var/mqm/mft/bin 22 | #export MQ_QMGR_NAME=QMT 23 | #export MQ_QMGR_HOST=158.175.87.102 24 | #export MQ_QMGR_PORT=31957 25 | #export MQ_QMGR_CHL=CLOUD.APP.SVRCONN 26 | #export MFT_AGENT_NAME=KX 27 | 28 | echo "Setting up FTE Environment for this Agent : " ${BFG_DATA} 29 | cp -f /usr/local/bin/MQMFTCredentials.xml $HOME 30 | cp -f /usr/local/bin/ProtocolBridgeCredentials.xml $HOME 31 | chmod go-rw $HOME/MQMFTCredentials.xml 32 | chmod go-rw $HOME/ProtocolBridgeCredentials.xml 33 | chmod go-rwx /usr/local/bin/MQMFTCredentials.xml 34 | pwd 35 | ls -l $HOME 36 | source fteCreateEnvironment 37 | 38 | # Assumption is that a single queue manager will be used as Coorindation/Command/Agent. 39 | # User should have passed us the queue manager details as environment variables. 40 | 41 | echo "Setting up Coordination manager for this agent" 42 | fteSetupCoordination -coordinationQMgr ${MQ_QMGR_NAME} -coordinationQMgrHost ${MQ_QMGR_HOST} -coordinationQMgrPort ${MQ_QMGR_PORT} -coordinationQMgrChannel ${MQ_QMGR_CHL} -f 43 | echo "Coordination manager setup completed" 44 | 45 | echo "Setting up Command manager for this agent" 46 | fteSetupCommands -connectionQMgr ${MQ_QMGR_NAME} -connectionQMgrHost ${MQ_QMGR_HOST} -connectionQMgrPort ${MQ_QMGR_PORT} -connectionQMgrChannel ${MQ_QMGR_CHL} -f 47 | echo "Command manager setup completed" 48 | 49 | if ["${IS_PBA_AGENT}" == "true"]; then 50 | echo "Creating a MFT PBA Agent" 51 | fteCreateBridgeAgent -agentName ${MFT_AGENT_NAME} -agentQMgr ${MQ_QMGR_NAME} -agentQMgrHost ${MQ_QMGR_HOST} -agentQMgrPort ${MQ_QMGR_PORT} -agentQMgrChannel ${MQ_QMGR_CHL} -bt ${PROTOCOL_FILE_SERVER_TYPE} -bh ${SERVER_HOST_NAME} -btz ${SERVER_TIME_ZONE} -bm ${SERVER_PLATFORM} -bsl ${SERVER_LOCALE} -bfe ${SERVER_FILE_ENCODING} -credentialsFile "/usr/local/bin/MQMFTCredentials.xml" -f 52 | echo "MFT PBA Agent creation was successful" 53 | else 54 | echo "Creating a MFT Agent" 55 | fteCreateAgent -agentName ${MFT_AGENT_NAME} -agentQMgr ${MQ_QMGR_NAME} -agentQMgrHost ${MQ_QMGR_HOST} -agentQMgrPort ${MQ_QMGR_PORT} -agentQMgrChannel ${MQ_QMGR_CHL} -credentialsFile "/usr/local/bin/MQMFTCredentials.xml" -f 56 | echo "Agent creation was successful" 57 | fi 58 | 59 | 60 | if [ "${MFT_AGENT_NAME}" == "A1" ]; then 61 | echo "Creating a sample file" 62 | mkdir -p /tmp/demofiles 63 | echo "This is a demo file created to test mft file transfer" > /tmp/demofiles/samplefile.txt 64 | else 65 | mkdir -p /tmp/dropboxfiles 66 | fi 67 | 68 | #echo "Starting MFT Agent...." 69 | fteStartAgent -p ${MQ_QMGR_NAME} ${MFT_AGENT_NAME} 70 | echo "MFT Agent Started" 71 | 72 | fteListAgents -p ${MQ_QMGR_NAME} 73 | 74 | # Monitor a particular directory to upload files to dropbox. 75 | mft-monitor-agent.sh 76 | -------------------------------------------------------------------------------- /archive/mft-containers/server/Dockerfile-server: -------------------------------------------------------------------------------- 1 | # © Copyright IBM Corporation 2015, 2017 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM ibmcom/mq 16 | USER 0 17 | RUN mkdir -p /etc/mqm/mft 18 | COPY *.mqsc /etc/mqm/mft/ 19 | COPY *.sh /etc/mqm/mft/ 20 | COPY mq.htpasswd /etc/mqm 21 | RUN chmod 0660 /etc/mqm/mft/*.* 22 | RUN chmod +x /etc/mqm/mft/*.sh 23 | RUN chmod 0660 /etc/mqm/mq.htpasswd 24 | USER 1001 -------------------------------------------------------------------------------- /archive/mft-containers/server/createAgent.mqsc: -------------------------------------------------------------------------------- 1 | DEFINE QLOCAL(SYSTEM.FTE.COMMAND.agentName) + 2 | DEFPRTY(0) + 3 | DEFSOPT(SHARED) + 4 | GET(ENABLED) + 5 | MAXDEPTH(5000) + 6 | MAXMSGL(4194304) + 7 | MSGDLVSQ(PRIORITY) + 8 | PUT(ENABLED) + 9 | RETINTVL(999999999) + 10 | SHARE + 11 | NOTRIGGER + 12 | USAGE(NORMAL) + 13 | REPLACE 14 | DEFINE QLOCAL(SYSTEM.FTE.DATA.agentName) + 15 | DEFPRTY(0) + 16 | DEFSOPT(SHARED) + 17 | GET(ENABLED) + 18 | MAXDEPTH(5000) + 19 | MAXMSGL(4194304) + 20 | MSGDLVSQ(PRIORITY) + 21 | PUT(ENABLED) + 22 | RETINTVL(999999999) + 23 | SHARE + 24 | NOTRIGGER + 25 | USAGE(NORMAL) + 26 | REPLACE 27 | DEFINE QLOCAL(SYSTEM.FTE.REPLY.agentName) + 28 | DEFPRTY(0) + 29 | DEFSOPT(SHARED) + 30 | GET(ENABLED) + 31 | MAXDEPTH(5000) + 32 | MAXMSGL(4194304) + 33 | MSGDLVSQ(PRIORITY) + 34 | PUT(ENABLED) + 35 | RETINTVL(999999999) + 36 | SHARE + 37 | NOTRIGGER + 38 | USAGE(NORMAL) + 39 | REPLACE 40 | DEFINE QLOCAL(SYSTEM.FTE.STATE.agentName) + 41 | DEFPRTY(0) + 42 | DEFSOPT(SHARED) + 43 | GET(ENABLED) + 44 | MAXDEPTH(5000) + 45 | MAXMSGL(4194304) + 46 | MSGDLVSQ(PRIORITY) + 47 | PUT(ENABLED) + 48 | RETINTVL(999999999) + 49 | SHARE + 50 | NOTRIGGER + 51 | USAGE(NORMAL) + 52 | REPLACE 53 | DEFINE QLOCAL(SYSTEM.FTE.EVENT.agentName) + 54 | DEFPRTY(0) + 55 | DEFSOPT(SHARED) + 56 | GET(ENABLED) + 57 | MAXDEPTH(5000) + 58 | MAXMSGL(4194304) + 59 | MSGDLVSQ(PRIORITY) + 60 | PUT(ENABLED) + 61 | RETINTVL(999999999) + 62 | SHARE + 63 | NOTRIGGER + 64 | USAGE(NORMAL) + 65 | REPLACE 66 | DEFINE QLOCAL(SYSTEM.FTE.AUTHAGT1.agentName) + 67 | DEFPRTY(0) + 68 | DEFSOPT(SHARED) + 69 | GET(ENABLED) + 70 | MAXDEPTH(0) + 71 | MAXMSGL(0) + 72 | MSGDLVSQ(PRIORITY) + 73 | PUT(ENABLED) + 74 | RETINTVL(999999999) + 75 | SHARE + 76 | NOTRIGGER + 77 | USAGE(NORMAL) + 78 | REPLACE 79 | DEFINE QLOCAL(SYSTEM.FTE.AUTHTRN1.agentName) + 80 | DEFPRTY(0) + 81 | DEFSOPT(SHARED) + 82 | GET(ENABLED) + 83 | MAXDEPTH(0) + 84 | MAXMSGL(0) + 85 | MSGDLVSQ(PRIORITY) + 86 | PUT(ENABLED) + 87 | RETINTVL(999999999) + 88 | SHARE + 89 | NOTRIGGER + 90 | USAGE(NORMAL) + 91 | REPLACE 92 | DEFINE QLOCAL(SYSTEM.FTE.AUTHOPS1.agentName) + 93 | DEFPRTY(0) + 94 | DEFSOPT(SHARED) + 95 | GET(ENABLED) + 96 | MAXDEPTH(0) + 97 | MAXMSGL(0) + 98 | MSGDLVSQ(PRIORITY) + 99 | PUT(ENABLED) + 100 | RETINTVL(999999999) + 101 | SHARE + 102 | NOTRIGGER + 103 | USAGE(NORMAL) + 104 | REPLACE 105 | DEFINE QLOCAL(SYSTEM.FTE.AUTHSCH1.agentName) + 106 | DEFPRTY(0) + 107 | DEFSOPT(SHARED) + 108 | GET(ENABLED) + 109 | MAXDEPTH(0) + 110 | MAXMSGL(0) + 111 | MSGDLVSQ(PRIORITY) + 112 | PUT(ENABLED) + 113 | RETINTVL(999999999) + 114 | SHARE + 115 | NOTRIGGER + 116 | USAGE(NORMAL) + 117 | REPLACE 118 | DEFINE QLOCAL(SYSTEM.FTE.AUTHMON1.agentName) + 119 | DEFPRTY(0) + 120 | DEFSOPT(SHARED) + 121 | GET(ENABLED) + 122 | MAXDEPTH(0) + 123 | MAXMSGL(0) + 124 | MSGDLVSQ(PRIORITY) + 125 | PUT(ENABLED) + 126 | RETINTVL(999999999) + 127 | SHARE + 128 | NOTRIGGER + 129 | USAGE(NORMAL) + 130 | REPLACE 131 | DEFINE QLOCAL(SYSTEM.FTE.AUTHADM1.agentName) + 132 | DEFPRTY(0) + 133 | DEFSOPT(SHARED) + 134 | GET(ENABLED) + 135 | MAXDEPTH(0) + 136 | MAXMSGL(0) + 137 | MSGDLVSQ(PRIORITY) + 138 | PUT(ENABLED) + 139 | RETINTVL(999999999) + 140 | SHARE + 141 | NOTRIGGER + 142 | USAGE(NORMAL) + 143 | REPLACE -------------------------------------------------------------------------------- /archive/mft-containers/server/deleteAgent.mqsc: -------------------------------------------------------------------------------- 1 | DEFINE QLOCAL(SYSTEM.FTE.COMMAND.A1) + 2 | DEFPRTY(0) + 3 | DEFSOPT(SHARED) + 4 | GET(ENABLED) + 5 | MAXDEPTH(5000) + 6 | MAXMSGL(4194304) + 7 | MSGDLVSQ(PRIORITY) + 8 | PUT(ENABLED) + 9 | RETINTVL(999999999) + 10 | SHARE + 11 | NOTRIGGER + 12 | USAGE(NORMAL) + 13 | REPLACE 14 | DEFINE QLOCAL(SYSTEM.FTE.DATA.A1) + 15 | DEFPRTY(0) + 16 | DEFSOPT(SHARED) + 17 | GET(ENABLED) + 18 | MAXDEPTH(5000) + 19 | MAXMSGL(4194304) + 20 | MSGDLVSQ(PRIORITY) + 21 | PUT(ENABLED) + 22 | RETINTVL(999999999) + 23 | SHARE + 24 | NOTRIGGER + 25 | USAGE(NORMAL) + 26 | REPLACE 27 | DEFINE QLOCAL(SYSTEM.FTE.REPLY.A1) + 28 | DEFPRTY(0) + 29 | DEFSOPT(SHARED) + 30 | GET(ENABLED) + 31 | MAXDEPTH(5000) + 32 | MAXMSGL(4194304) + 33 | MSGDLVSQ(PRIORITY) + 34 | PUT(ENABLED) + 35 | RETINTVL(999999999) + 36 | SHARE + 37 | NOTRIGGER + 38 | USAGE(NORMAL) + 39 | REPLACE 40 | DEFINE QLOCAL(SYSTEM.FTE.STATE.A1) + 41 | DEFPRTY(0) + 42 | DEFSOPT(SHARED) + 43 | GET(ENABLED) + 44 | MAXDEPTH(5000) + 45 | MAXMSGL(4194304) + 46 | MSGDLVSQ(PRIORITY) + 47 | PUT(ENABLED) + 48 | RETINTVL(999999999) + 49 | SHARE + 50 | NOTRIGGER + 51 | USAGE(NORMAL) + 52 | REPLACE 53 | DEFINE QLOCAL(SYSTEM.FTE.EVENT.A1) + 54 | DEFPRTY(0) + 55 | DEFSOPT(SHARED) + 56 | GET(ENABLED) + 57 | MAXDEPTH(5000) + 58 | MAXMSGL(4194304) + 59 | MSGDLVSQ(PRIORITY) + 60 | PUT(ENABLED) + 61 | RETINTVL(999999999) + 62 | SHARE + 63 | NOTRIGGER + 64 | USAGE(NORMAL) + 65 | REPLACE 66 | DEFINE QLOCAL(SYSTEM.FTE.AUTHAGT1.A1) + 67 | DEFPRTY(0) + 68 | DEFSOPT(SHARED) + 69 | GET(ENABLED) + 70 | MAXDEPTH(0) + 71 | MAXMSGL(0) + 72 | MSGDLVSQ(PRIORITY) + 73 | PUT(ENABLED) + 74 | RETINTVL(999999999) + 75 | SHARE + 76 | NOTRIGGER + 77 | USAGE(NORMAL) + 78 | REPLACE 79 | DEFINE QLOCAL(SYSTEM.FTE.AUTHTRN1.A1) + 80 | DEFPRTY(0) + 81 | DEFSOPT(SHARED) + 82 | GET(ENABLED) + 83 | MAXDEPTH(0) + 84 | MAXMSGL(0) + 85 | MSGDLVSQ(PRIORITY) + 86 | PUT(ENABLED) + 87 | RETINTVL(999999999) + 88 | SHARE + 89 | NOTRIGGER + 90 | USAGE(NORMAL) + 91 | REPLACE 92 | DEFINE QLOCAL(SYSTEM.FTE.AUTHOPS1.A1) + 93 | DEFPRTY(0) + 94 | DEFSOPT(SHARED) + 95 | GET(ENABLED) + 96 | MAXDEPTH(0) + 97 | MAXMSGL(0) + 98 | MSGDLVSQ(PRIORITY) + 99 | PUT(ENABLED) + 100 | RETINTVL(999999999) + 101 | SHARE + 102 | NOTRIGGER + 103 | USAGE(NORMAL) + 104 | REPLACE 105 | DEFINE QLOCAL(SYSTEM.FTE.AUTHSCH1.A1) + 106 | DEFPRTY(0) + 107 | DEFSOPT(SHARED) + 108 | GET(ENABLED) + 109 | MAXDEPTH(0) + 110 | MAXMSGL(0) + 111 | MSGDLVSQ(PRIORITY) + 112 | PUT(ENABLED) + 113 | RETINTVL(999999999) + 114 | SHARE + 115 | NOTRIGGER + 116 | USAGE(NORMAL) + 117 | REPLACE 118 | DEFINE QLOCAL(SYSTEM.FTE.AUTHMON1.A1) + 119 | DEFPRTY(0) + 120 | DEFSOPT(SHARED) + 121 | GET(ENABLED) + 122 | MAXDEPTH(0) + 123 | MAXMSGL(0) + 124 | MSGDLVSQ(PRIORITY) + 125 | PUT(ENABLED) + 126 | RETINTVL(999999999) + 127 | SHARE + 128 | NOTRIGGER + 129 | USAGE(NORMAL) + 130 | REPLACE 131 | DEFINE QLOCAL(SYSTEM.FTE.AUTHADM1.A1) + 132 | DEFPRTY(0) + 133 | DEFSOPT(SHARED) + 134 | GET(ENABLED) + 135 | MAXDEPTH(0) + 136 | MAXMSGL(0) + 137 | MSGDLVSQ(PRIORITY) + 138 | PUT(ENABLED) + 139 | RETINTVL(999999999) + 140 | SHARE + 141 | NOTRIGGER + 142 | USAGE(NORMAL) + 143 | REPLACE 144 | -------------------------------------------------------------------------------- /archive/mft-containers/server/mqft_setupAgent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- mode: sh -*- 3 | # � Copyright IBM Corporation 2015, 2017 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | extnCreate=_create.mqsc 20 | extnDelete=_delete.mqsc 21 | MQ_MFT_AGENT=$1 22 | echo "Setting up Agent:"$MQ_MFT_AGENT 23 | #copy create file 24 | cp /etc/mqm/mft/createAgent.mqsc /etc/mqm/mft/$MQ_MFT_AGENT$extnCreate 25 | sed -i -e "s/agentName/$MQ_MFT_AGENT/g" /etc/mqm/mft/$MQ_MFT_AGENT$extnCreate 26 | 27 | #copy delete file 28 | cp /etc/mqm/mft/deleteAgent.mqsc /etc/mqm/mft/$MQ_MFT_AGENT$extnDelete 29 | sed -i -e "s/agentName/$MQ_MFT_AGENT/g" /etc/mqm/mft/$MQ_MFT_AGENT$extnDelete 30 | 31 | #run only create. 32 | runmqsc ${MQ_QMGR_NAME} < /etc/mqm/mft/$MQ_MFT_AGENT$extnCreate 33 | echo "Completed..." 34 | -------------------------------------------------------------------------------- /archive/mft-containers/server/mqft_setupCoordination.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- mode: sh -*- 3 | # ? Copyright IBM Corporation 2015, 2017 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | runmqsc $MQ_QMGR_NAME < /etc/mqm/mft/setupQMForMFTAgents.mqsc 20 | 21 | 22 | -------------------------------------------------------------------------------- /archive/mft-containers/server/setupQMForMFTAgents.mqsc: -------------------------------------------------------------------------------- 1 | DEFINE CHANNEL('MFT.SVRCONN') CHLTYPE(SVRCONN) REPLACE 2 | SET CHLAUTH('MFT.SVRCONN') TYPE(BLOCKUSER) USERLIST('nobody') DESCR('Allow privileged users on this channel') 3 | SET CHLAUTH('*') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(NOACCESS) DESCR('BackStop rule') 4 | SET CHLAUTH('MFT.SVRCONN') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(CHANNEL) CHCKCLNT(REQUIRED) 5 | SET CHLAUTH('MFT.SVRCONN') TYPE(USERMAP) CLNTUSER('mftadmin') USERSRC(CHANNEL) DESCR('Allows admin user to connect via ADMIN channel') ACTION(REPLACE) 6 | SET CHLAUTH('MFT.SVRCONN') TYPE(USERMAP) CLNTUSER('mftadmin') USERSRC(MAP) MCAUSER ('mqm') DESCR ('Allow admin as MQ-admin') ACTION(REPLACE) 7 | REFRESH SECURITY TYPE(CONNAUTH) 8 | DEFINE TOPIC('SYSTEM.FTE') TOPICSTR('SYSTEM.FTE') REPLACE 9 | ALTER TOPIC('SYSTEM.FTE') NPMSGDLV(ALLAVAIL) PMSGDLV(ALLAVAIL) 10 | DEFINE QLOCAL(SYSTEM.FTE) LIKE(SYSTEM.BROKER.DEFAULT.STREAM) REPLACE 11 | ALTER QLOCAL(SYSTEM.FTE) DESCR('Stream for MQMFT Pub/Sub interface') 12 | * Altering namelist: SYSTEM.QPUBSUB.QUEUE.NAMELIST 13 | * Value prior to alteration: 14 | DISPLAY NAMELIST(SYSTEM.QPUBSUB.QUEUE.NAMELIST) 15 | ALTER NAMELIST(SYSTEM.QPUBSUB.QUEUE.NAMELIST) + 16 | NAMES(SYSTEM.BROKER.DEFAULT.STREAM+ 17 | ,SYSTEM.BROKER.ADMIN.STREAM,SYSTEM.FTE) 18 | * Altering PSMODE. Value prior to alteration: 19 | DISPLAY QMGR PSMODE 20 | ALTER QMGR PSMODE(ENABLED) 21 | -------------------------------------------------------------------------------- /archive/mft-cp4i/AgentSetup/Dockerfile-agent: -------------------------------------------------------------------------------- 1 | # © Copyright IBM Corporation 2015, 2018 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | FROM ubuntu:16.04 15 | 16 | COPY *-IBM-MQFA-Redist-LinuxX64.tar.gz *.sh /tmp/ 17 | RUN export DEBIAN_FRONTEND=noninteractive \ 18 | # Install additional packages required by MQ, this install process and the runtime scripts 19 | && apt-get update -y \ 20 | && apt-get install -y --no-install-recommends \ 21 | bash \ 22 | bc \ 23 | ca-certificates \ 24 | coreutils \ 25 | curl \ 26 | debianutils \ 27 | file \ 28 | findutils \ 29 | gawk \ 30 | grep \ 31 | libc-bin \ 32 | lsb-release \ 33 | mount \ 34 | passwd \ 35 | procps \ 36 | sed \ 37 | vim \ 38 | tar \ 39 | util-linux \ 40 | inotify-tools \ 41 | locales \ 42 | s3fs \ 43 | # Download and extract the MQ installation files 44 | && mkdir -p /var/mqm/mft \ 45 | && useradd -m -d /home/mftadmin mftadmin \ 46 | && echo mftadmin:passw0rd | chpasswd \ 47 | && chown -R mftadmin:root /var/mqm/* \ 48 | && chown -R mftadmin:root /tmp/* \ 49 | && chmod -R g+w /var/mqm/* \ 50 | && chmod -R g+w /tmp/* \ 51 | && mv /tmp/*.sh /usr/local/bin/ \ 52 | && chmod +x /usr/local/bin/*.sh \ 53 | && cd /var/mqm/mft \ 54 | && mv /tmp/*-IBM-MQFA-Redist-LinuxX64.tar.gz /var/mqm/mft/ \ 55 | && tar -zxvf ./*.tar.gz \ 56 | && apt-get update \ 57 | # Remove tar.gz files unpacked by RPM postinst scripts 58 | && find /var/mqm/mft -name '*.tar.gz' -delete \ 59 | # Apply any bug fixes not included in base Ubuntu or MQ image. 60 | # Don't upgrade everything based on Docker best practices https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run 61 | && apt-get upgrade -y libkrb5-26-heimdal \ 62 | && apt-get upgrade -y libexpat1 \ 63 | # End of bug fixes 64 | && rm -rf /var/lib/apt/lists/* \ 65 | && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ 66 | && locale-gen 67 | ENV BFG_DATA=/var/mqm/mft/mftdata 68 | ENV HOME=/home/mftadmin 69 | ENV MFT_WAIT_FOR_AGENT=30 70 | COPY *.xml /home/mftadmin/ 71 | RUN chown -R mftadmin:root /home/mftadmin/* \ 72 | && chmod go-rw /home/mftadmin//MQMFTCredentials.xml \ 73 | && chmod go-rw /home/mftadmin/ProtocolBridgeCredentials.xml 74 | USER mftadmin 75 | ENTRYPOINT ["mqft.sh"] 76 | -------------------------------------------------------------------------------- /archive/mft-cp4i/AgentSetup/MQMFTCredentials.xml: -------------------------------------------------------------------------------- 1 | 2 | 23 | 24 | 75 | 76 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /archive/mft-cp4i/AgentSetup/ProtocolBridgeCredentials.xml: -------------------------------------------------------------------------------- 1 | 2 | 39 | 40 | 44 | 45 | 46 | 47 | 49 | 50 | -----BEGIN RSA PRIVATE KEY----- 51 | MIIEowIBAAKCAQEApJz3Ne2aW0b8nTmQAdVYBcal0PBrywm53lYVduER2zw0Y1ar 52 | ksRvDrQGdJO0J9x3aaA+YDCnUyHqhvnJEc29Y7BhbpGOjZAzXOqrrs2jucyqQ3mX 53 | TY3SWaYo5e35bNZcTURDWWp5d6eagh2aqEAS6KO8DyiagFiSm7FOb6g8kQarfBwk 54 | BsxC5/8RTAHfIvJD7KPh6yGBemypb3EedPcwXlPTdriA+Y+ANhHNUJWfFUgulziY 55 | 9vKUqbQMfY9p2OndwmbBCYcYOevfCL76tUusuvzhWjR90p1xUwwGl/PsMWdDTNZj 56 | tnhK7G+eIwL85dvLlQBRAOl7e5SaTkCRdWF8VwIDAQABAoIBAHoSTOEZClaWFc8i 57 | WMCDTXs7DMwc/lLbK5LNk61MyskhpFfmdeWo9hKZPhBFWFwXChayVo9OhUcI57qg 58 | kZM6VzAOJLKyDly8itpkzFwc80VdmQXgrWs9uLfymHGqQEWN0XUbIja01s7843+K 59 | JJ6QpXUPtu4m1ixHgrEik2AKCqAgeTXDmkHxPA+6dzg9Z/f7gSPEAmKBIT9W3A0M 60 | pk6V/3+e/mmHMZjuIuVli6+rPpdNl9rvVKY3AnY2L1HBX/eIYIGekaioTGyqBLuk 61 | g6dfSapTjqLSShAhx3UmkL/70lFvvo/w1OsgY9PzFksHEUwLlHnMz/cTaKhKfIrj 62 | U9WOaoECgYEA2Hkp1/12p3nVYTM8/loRcWDQtCuQrDEl4veRuJrZpAvR88x66ODW 63 | 2Dz1iVUio9581K1s2RIouCP4m+DCYQdtNNEwRhFrLvl7zROkbZ5xQs1frDXCLqZv 64 | r0RQE/s/ADliQnT4mwb3HvR2hdCwEYodKKKF0Shu+ZqETrOXTU2D8AkCgYEAwqum 65 | O/58bbQUqmTD3ZiGgryuGvYz5RYTblVFp1zPjqcMRYOx99Z6kFsq7K7YKx0b7Vup 66 | iL7X4/Qip094c1fejP4yYCFPwjQ5s8l7egWEp1FKJQ2vo6Z9nYcjaYnjY9RGJtAd 67 | pHduNtwqmPwT0ClnZ3WcdHKGOUCpnfWZjgW4YV8CgYAgHaG6nK0M3cNtf0eOSNiL 68 | pJxyDoCRO11uleI1rCub7fEBJZYalLjrLegTruDLxQdqGiyq68nEv/lzTt4nvQ1T 69 | p7Fsw8rOFk9qtn5PkREmoweNqhAcEa9CJnVm8YCATQMp7uavQVJKcmRfJ/3nLEF1 70 | NN97j28fcvAsKPLKkjR/2QKBgQCaeOJ8EMBjvNX5L+RMXs+9xkLRmjQrwIzCrF+N 71 | IpSAugV+07XQ2ByBmBZDoape68ZRXr70h5uAgyVMZj9KJ5utfbgzl7tWe2KeS27z 72 | sJVGv7Z6GJYa4e4jpixvfr81ZCgWfGZJL4wBdEtJAh4mu/QVoLn5nTbtD2aItW6X 73 | x+o7OQKBgBmfvINsbTKP8ZrJEoeH2YJ51D8HVEdyYtyIt1tWnGtxloxJRu8ijXmc 74 | sEbBB2sP0JOF0RSTzJ/8EjnIK3v+gxrOEv+hyNmUEQTarhNBGyyDf2eYCi+crbR+ 75 | QqZs4aa2Vy11kBd5vbz44xM5UTZFab2Ba0BetCQDlHJiPVSqqYH7 76 | -----END RSA PRIVATE KEY----- 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /archive/mft-cp4i/AgentSetup/mft-monitor-agent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- mode: sh -*- 3 | # © Copyright IBM Corporation 2015, 2017 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | cd /var/mqm/mft/bin 20 | 21 | state() 22 | { 23 | ftePingAgent -m ${MQ_QMGR_NAME} -w 10 ${MFT_AGENT_NAME} | awk -F ':' '/BFGCL0213I/{print $1}; NR in nr' 24 | } 25 | trap "source mft-stop-container.sh" SIGTERM SIGINT 26 | echo "Monitoring MFT Agent" ${MFT_AGENT_NAME} 27 | 28 | # Loop until "ftePingAgent" says the MFT Agent is running 29 | until [ "`state`" == "BFGCL0213I" ]; do 30 | sleep 1 31 | done 32 | ftePingAgent -m ${MQ_QMGR_NAME} -w 10 ${MFT_AGENT_NAME} 33 | echo "IBM MFT Agent ${MFT_AGENT_NAME} is now fully running" 34 | 35 | until [ "`state`" != "BFGCL0213I" ]; do 36 | sleep 5 37 | done 38 | 39 | fteListAgents -p ${MQ_QMGR_NAME} 40 | -------------------------------------------------------------------------------- /archive/mft-cp4i/AgentSetup/mft-stop-container.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- mode: sh -*- 3 | # © Copyright IBM Corporation 2015, 2017 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | /opt/mqm/mft/bin/fteStopAgent -m ${MQ_QMGR_NAME} ${MFT_AGENT_NAME} -------------------------------------------------------------------------------- /archive/mft-cp4i/AgentSetup/mqft.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- mode: sh -*- 3 | # © Copyright IBM Corporation 2015, 2017 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | cd /var/mqm/mft/bin 19 | 20 | export PATH=$PATH:/var/mqm/mft/bin 21 | 22 | echo "Setting up FTE Environment for this Agent : " ${BFG_DATA} 23 | source fteCreateEnvironment 24 | 25 | echo "Agent Configuration Details:" 26 | echo "Home directory list:" 27 | ls -l $HOME 28 | 29 | echo "Queue manager:" $MQ_QMGR_NAME 30 | echo "Queue manager host:" $MQ_QMGR_HOST 31 | echo "Queue manager port:" $MQ_QMGR_PORT 32 | echo "Queue manager channel:" $MQ_QMGR_CHL 33 | 34 | # Assumption is that a single queue manager will be used as Coorindation/Command/Agent. 35 | # User should have passed us the queue manager details as environment variables. 36 | 37 | echo "Setting up Coordination manager for this agent" 38 | fteSetupCoordination -coordinationQMgr ${MQ_QMGR_NAME} -coordinationQMgrHost ${MQ_QMGR_HOST} -coordinationQMgrPort ${MQ_QMGR_PORT} -coordinationQMgrChannel ${MQ_QMGR_CHL} -f 39 | echo "Coordination manager setup completed" 40 | 41 | echo "Setting up Command manager for this agent" 42 | fteSetupCommands -connectionQMgr ${MQ_QMGR_NAME} -connectionQMgrHost ${MQ_QMGR_HOST} -connectionQMgrPort ${MQ_QMGR_PORT} -connectionQMgrChannel ${MQ_QMGR_CHL} -f 43 | echo "Command manager setup completed" 44 | 45 | if [ "${IS_PBA_AGENT}" == "true" ]; then 46 | echo "Creating MFT PBA Agent" 47 | fteCreateBridgeAgent -agentName ${MFT_AGENT_NAME} -agentQMgr ${MQ_QMGR_NAME} -agentQMgrHost ${MQ_QMGR_HOST} -agentQMgrPort ${MQ_QMGR_PORT} -agentQMgrChannel ${MQ_QMGR_CHL} -bt ${PROTOCOL_FILE_SERVER_TYPE} -bh ${SERVER_HOST_NAME} -bm ${SERVER_PLATFORM} -bfe ${SERVER_FILE_ENCODING} -credentialsFile "$HOME/MQMFTCredentials.xml" -f 48 | # to be added if support for FTPS and nondefault port is required : -btz ${SERVER_TIME_ZONE} -bsl ${SERVER_LOCALE} -blf ${SERVER_LISTING_FORMAT} -bts ${TRUSTSTORE_FILE_PATH} -bp ${SERVER_PORT} 49 | echo "MFT PBA Agent creation was successful" 50 | else 51 | echo "Creating MFT Agent" 52 | fteCreateAgent -agentName ${MFT_AGENT_NAME} -agentQMgr ${MQ_QMGR_NAME} -agentQMgrHost ${MQ_QMGR_HOST} -agentQMgrPort ${MQ_QMGR_PORT} -agentQMgrChannel ${MQ_QMGR_CHL} -credentialsFile "$HOME/MQMFTCredentials.xml" -f 53 | echo "Agent creation was successful" 54 | fi 55 | 56 | if [ "${MFT_TRANSFER_LOGS_ENABLED}" == "true" ]; then 57 | echo "Setting up logs for transfers" 58 | echo 'logCapture=true' >> ${BFG_DATA}/mqft/config/${MQ_QMGR_NAME}/agents/${MFT_AGENT_NAME}/agent.properties 59 | fi 60 | 61 | if [ "${MFT_AGENT_NAME}" == "A1" ]; then 62 | echo "Creating a sample file" 63 | mkdir -p /tmp/demofiles 64 | echo "This is a demo file created to test mft file transfer" > /tmp/demofiles/samplefile.txt 65 | fi 66 | 67 | #echo "Starting MFT Agent...." 68 | fteStartAgent -p ${MQ_QMGR_NAME} ${MFT_AGENT_NAME} 69 | echo "MFT Agent Started" 70 | 71 | fteListAgents -p ${MQ_QMGR_NAME} 72 | 73 | echo "Sleeping to give opprutunity to customiz agents" 74 | sleep ${MFT_WAIT_FOR_AGENT} 75 | 76 | # Monitor a particular directory to upload files to dropbox. 77 | mft-monitor-agent.sh 78 | -------------------------------------------------------------------------------- /archive/mft-cp4i/QMgrSetup/createAgent.mqsc: -------------------------------------------------------------------------------- 1 | DEFINE QLOCAL(SYSTEM.FTE.COMMAND.agentName) + 2 | DEFPRTY(0) + 3 | DEFSOPT(SHARED) + 4 | GET(ENABLED) + 5 | MAXDEPTH(5000) + 6 | MAXMSGL(4194304) + 7 | MSGDLVSQ(PRIORITY) + 8 | PUT(ENABLED) + 9 | RETINTVL(999999999) + 10 | SHARE + 11 | NOTRIGGER + 12 | USAGE(NORMAL) + 13 | REPLACE 14 | DEFINE QLOCAL(SYSTEM.FTE.DATA.agentName) + 15 | DEFPRTY(0) + 16 | DEFSOPT(SHARED) + 17 | GET(ENABLED) + 18 | MAXDEPTH(5000) + 19 | MAXMSGL(4194304) + 20 | MSGDLVSQ(PRIORITY) + 21 | PUT(ENABLED) + 22 | RETINTVL(999999999) + 23 | SHARE + 24 | NOTRIGGER + 25 | USAGE(NORMAL) + 26 | REPLACE 27 | DEFINE QLOCAL(SYSTEM.FTE.REPLY.agentName) + 28 | DEFPRTY(0) + 29 | DEFSOPT(SHARED) + 30 | GET(ENABLED) + 31 | MAXDEPTH(5000) + 32 | MAXMSGL(4194304) + 33 | MSGDLVSQ(PRIORITY) + 34 | PUT(ENABLED) + 35 | RETINTVL(999999999) + 36 | SHARE + 37 | NOTRIGGER + 38 | USAGE(NORMAL) + 39 | REPLACE 40 | DEFINE QLOCAL(SYSTEM.FTE.STATE.agentName) + 41 | DEFPRTY(0) + 42 | DEFSOPT(SHARED) + 43 | GET(ENABLED) + 44 | MAXDEPTH(5000) + 45 | MAXMSGL(4194304) + 46 | MSGDLVSQ(PRIORITY) + 47 | PUT(ENABLED) + 48 | RETINTVL(999999999) + 49 | SHARE + 50 | NOTRIGGER + 51 | USAGE(NORMAL) + 52 | REPLACE 53 | DEFINE QLOCAL(SYSTEM.FTE.EVENT.agentName) + 54 | DEFPRTY(0) + 55 | DEFSOPT(SHARED) + 56 | GET(ENABLED) + 57 | MAXDEPTH(5000) + 58 | MAXMSGL(4194304) + 59 | MSGDLVSQ(PRIORITY) + 60 | PUT(ENABLED) + 61 | RETINTVL(999999999) + 62 | SHARE + 63 | NOTRIGGER + 64 | USAGE(NORMAL) + 65 | REPLACE 66 | DEFINE QLOCAL(SYSTEM.FTE.AUTHAGT1.agentName) + 67 | DEFPRTY(0) + 68 | DEFSOPT(SHARED) + 69 | GET(ENABLED) + 70 | MAXDEPTH(0) + 71 | MAXMSGL(0) + 72 | MSGDLVSQ(PRIORITY) + 73 | PUT(ENABLED) + 74 | RETINTVL(999999999) + 75 | SHARE + 76 | NOTRIGGER + 77 | USAGE(NORMAL) + 78 | REPLACE 79 | DEFINE QLOCAL(SYSTEM.FTE.AUTHTRN1.agentName) + 80 | DEFPRTY(0) + 81 | DEFSOPT(SHARED) + 82 | GET(ENABLED) + 83 | MAXDEPTH(0) + 84 | MAXMSGL(0) + 85 | MSGDLVSQ(PRIORITY) + 86 | PUT(ENABLED) + 87 | RETINTVL(999999999) + 88 | SHARE + 89 | NOTRIGGER + 90 | USAGE(NORMAL) + 91 | REPLACE 92 | DEFINE QLOCAL(SYSTEM.FTE.AUTHOPS1.agentName) + 93 | DEFPRTY(0) + 94 | DEFSOPT(SHARED) + 95 | GET(ENABLED) + 96 | MAXDEPTH(0) + 97 | MAXMSGL(0) + 98 | MSGDLVSQ(PRIORITY) + 99 | PUT(ENABLED) + 100 | RETINTVL(999999999) + 101 | SHARE + 102 | NOTRIGGER + 103 | USAGE(NORMAL) + 104 | REPLACE 105 | DEFINE QLOCAL(SYSTEM.FTE.AUTHSCH1.agentName) + 106 | DEFPRTY(0) + 107 | DEFSOPT(SHARED) + 108 | GET(ENABLED) + 109 | MAXDEPTH(0) + 110 | MAXMSGL(0) + 111 | MSGDLVSQ(PRIORITY) + 112 | PUT(ENABLED) + 113 | RETINTVL(999999999) + 114 | SHARE + 115 | NOTRIGGER + 116 | USAGE(NORMAL) + 117 | REPLACE 118 | DEFINE QLOCAL(SYSTEM.FTE.AUTHMON1.agentName) + 119 | DEFPRTY(0) + 120 | DEFSOPT(SHARED) + 121 | GET(ENABLED) + 122 | MAXDEPTH(0) + 123 | MAXMSGL(0) + 124 | MSGDLVSQ(PRIORITY) + 125 | PUT(ENABLED) + 126 | RETINTVL(999999999) + 127 | SHARE + 128 | NOTRIGGER + 129 | USAGE(NORMAL) + 130 | REPLACE 131 | DEFINE QLOCAL(SYSTEM.FTE.AUTHADM1.agentName) + 132 | DEFPRTY(0) + 133 | DEFSOPT(SHARED) + 134 | GET(ENABLED) + 135 | MAXDEPTH(0) + 136 | MAXMSGL(0) + 137 | MSGDLVSQ(PRIORITY) + 138 | PUT(ENABLED) + 139 | RETINTVL(999999999) + 140 | SHARE + 141 | NOTRIGGER + 142 | USAGE(NORMAL) + 143 | REPLACE -------------------------------------------------------------------------------- /archive/mft-cp4i/QMgrSetup/deleteAgent.mqsc: -------------------------------------------------------------------------------- 1 | DEFINE QLOCAL(SYSTEM.FTE.COMMAND.A1) + 2 | DEFPRTY(0) + 3 | DEFSOPT(SHARED) + 4 | GET(ENABLED) + 5 | MAXDEPTH(5000) + 6 | MAXMSGL(4194304) + 7 | MSGDLVSQ(PRIORITY) + 8 | PUT(ENABLED) + 9 | RETINTVL(999999999) + 10 | SHARE + 11 | NOTRIGGER + 12 | USAGE(NORMAL) + 13 | REPLACE 14 | DEFINE QLOCAL(SYSTEM.FTE.DATA.A1) + 15 | DEFPRTY(0) + 16 | DEFSOPT(SHARED) + 17 | GET(ENABLED) + 18 | MAXDEPTH(5000) + 19 | MAXMSGL(4194304) + 20 | MSGDLVSQ(PRIORITY) + 21 | PUT(ENABLED) + 22 | RETINTVL(999999999) + 23 | SHARE + 24 | NOTRIGGER + 25 | USAGE(NORMAL) + 26 | REPLACE 27 | DEFINE QLOCAL(SYSTEM.FTE.REPLY.A1) + 28 | DEFPRTY(0) + 29 | DEFSOPT(SHARED) + 30 | GET(ENABLED) + 31 | MAXDEPTH(5000) + 32 | MAXMSGL(4194304) + 33 | MSGDLVSQ(PRIORITY) + 34 | PUT(ENABLED) + 35 | RETINTVL(999999999) + 36 | SHARE + 37 | NOTRIGGER + 38 | USAGE(NORMAL) + 39 | REPLACE 40 | DEFINE QLOCAL(SYSTEM.FTE.STATE.A1) + 41 | DEFPRTY(0) + 42 | DEFSOPT(SHARED) + 43 | GET(ENABLED) + 44 | MAXDEPTH(5000) + 45 | MAXMSGL(4194304) + 46 | MSGDLVSQ(PRIORITY) + 47 | PUT(ENABLED) + 48 | RETINTVL(999999999) + 49 | SHARE + 50 | NOTRIGGER + 51 | USAGE(NORMAL) + 52 | REPLACE 53 | DEFINE QLOCAL(SYSTEM.FTE.EVENT.A1) + 54 | DEFPRTY(0) + 55 | DEFSOPT(SHARED) + 56 | GET(ENABLED) + 57 | MAXDEPTH(5000) + 58 | MAXMSGL(4194304) + 59 | MSGDLVSQ(PRIORITY) + 60 | PUT(ENABLED) + 61 | RETINTVL(999999999) + 62 | SHARE + 63 | NOTRIGGER + 64 | USAGE(NORMAL) + 65 | REPLACE 66 | DEFINE QLOCAL(SYSTEM.FTE.AUTHAGT1.A1) + 67 | DEFPRTY(0) + 68 | DEFSOPT(SHARED) + 69 | GET(ENABLED) + 70 | MAXDEPTH(0) + 71 | MAXMSGL(0) + 72 | MSGDLVSQ(PRIORITY) + 73 | PUT(ENABLED) + 74 | RETINTVL(999999999) + 75 | SHARE + 76 | NOTRIGGER + 77 | USAGE(NORMAL) + 78 | REPLACE 79 | DEFINE QLOCAL(SYSTEM.FTE.AUTHTRN1.A1) + 80 | DEFPRTY(0) + 81 | DEFSOPT(SHARED) + 82 | GET(ENABLED) + 83 | MAXDEPTH(0) + 84 | MAXMSGL(0) + 85 | MSGDLVSQ(PRIORITY) + 86 | PUT(ENABLED) + 87 | RETINTVL(999999999) + 88 | SHARE + 89 | NOTRIGGER + 90 | USAGE(NORMAL) + 91 | REPLACE 92 | DEFINE QLOCAL(SYSTEM.FTE.AUTHOPS1.A1) + 93 | DEFPRTY(0) + 94 | DEFSOPT(SHARED) + 95 | GET(ENABLED) + 96 | MAXDEPTH(0) + 97 | MAXMSGL(0) + 98 | MSGDLVSQ(PRIORITY) + 99 | PUT(ENABLED) + 100 | RETINTVL(999999999) + 101 | SHARE + 102 | NOTRIGGER + 103 | USAGE(NORMAL) + 104 | REPLACE 105 | DEFINE QLOCAL(SYSTEM.FTE.AUTHSCH1.A1) + 106 | DEFPRTY(0) + 107 | DEFSOPT(SHARED) + 108 | GET(ENABLED) + 109 | MAXDEPTH(0) + 110 | MAXMSGL(0) + 111 | MSGDLVSQ(PRIORITY) + 112 | PUT(ENABLED) + 113 | RETINTVL(999999999) + 114 | SHARE + 115 | NOTRIGGER + 116 | USAGE(NORMAL) + 117 | REPLACE 118 | DEFINE QLOCAL(SYSTEM.FTE.AUTHMON1.A1) + 119 | DEFPRTY(0) + 120 | DEFSOPT(SHARED) + 121 | GET(ENABLED) + 122 | MAXDEPTH(0) + 123 | MAXMSGL(0) + 124 | MSGDLVSQ(PRIORITY) + 125 | PUT(ENABLED) + 126 | RETINTVL(999999999) + 127 | SHARE + 128 | NOTRIGGER + 129 | USAGE(NORMAL) + 130 | REPLACE 131 | DEFINE QLOCAL(SYSTEM.FTE.AUTHADM1.A1) + 132 | DEFPRTY(0) + 133 | DEFSOPT(SHARED) + 134 | GET(ENABLED) + 135 | MAXDEPTH(0) + 136 | MAXMSGL(0) + 137 | MSGDLVSQ(PRIORITY) + 138 | PUT(ENABLED) + 139 | RETINTVL(999999999) + 140 | SHARE + 141 | NOTRIGGER + 142 | USAGE(NORMAL) + 143 | REPLACE 144 | -------------------------------------------------------------------------------- /archive/mft-cp4i/QMgrSetup/mqft_setupAgent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- mode: sh -*- 3 | # � Copyright IBM Corporation 2015, 2017 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | extnCreate=_create.mqsc 20 | extnDelete=_delete.mqsc 21 | MQ_MFT_AGENT=$1 22 | echo "Setting up Agent:"$MQ_MFT_AGENT 23 | #copy create file 24 | cp /etc/mqm/QMgrSetup/createAgent.mqsc /etc/mqm/QMgrSetup/$MQ_MFT_AGENT$extnCreate 25 | sed -i -e "s/agentName/$MQ_MFT_AGENT/g" /etc/mqm/QMgrSetup/$MQ_MFT_AGENT$extnCreate 26 | 27 | #copy delete file 28 | cp /etc/mqm/QMgrSetup/deleteAgent.mqsc /etc/mqm/QMgrSetup/$MQ_MFT_AGENT$extnDelete 29 | sed -i -e "s/agentName/$MQ_MFT_AGENT/g" /etc/mqm/QMgrSetup/$MQ_MFT_AGENT$extnDelete 30 | 31 | #run only create. 32 | runmqsc ${MQ_QMGR_NAME} < /etc/mqm/QMgrSetup/$MQ_MFT_AGENT$extnCreate 33 | echo "Completed..." 34 | -------------------------------------------------------------------------------- /archive/mft-cp4i/QMgrSetup/mqft_setupCoordination.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # -*- mode: sh -*- 3 | # ? Copyright IBM Corporation 2015, 2017 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | runmqsc $MQ_QMGR_NAME < /etc/mqm/QMgrSetup/setupQMForMFTAgents.mqsc 20 | 21 | 22 | -------------------------------------------------------------------------------- /archive/mft-cp4i/QMgrSetup/setupQMForMFTAgents.mqsc: -------------------------------------------------------------------------------- 1 | DEFINE CHANNEL('MFT.SVRCONN') CHLTYPE(SVRCONN) REPLACE 2 | SET CHLAUTH('MFT.SVRCONN') TYPE(BLOCKUSER) USERLIST('nobody') DESCR('Allow privileged users on this channel') 3 | SET CHLAUTH('*') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(NOACCESS) DESCR('BackStop rule') 4 | SET CHLAUTH('MFT.SVRCONN') TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(CHANNEL) CHCKCLNT(REQUIRED) 5 | SET CHLAUTH('MFT.SVRCONN') TYPE(USERMAP) CLNTUSER('mftadmin') USERSRC(CHANNEL) DESCR('Allows admin user to connect via ADMIN channel') ACTION(REPLACE) 6 | SET CHLAUTH('MFT.SVRCONN') TYPE(USERMAP) CLNTUSER('mftadmin') USERSRC(MAP) MCAUSER ('mqm') DESCR ('Allow admin as MQ-admin') ACTION(REPLACE) 7 | REFRESH SECURITY TYPE(CONNAUTH) 8 | DEFINE TOPIC('SYSTEM.FTE') TOPICSTR('SYSTEM.FTE') REPLACE 9 | ALTER TOPIC('SYSTEM.FTE') NPMSGDLV(ALLAVAIL) PMSGDLV(ALLAVAIL) 10 | DEFINE QLOCAL(SYSTEM.FTE) LIKE(SYSTEM.BROKER.DEFAULT.STREAM) REPLACE 11 | ALTER QLOCAL(SYSTEM.FTE) DESCR('Stream for MQMFT Pub/Sub interface') 12 | * Altering namelist: SYSTEM.QPUBSUB.QUEUE.NAMELIST 13 | * Value prior to alteration: 14 | DISPLAY NAMELIST(SYSTEM.QPUBSUB.QUEUE.NAMELIST) 15 | ALTER NAMELIST(SYSTEM.QPUBSUB.QUEUE.NAMELIST) + 16 | NAMES(SYSTEM.BROKER.DEFAULT.STREAM+ 17 | ,SYSTEM.BROKER.ADMIN.STREAM,SYSTEM.FTE) 18 | * Altering PSMODE. Value prior to alteration: 19 | DISPLAY QMGR PSMODE 20 | ALTER QMGR PSMODE(ENABLED) 21 | -------------------------------------------------------------------------------- /archive/mft-cp4i/README_pbagent.md: -------------------------------------------------------------------------------- 1 | --- 2 | copyright: 3 | years: 2017, 2020 4 | lastupdated: "2020-06-09" 5 | --- 6 | 7 | # MQ Managed File Transfer for Kubernetes 8 | 9 | ### Protocol Bridge Agent setup for MFT Kubernetes cluster 10 | 11 | 1. We will create a pba agent on kubernetes cluster as part of this tutorial. This agent is names **PBA**. As a first step of agent configuration, we have to create their congfiguration on the coordination queue manager. 12 | 13 | ``` 14 | oc exec -ti /etc/mqm/QMgrSetup/mqft_setupAgent.sh PBA 15 | ``` 16 | ### MFT Agents deployment on to Kubernetes cluster 17 | 18 | 1. Create a new deployment file(mft_agentredit_Deployment-pba-agent.yaml) for deploying the MFT Agent as a pod and container within it. 19 | 20 | **Note:** Currently the sample only enables you to configure it against a SFTP Server. 21 | ``` 22 | apiVersion: apps/v1beta1 23 | kind: Deployment 24 | metadata: 25 | name: mft-cp4i-pba 26 | spec: 27 | replicas: 1 28 | template: 29 | metadata: 30 | labels: 31 | app: mqft-cp4i 32 | spec: 33 | containers: 34 | - name: agentpba 35 | image: image-registry.openshift-image-registry.svc:5000/mq915mft/mftpbaagent:1.0 36 | imagePullPolicy: Always 37 | env: 38 | - name: MQ_QMGR_NAME 39 | value: "mqmft0806" 40 | - name: MQ_QMGR_HOST 41 | value: "10.254.18.54" 42 | - name: MQ_QMGR_PORT 43 | value: "1414" 44 | - name: MQ_QMGR_CHL 45 | value: "DEV.ADMIN.SVRCONN" 46 | - name: MFT_AGENT_NAME 47 | value: "PBA" 48 | - name: IS_PBA_AGENT 49 | value: "true" 50 | - name: PROTOCOL_FILE_SERVER_TYPE # Required if IS_PBA_AGENT=true e.g.: FTP,SFTP,FTPS 51 | value: "SFTP" 52 | - name: SERVER_HOST_NAME # Required if IS_PBA_AGENT=true 53 | value: "10.254.18.31" 54 | - name: SERVER_PLATFORM # UNIX, WINDOWS - Required if IS_PBA_AGENT=true 55 | value: "UNIX" 56 | - name: SERVER_FILE_ENCODING # Required if IS_PBA_AGENT=true e.g.: UTF-8 57 | value: "UTF-8" 58 | ``` 59 | 60 | **Note:** 61 | 1. For more detailed information on PBA [click here](https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.ref.adm.doc/create_bridge_agent_cmd.htm). 62 | 63 | 64 | ### Apply the deployment on your Kubernetes cluster 65 | 66 | 1. Run following command to create the MFT Agent deployment 67 | ``` 68 | oc create -f filepath/mft_agentredit_Deployment-pba-agent.yaml 69 | ``` 70 | 2. Check if the deployment is successful and pod is in running state. Run the below command with few seconds gap until you find the pod status to be running 71 | ``` 72 | oc get pods 73 | ``` 74 | 3. If incase pods goes into error state. Review the logs to investigate and debug on error cause. 75 | ``` 76 | oc describe pod 77 | oc logs -c 78 | ``` 79 | **Note:** 80 | 1. `` can be found in the output of command `kubectl get pods` 81 | 2. `` can be found in the mft_agentredit_Deployment-pba-agent.yaml file(at spec-->containers-->name) 82 | 3. Above command creates a template file **ProtocolBridgeProperties.xml**, in the agent configuration directory MQ_DATA_PATH/mqft/config/coordination_queue_manager/agents/bridge_agent_name. The command also creates an entry in the file for the default protocol file server, if a default was specified when the command was run. 83 | 4. To Specify more than one server configuration in the ProtocolBridgeProperties.xml file you will have to use `oc exec` into the pba agent pod and modify the file and then save copy of it for the further use. -------------------------------------------------------------------------------- /archive/mft-cp4i/mft_agentredit_Deployment-pba-agent.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: mft-cp4i-pba 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: mqft-cp4i 11 | spec: 12 | containers: 13 | - name: agentpba 14 | image: image-registry.openshift-image-registry.svc:5000/mq915mft/mftpbaagent:1.0 15 | imagePullPolicy: Always 16 | env: 17 | - name: MQ_QMGR_NAME 18 | value: "mqmft0806" 19 | - name: MQ_QMGR_HOST 20 | value: "10.254.18.54" 21 | - name: MQ_QMGR_PORT 22 | value: "1414" 23 | - name: MQ_QMGR_CHL 24 | value: "DEV.ADMIN.SVRCONN" 25 | - name: MFT_AGENT_NAME 26 | value: "PBA" 27 | - name: IS_PBA_AGENT 28 | value: "true" 29 | - name: PROTOCOL_FILE_SERVER_TYPE # Required if IS_PBA_AGENT=true e.g.: FTP,SFTP,FTPS 30 | value: "SFTP" 31 | - name: SERVER_HOST_NAME # Required if IS_PBA_AGENT=true 32 | value: "10.254.18.31" 33 | - name: SERVER_PLATFORM # UNIX, WINDOWS - Required if IS_PBA_AGENT=true 34 | value: "UNIX" 35 | - name: SERVER_FILE_ENCODING # Required if IS_PBA_AGENT=true e.g.: UTF-8 36 | value: "UTF-8" 37 | - name: "MFT_TRANSFER_LOGS_ENABLED" 38 | value: "true" 39 | 40 | 41 | -------------------------------------------------------------------------------- /archive/mft-cp4i/mft_agentredit_Deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: mft-cp4i-a1 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: mqft-cp4i 11 | spec: 12 | containers: 13 | - name: agentdest 14 | image: image-registry.openshift-image-registry.svc:5000/mq914mft/mftagent:1.0 15 | imagePullPolicy: Always 16 | env: 17 | - name: MQ_QMGR_NAME 18 | value: "mqmft1" 19 | - name: MQ_QMGR_HOST 20 | value: "10.254.24.120" 21 | - name: MQ_QMGR_PORT 22 | value: "1414" 23 | - name: MQ_QMGR_CHL 24 | value: "DEV.ADMIN.SVRCONN" 25 | - name: MFT_AGENT_NAME 26 | value: "A1" 27 | - name: "MFT_TRANSFER_LOGS_ENABLED" 28 | value: "true" 29 | -------------------------------------------------------------------------------- /archive/mft-kubernetes-cos/mftdeployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: mft-kube-deployment-dest 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: mqft-kube-dest 11 | spec: 12 | containers: 13 | - name: agentdest 14 | image: registry.eu-de.bluemix.net/mft-images/mftagents3fs:1.0 15 | volumeMounts: 16 | - name: mftstore 17 | mountPath: /home/MFTLocalStore 18 | env: 19 | - name: MQ_QMGR_NAME 20 | value: "MFT_QMA" 21 | - name: MQ_QMGR_HOST 22 | value: "mft-qma-b188.qm2.eu-gb.mqcloud.ibm.com" 23 | - name: MQ_QMGR_PORT 24 | value: "30846" 25 | - name: MQ_QMGR_CHL 26 | value: "CLOUD.ADMIN.SVRCONN" 27 | - name: MFT_AGENT_NAME 28 | value: "IBMCLOUD_AGENT" 29 | volumes: 30 | - name: mftstore 31 | persistentVolumeClaim: 32 | claimName: mymftpvc 33 | 34 | -------------------------------------------------------------------------------- /archive/mft-kubernetes-cos/pvc.yaml: -------------------------------------------------------------------------------- 1 | kind: PersistentVolumeClaim 2 | apiVersion: v1 3 | metadata: 4 | name: mymftpvc 5 | namespace: default 6 | annotations: 7 | volume.beta.kubernetes.io/storage-class: "ibmc-s3fs-standard-regional" 8 | ibm.io/endpoint: "https://s3.eu-de.objectstorage.service.networklayer.com" 9 | ibm.io/region: "eu-de" 10 | ibm.io/auto-create-bucket: "false" 11 | ibm.io/auto-delete-bucket: "false" 12 | ibm.io/bucket: "test-bkt" 13 | ibm.io/secret-name: "coscredentials" 14 | spec: 15 | accessModes: 16 | - ReadWriteOnce 17 | resources: 18 | requests: 19 | storage: 8Gi # Enter a fictitious value 20 | 21 | -------------------------------------------------------------------------------- /archive/mft-kubernetes-cos/scenario.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/archive/mft-kubernetes-cos/scenario.JPG -------------------------------------------------------------------------------- /archive/mft-kubernetes/README_pbagent.md: -------------------------------------------------------------------------------- 1 | --- 2 | copyright: 3 | years: 2017, 2020 4 | lastupdated: "2020-05-19" 5 | --- 6 | 7 | # MQ Managed File Transfer for Kubernetes 8 | 9 | ### Protocol Bridge Agent setup for MFT Kubernetes cluster 10 | 11 | 2. We will create a source agent on kubernetes cluster as part of this tutorial. These agents are **AGENTSRC**. As a first step of agent configuration, we have to create their congfiguration on the coordination queue manager. 12 | 13 | ``` 14 | kubectl exec -ti /etc/mqm/mft/mqft_setupAgent.sh AGENTPBA 15 | ``` 16 | ### MFT Agents deployment on to Kubernetes cluster 17 | 18 | Create a new deployment file(mft_agentredit_Deployment-pba-agent.yaml) for deploying the MFT Agent as a pod and container within it. 19 | 20 | ``` 21 | apiVersion: apps/v1beta1 22 | kind: Deployment 23 | metadata: 24 | name: mft-kube-deployment-src 25 | spec: 26 | replicas: 1 27 | template: 28 | metadata: 29 | labels: 30 | app: mqft-kube-src 31 | spec: 32 | containers: 33 | - name: agentsrc 34 | image: registry.eu-de.bluemix.net/mft-images/agentredist_mftimagerepo:1.0 35 | env: 36 | - name: MQ_QMGR_NAME 37 | value: "QM1" 38 | - name: MQ_QMGR_HOST 39 | value: "169.51.10.240" 40 | - name: MQ_QMGR_PORT 41 | value: "32075" 42 | - name: MQ_QMGR_CHL 43 | value: "MFT.SVRCONN" 44 | - name: MFT_AGENT_NAME 45 | value: "AGENTSRC" 46 | - name: IS_PBA_AGENT 47 | value: "true" 48 | - name: PROTOCOL_FILE_SERVER_TYPE 49 | value: 50 | - name: SERVER_HOST_NAME 51 | value: 52 | - name: SERVER_TIME_ZONE 53 | value: 54 | - name: SERVER_PLATFORM 55 | value: 56 | - name: SERVER_LOCALE 57 | value: 58 | - name: SERVER_FILE_ENCODING 59 | value: 60 | ``` 61 | 62 | **Note:** 63 | 1. the \"" are the configuration values required for setting up the PBA Agent. For more detailed information [click here](https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.ref.adm.doc/create_bridge_agent_cmd.htm) . 64 | 65 | ### Apply the deployment on your Kubernetes cluster 66 | 67 | 1. Run following command to create the MFT Agent deployment 68 | ``` 69 | kubectl create -f filepath/mft_agentredit_Deployment-pba-agent.yaml 70 | ``` 71 | 2. Check if the deployment is successful and pod is in running state. Run the below command with few seconds gap until you find the pod status to be running 72 | ``` 73 | kubectl get pods 74 | ``` 75 | 3. If incase pods goes into error state. Review the logs to investigate and debug on error cause. 76 | ``` 77 | kubectl describe pod 78 | kubectl logs -c 79 | ``` 80 | **Note:** 81 | 1. `` can be found in the output of command `kubectl get pods` 82 | 2. `` can be found in the mqadvdeployment.yaml file(at spec-->containers-->name) 83 | 3. Above command creates a template file **ProtocolBridgeProperties.xml**, in the agent configuration directory MQ_DATA_PATH/mqft/config/coordination_queue_manager/agents/bridge_agent_name. The command also creates an entry in the file for the default protocol file server, if a default was specified when the command was run. 84 | 4. To Specify more than one server configuration in the ProtocolBridgeProperties.xml file you will have to use kubectl exec into the pba agent pod and modify the file and then save copy of it for the further use. -------------------------------------------------------------------------------- /archive/mft-kubernetes/mft_agentredit_Deployment-dest.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: mft-kube-deployment-dest 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: mqft-kube-dest 11 | spec: 12 | containers: 13 | - name: agentdest 14 | image: registry.eu-de.bluemix.net/mft-images/agentredist_mftimagerepo:1.0 15 | env: 16 | - name: MQ_QMGR_NAME 17 | value: "QM1" 18 | - name: MQ_QMGR_HOST 19 | value: "QMgr Host name" 20 | - name: MQ_QMGR_PORT 21 | value: "QMgr Port" 22 | - name: MQ_QMGR_CHL 23 | value: "QMgr SVRCONN Channel" 24 | - name: MFT_AGENT_NAME 25 | value: "AGENTDEST" 26 | -------------------------------------------------------------------------------- /archive/mft-kubernetes/mft_agentredit_Deployment-pba-agent.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: mft-kube-deployment 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: mqft-kube 11 | spec: 12 | containers: 13 | - name: agentsrc 14 | image: registry.eu-de.bluemix.net/mft-images/agentredist_mftimagerepo:1.0 15 | env: 16 | - name: MQ_QMGR_NAME 17 | value: "QM1" 18 | - name: MQ_QMGR_HOST 19 | value: "QMgr Host name" 20 | - name: MQ_QMGR_PORT 21 | value: "QMgr port" 22 | - name: MQ_QMGR_CHL 23 | value: "QMgr SVRCONN Channel" 24 | - name: MFT_AGENT_NAME 25 | value: "AGENTSRC" 26 | - name: IS_PBA_AGENT 27 | value: "true" 28 | - name: PROTOCOL_FILE_SERVER_TYPE 29 | value: "" 30 | - name: SERVER_HOST_NAME 31 | value: "" 32 | - name: SERVER_TIME_ZONE 33 | value: "" 34 | - name: SERVER_PLATFORM 35 | value: "" 36 | - name: SERVER_LOCALE 37 | value: "" 38 | - name: SERVER_FILE_ENCODING 39 | value: "" 40 | -------------------------------------------------------------------------------- /archive/mft-kubernetes/mft_agentredit_Deployment-src.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: mft-kube-deployment 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: mqft-kube 11 | spec: 12 | containers: 13 | - name: agentsrc 14 | image: registry.eu-de.bluemix.net/mft-images/agentredist_mftimagerepo:1.0 15 | env: 16 | - name: MQ_QMGR_NAME 17 | value: "QM1" 18 | - name: MQ_QMGR_HOST 19 | value: "QMgr Host name" 20 | - name: MQ_QMGR_PORT 21 | value: "QMgr port" 22 | - name: MQ_QMGR_CHL 23 | value: "QMgr SVRCONN Channel" 24 | - name: MFT_AGENT_NAME 25 | value: "AGENTSRC" 26 | -------------------------------------------------------------------------------- /archive/mft-kubernetes/mqadvdeployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: mqadvmft-deployment 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: mqadvmft 11 | spec: 12 | containers: 13 | - name: mqadvmft 14 | image: registry.eu-de.bluemix.net/mft-images/mqadvmft:1.0 15 | env: 16 | - name: LICENSE 17 | value: "accept" 18 | - name: MQ_QMGR_NAME 19 | value: "QM1" 20 | -------------------------------------------------------------------------------- /archive/scenario.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/archive/scenario.JPG -------------------------------------------------------------------------------- /cmd/agentalive/agentalive.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2020, 2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | /* 18 | * This file contains the source code for the liveness probe. The 19 | * liveness probe is program that tests if an IBM MQ Managed File 20 | * Transfer agent is running or not. The program reads the PID 21 | * of agent JVM from from agent.pid file and verifies if it is 22 | * running or not. Returns true if the process is alive else false. 23 | * Based on the return value of this probe, a container orchestration 24 | * platform like Kubernetes can recycle an agent. 25 | */ 26 | package main 27 | 28 | import ( 29 | "fmt" 30 | "os" 31 | "strings" 32 | 33 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 34 | "github.com/tidwall/gjson" 35 | ) 36 | 37 | const AGENT_ALIV_EXIT_CODE_0 = 0 38 | const AGENT_ALIV_EXIT_CODE_1 = 1 39 | const AGENT_ALIV_EXIT_CODE_2 = 2 40 | const AGENT_ALIV_EXIT_CODE_3 = 3 41 | const AGENT_ALIV_EXIT_CODE_4 = 4 42 | const AGENT_ALIV_EXIT_CODE_5 = 5 43 | const AGENT_ALIV_EXIT_CODE_6 = 6 44 | 45 | /* 46 | * Main entry point to liveness probe 47 | */ 48 | func main() { 49 | var bfgDataPath string 50 | var bfgConfigFilePath string 51 | var agentConfig string 52 | var e error 53 | 54 | //Name of the agent is retrieved from environment variable MFT_AGENT_NAME 55 | agentNameEnv, agentNameEnvSet := os.LookupEnv("MFT_AGENT_NAME") 56 | if !agentNameEnvSet { 57 | utils.PrintLog(utils.AGENT_ALIV_ENV_AGENT_NAME_NOT_SET_4001) 58 | os.Exit(AGENT_ALIV_EXIT_CODE_1) 59 | } 60 | 61 | /* 62 | * Read the name of an agent configuration file from environment 63 | * variable MFT_AGENT_CONFIG_FILE 64 | */ 65 | bfgConfigFilePath, bfgConfigFilePathSet := os.LookupEnv("MFT_AGENT_CONFIG_FILE") 66 | if !bfgConfigFilePathSet { 67 | // MFT_AGENT_CONFIG_FILE environment variable not specified. Looking for 68 | // config.json file in /run/mqmft directory. 69 | msg := fmt.Sprintf(utils.MFT_ENV_AGNT_CFG_FILE_NOT_SPECIFIED, utils.MFT_DEFAULT_CONFIG_JSON) 70 | utils.PrintLog(msg) 71 | // Assign the default config filename, so that rest of the processing goes on. 72 | bfgConfigFilePath = utils.MFT_DEFAULT_CONFIG_JSON 73 | } else { 74 | bfgConfigFilePath = strings.TrimSpace(bfgConfigFilePath) 75 | if bfgConfigFilePath == "" { 76 | utils.PrintLog(utils.MFT_CONT_ENV_AGNT_CFG_FILE_BLANK_0012) 77 | os.Exit(AGENT_ALIV_EXIT_CODE_2) 78 | } 79 | } 80 | 81 | // Read agent configuration data from JSON file. 82 | agentConfig, e = utils.ReadConfigurationDataFromFile(bfgConfigFilePath) 83 | // Exit if we had any error when reading configuration file 84 | if e != nil { 85 | utils.PrintLog(fmt.Sprintf(utils.AGENT_ALIV_ENV_CFG_FILE_READ_4003, bfgConfigFilePath, e)) 86 | os.Exit(AGENT_ALIV_EXIT_CODE_3) 87 | } 88 | 89 | // Get path from environment variable 90 | bfgConfigMountPath, bfgConfigMountPathSet := os.LookupEnv("BFG_DATA") 91 | if bfgConfigMountPathSet { 92 | bfgConfigMountPath = strings.Trim(bfgConfigMountPath, "") 93 | if len(bfgConfigMountPath) > 0 { 94 | bfgDataPath = bfgConfigMountPath 95 | } else { 96 | // BFG_DATA is not set. So fixed path 97 | bfgDataPath = utils.FIXED_BFG_DATAPATH 98 | } 99 | } else { 100 | // BFG_DATA is not set. So fixed path 101 | bfgDataPath = utils.FIXED_BFG_DATAPATH 102 | } 103 | 104 | // Read the agentPid file from the agent logs directory 105 | agentPidPath := bfgDataPath + "/mqft/logs/" + gjson.Get(agentConfig, "coordinationQMgr.name").String() + "/agents/" + agentNameEnv + "/agent.pid" 106 | // Open agent.pid file and read the pid from the file. 107 | agentPid, _ := utils.GetAgentPid(agentPidPath) 108 | if agentPid > 1 { 109 | agentRunning, err := utils.IsAgentRunning(agentPid) 110 | if err != nil { 111 | utils.PrintLog(fmt.Sprintf(utils.AGENT_ALIV_NOT_RUNNING_4004, agentNameEnv)) 112 | os.Exit(AGENT_ALIV_EXIT_CODE_4) 113 | } else { 114 | if agentRunning { 115 | os.Exit(AGENT_ALIV_EXIT_CODE_0) 116 | } else { 117 | utils.PrintLog(fmt.Sprintf(utils.AGENT_ALIV_NOT_RUNNING_4004, agentNameEnv)) 118 | os.Exit(AGENT_ALIV_EXIT_CODE_5) 119 | } 120 | } 121 | } else { 122 | utils.PrintLog(fmt.Sprintf(utils.AGENT_ALIV_NOT_RUNNING_4004, agentNameEnv)) 123 | os.Exit(AGENT_ALIV_EXIT_CODE_6) 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /cmd/agentready/agentready.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2020, 2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "strings" 23 | 24 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 25 | "github.com/tidwall/gjson" 26 | ) 27 | 28 | const AGENT_REDY_EXIT_CODE_0 = 0 29 | const AGENT_REDY_EXIT_CODE_1 = 1 30 | const AGENT_REDY_EXIT_CODE_2 = 2 31 | const AGENT_REDY_EXIT_CODE_3 = 3 32 | const AGENT_REDY_EXIT_CODE_4 = 4 33 | const AGENT_REDY_EXIT_CODE_5 = 5 34 | const AGENT_REDY_EXIT_CODE_6 = 6 35 | const AGENT_REDY_EXIT_CODE_7 = 7 36 | 37 | /* 38 | * This file contains the source code for the readiness probe. The 39 | * readiness probe is program that tests if an IBM MQ Managed File 40 | * Transfer agent is ready or not. The program scans the output0.log 41 | * of agent for BFGAG0059I and BFGAG0191I events. Returns true if 42 | * any of the above events are found in the log file else false. 43 | * Based on the return value of this probe, a container orchestration 44 | * platform like Kubernetes can recycle an agent. 45 | */ 46 | func main() { 47 | var bfgDataPath string 48 | var bfgConfigFilePath string 49 | var agentConfig string 50 | var e error 51 | 52 | //Name of the agent is retrieved from environment variable MFT_AGENT_NAME 53 | agentNameEnv, agentNameEnvSet := os.LookupEnv("MFT_AGENT_NAME") 54 | if !agentNameEnvSet { 55 | utils.PrintLog(utils.AGENT_REDY_ENV_AGENT_NAME_NOT_SET_3001) 56 | os.Exit(AGENT_REDY_EXIT_CODE_1) 57 | } 58 | 59 | /* 60 | * Read the name of an agent configuration file from environment 61 | * variable MFT_AGENT_CONFIG_FILE 62 | */ 63 | bfgConfigFilePath, bfgConfigFilePathSet := os.LookupEnv("MFT_AGENT_CONFIG_FILE") 64 | if !bfgConfigFilePathSet { 65 | // MFT_AGENT_CONFIG_FILE environment variable not specified. Looking for 66 | // config.json file in /run/mqmft directory. 67 | msg := fmt.Sprintf(utils.MFT_ENV_AGNT_CFG_FILE_NOT_SPECIFIED, utils.MFT_DEFAULT_CONFIG_JSON) 68 | utils.PrintLog(msg) 69 | // Assign the default config filename, so that rest of the processing goes on. 70 | bfgConfigFilePath = utils.MFT_DEFAULT_CONFIG_JSON 71 | } else { 72 | bfgConfigFilePath = strings.TrimSpace(bfgConfigFilePath) 73 | if bfgConfigFilePath == "" { 74 | utils.PrintLog(utils.MFT_CONT_ENV_AGNT_CFG_FILE_BLANK_0012) 75 | os.Exit(AGENT_REDY_EXIT_CODE_7) 76 | } 77 | } 78 | 79 | // Read agent configuration data from JSON file. 80 | agentConfig, e = utils.ReadConfigurationDataFromFile(bfgConfigFilePath) 81 | // Exit if we had any error when reading configuration file 82 | if e != nil { 83 | utils.PrintLog(fmt.Sprintf(utils.AGENT_REDY_ENV_CFG_FILE_READ_3003, bfgConfigFilePath, e)) 84 | os.Exit(AGENT_REDY_EXIT_CODE_3) 85 | } 86 | 87 | // Get path from environment variable 88 | bfgConfigMountPath, bfgConfigMountPathSet := os.LookupEnv("BFG_DATA") 89 | if bfgConfigMountPathSet { 90 | bfgConfigMountPath = strings.Trim(bfgConfigMountPath, "") 91 | if len(bfgConfigMountPath) > 0 { 92 | bfgDataPath = bfgConfigMountPath 93 | } else { 94 | // BFG_DATA is not set. So fixed path 95 | bfgDataPath = utils.FIXED_BFG_DATAPATH 96 | } 97 | } else { 98 | // BFG_DATA is not set. So fixed path 99 | bfgDataPath = utils.FIXED_BFG_DATAPATH 100 | } 101 | 102 | coordinationQMgr := gjson.Get(agentConfig, "coordinationQMgr.name").String() 103 | // Read the agentPid file from the agent logs directory 104 | agentPidPath := bfgDataPath + "/mqft/logs/" + coordinationQMgr + "/agents/" + agentNameEnv + "/agent.pid" 105 | // Open agent.pid file and read the pid from the file. 106 | agentPid, _ := utils.GetAgentPid(agentPidPath) 107 | if agentPid > 1 { 108 | agentRunning, err := utils.IsAgentRunning(agentPid) 109 | if err != nil { 110 | utils.PrintLog(fmt.Sprintf(utils.AGENT_REDY_NOT_RUNNING_3004, agentNameEnv)) 111 | os.Exit(AGENT_REDY_EXIT_CODE_4) 112 | } else { 113 | if agentRunning { 114 | // Agent is running, so check if it is ready. 115 | agentStatus, _ := utils.IsAgentReady(bfgDataPath, agentNameEnv, coordinationQMgr) 116 | if agentStatus { 117 | os.Exit(AGENT_REDY_EXIT_CODE_0) 118 | } else { 119 | utils.PrintLog(utils.AGENT_REDY_EVNT_NOT_FOUND_3005) 120 | os.Exit(AGENT_REDY_EXIT_CODE_5) 121 | } 122 | } else { 123 | utils.PrintLog(fmt.Sprintf(utils.AGENT_REDY_NOT_RUNNING_3004, agentNameEnv)) 124 | os.Exit(AGENT_REDY_EXIT_CODE_6) 125 | } 126 | } 127 | } else { 128 | utils.PrintLog(fmt.Sprintf(utils.AGENT_REDY_NOT_RUNNING_3004, agentNameEnv)) 129 | os.Exit(AGENT_REDY_EXIT_CODE_7) 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /cmd/runagent/agentconfig_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2022, 2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "fmt" 20 | "strings" 21 | "testing" 22 | 23 | "github.com/tidwall/gjson" 24 | 25 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 26 | ) 27 | 28 | /* 29 | * Unit test program to test methods of runagent. 30 | */ 31 | func TestProtocolBridgePropertiesFileUpdates(t *testing.T) { 32 | allAgentConfig, e := utils.ReadConfigurationDataFromFile("./data/test_agcfg.json") 33 | if e != nil { 34 | t.Fatal(e) 35 | } 36 | 37 | agentCfg := gjson.Get(allAgentConfig, "agents").Array() 38 | //protocolBridgeConfigs := gjson.Get(agentCfg[0].String(), "protocolServers").Array() 39 | if updateProtocolBridgePropertiesFile("./data/test_pba.xml", agentCfg[0].String()) { 40 | updatedXml, err := utils.ReadConfigurationDataFromFile("./data/test_pba.xml") 41 | if err == nil { 42 | templateData, err := utils.ReadConfigurationDataFromFile("./data/test_pba_template.xml") 43 | if err == nil { 44 | if len(updatedXml) == len(templateData) { 45 | if strings.EqualFold(strings.Trim(templateData, ""), strings.Trim(updatedXml, "")) { 46 | fmt.Println("Protocol Bridge Properties file updated successfully") 47 | } else { 48 | fmt.Println("Protocol Bridge Properties file not updated successfully") 49 | fmt.Printf("Original file:\n%s\n", templateData) 50 | fmt.Printf("Updated file:\n%s\n ", updatedXml) 51 | t.Fail() 52 | } 53 | } else { 54 | fmt.Printf("Length of Updated XML %d length of template %d\n", len(updatedXml), len(templateData)) 55 | fmt.Printf("Template file:\n%s\n Updated file\n%s\n", templateData, updatedXml) 56 | t.Fail() 57 | } 58 | } else { 59 | t.Fatal(err) 60 | } 61 | } else { 62 | t.Fatal(err) 63 | } 64 | } else { 65 | t.Fatal("Failed to update file") 66 | } 67 | } 68 | 69 | func TestUpdateBridgeParameters(t *testing.T) { 70 | 71 | } 72 | -------------------------------------------------------------------------------- /cmd/runagent/commandconfig_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2022, 2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "fmt" 20 | "testing" 21 | 22 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 23 | ) 24 | 25 | func TestValidateCommandAttributesValidProperties(t *testing.T) { 26 | allAgentConfig, e := utils.ReadConfigurationDataFromFile("./data/test_agcfg.json") 27 | if e != nil { 28 | t.Fatal(e) 29 | } 30 | validated := validateCommandAttributes(allAgentConfig) 31 | if validated != nil { 32 | fmt.Printf("Command queue manager attributes validation failed. %v", validated) 33 | t.Fail() 34 | } 35 | } 36 | 37 | func TestValidateCommandAttributesMissingQmgrName(t *testing.T) { 38 | agentConfig := "{\"waitTimeToStart\":20,\"commandQMgr\":{\"host\":\"10.254.16.17\", \"port\":1414,\"channel\":\"QS_SVRCONN\",\"additionalProperties\": {}}}" 39 | validated := validateCommandAttributes(agentConfig) 40 | if validated != nil { 41 | t.Log("Command queue manager attributes validation failed.") 42 | } else { 43 | t.Fail() 44 | } 45 | } 46 | 47 | func TestValidateCommandAttributesMissingQmgrHostName(t *testing.T) { 48 | agentConfig := "{\"waitTimeToStart\":20,\"commandQMgr\":{\"name\":\"SECUREQM\", \"port\":1414,\"channel\":\"QS_SVRCONN\",\"additionalProperties\": {}}}" 49 | validated := validateCommandAttributes(agentConfig) 50 | if validated != nil { 51 | t.Log("Command queue manager attributes validation failed.") 52 | } else { 53 | t.Fail() 54 | } 55 | } 56 | 57 | func TestValidateCommandAttributesMissingChannelName(t *testing.T) { 58 | agentConfig := "{\"waitTimeToStart\":20,\"commandQMgr\":{\"name\":\"SECUREQM\",\"host\":\"10.254.16.17\",\"port\":1414,\"additionalProperties\": {}}}" 59 | validated := validateCommandAttributes(agentConfig) 60 | if validated == nil { 61 | t.Log("Command queue manager attributes with missing channel name validation passed as expected.") 62 | } else { 63 | t.Fail() 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /cmd/runagent/configutils_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2022, 2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "fmt" 20 | "os" 21 | "strings" 22 | "testing" 23 | 24 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 25 | "github.com/tidwall/gjson" 26 | ) 27 | 28 | func TestUpdateAgentProperties(t *testing.T) { 29 | allAgentConfig, e := utils.ReadConfigurationDataFromFile("./data/test_agcfg.json") 30 | if e != nil { 31 | t.Fatal(e) 32 | } 33 | 34 | propFileName := "./data/agent.properties" 35 | singleAgentConfig := gjson.Get(allAgentConfig, "agents").Array()[0].String() 36 | err := UpdateProperties(propFileName, singleAgentConfig, "additionalProperties") 37 | if err == nil { 38 | updatedAgentPropFileContent, err := utils.ReadConfigurationDataFromFile(propFileName) 39 | if err == nil { 40 | result := gjson.Get(singleAgentConfig, "additionalProperties") 41 | result.ForEach(func(key, value gjson.Result) bool { 42 | searchToken := key.String() + "=" + value.String() 43 | if !strings.Contains(updatedAgentPropFileContent, searchToken) { 44 | t.Log("TestUpdateAgentProperties - failed: Contents don't match.") 45 | fmt.Printf("Updated agent properties: \n===\n%v\n===\n", updatedAgentPropFileContent) 46 | t.Fail() 47 | return false 48 | } 49 | return true // keep iterating 50 | }) 51 | t.Log("Test TestUpdateAgentProperties passed as expected") 52 | } else { 53 | t.Log("TestUpdateAgentProperties - failed: Failed to read updated agent properties file.") 54 | fmt.Printf("TestUpdateAgentProperties - %v\n", err) 55 | t.Fail() 56 | } 57 | } else { 58 | t.Log("TestUpdateAgentProperties - failed: Failed to agent properties file.") 59 | fmt.Printf("TestUpdateAgentProperties - %v\n", err) 60 | t.Fail() 61 | } 62 | } 63 | 64 | func TestCreateUserSandbox(t *testing.T) { 65 | userSandboxFile := "UserSandbox.xml" 66 | userSBoxErr := createUserSandbox(userSandboxFile) 67 | if userSBoxErr == nil { 68 | sandBoxContents, _ := utils.ReadConfigurationDataFromFile(userSandboxFile) 69 | if strings.Contains(sandBoxContents, DEFAULT_MOUNT_PATH_FOR_TRANSFERS) { 70 | t.Log("Success") 71 | } else { 72 | t.Log("Sandbox does not contain required settings") 73 | t.Fail() 74 | } 75 | } else { 76 | t.Log("Errored: " + userSBoxErr.Error()) 77 | t.Fail() 78 | } 79 | 80 | // Delete the UserSandBox.xml if it exists 81 | _, err := os.Lstat(userSandboxFile) 82 | if err == nil { 83 | os.Remove(userSandboxFile) 84 | } 85 | } 86 | 87 | func TestSetupCredentials(t *testing.T) { 88 | mqmftCredFile := "MQMFTCredentials.xml" 89 | var credentialsXmlToWrite string = "" + 90 | "" + 91 | " " + 92 | " " + 93 | " " + 94 | "" 95 | 96 | setupCredErr := setupCredentials(mqmftCredFile, credentialsXmlToWrite) 97 | if setupCredErr != nil { 98 | t.Log(setupCredErr.Error()) 99 | t.Fail() 100 | } else { 101 | readCredentials, err := utils.ReadConfigurationDataFromFile(mqmftCredFile) 102 | if err == nil { 103 | if strings.EqualFold(credentialsXmlToWrite, readCredentials) { 104 | t.Log("Credentials file updated successfully") 105 | t.Log(fmt.Sprintf("Template Credentials:\n%v\n", credentialsXmlToWrite)) 106 | t.Log(fmt.Sprintf("Credentials from file:\n%v\n", readCredentials)) 107 | } else { 108 | t.Log("Credentials file contents different.") 109 | t.Log(fmt.Sprintf("Template Credentials:\n%v\n", credentialsXmlToWrite)) 110 | t.Log(fmt.Sprintf("Credentials from file:\n%v\n", readCredentials)) 111 | t.Fail() 112 | } 113 | } else { 114 | t.Log("Error occurred reading credentials file. " + err.Error()) 115 | t.Fail() 116 | } 117 | } 118 | 119 | // Delete the UserSandBox.xml if it exists 120 | _, err := os.Lstat(mqmftCredFile) 121 | if err == nil { 122 | rErr := os.Remove(mqmftCredFile) 123 | if rErr != nil { 124 | t.Log(rErr.Error()) 125 | } 126 | } else { 127 | t.Log(err.Error()) 128 | t.Fail() 129 | } 130 | } 131 | 132 | func TestCreateKeyStore(t *testing.T) { 133 | certFilePath := "NonExistent.crt" 134 | keyStorePath := "key.p12" 135 | keyStorePwd := "StrongPassword" 136 | keyStoreDir := "data/tls" 137 | 138 | // Test for invalid certificate file path 139 | certNonExistentFileErr := CreateKeyStore(keyStoreDir, keyStorePath, certFilePath, keyStorePwd) 140 | if certNonExistentFileErr != nil { 141 | t.Log(certNonExistentFileErr.Error()) 142 | } else { 143 | t.Fail() 144 | } 145 | 146 | err := os.MkdirAll("data/tls", 0700) 147 | if err != nil { 148 | t.Log(err.Error()) 149 | t.Fail() 150 | } 151 | certFilePath = "./data/certificate.crt" 152 | // Test with a valid certificate 153 | certExistErr := CreateKeyStore(keyStoreDir, keyStorePath, certFilePath, keyStorePwd) 154 | if certExistErr != nil { 155 | t.Log(certExistErr.Error()) 156 | t.Fail() 157 | } else { 158 | t.Log("Certificate added") 159 | } 160 | _, err = os.Lstat(keyStorePath) 161 | if err == nil { 162 | rErr := os.RemoveAll(keyStorePath) 163 | if rErr != nil { 164 | t.Log(rErr.Error()) 165 | } 166 | } else { 167 | t.Log(err.Error()) 168 | // Just log error if we are unable to delete keystore 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /cmd/runagent/constants.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2020, 2024 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | /** 19 | * This file contains the list of constants used by the program 20 | */ 21 | // Source path of custom PBA credentials exit to copy from 22 | const PBA_CUSTOM_CRED_EXIT_SRC_PATH = "/customexits" 23 | 24 | // Name of the PBA custom credentials exit 25 | const PBA_CUSTOM_CRED_EXIT_NAME = "com.ibm.wmq.bridgecredentialexit.jar" 26 | 27 | // Complete path of PBA custom credentials exit 28 | const PBA_CUSTOM_CRED_EXIT = "/customexits/mqft/pbaexit/com.ibm.wmq.bridgecredentialexit.jar" 29 | 30 | // Third party jar used for reading JSON formatted data 31 | const PBA_CUSTOM_CRED_DEPEND_LIB_NAME = "org.json.jar" 32 | 33 | // Source path of third party JSON jar 34 | const PBA_CUSTOM_CRED_DEPEND_LIB = "/customexits/mqft/pbaexit/org.json.jar" 35 | 36 | // Path where files will be written to or read from. If a external storage is mounted 37 | // to this path, then files will be written/read from the external storage otherwise 38 | // path will be local to container and will get removed when container ends 39 | const DEFAULT_MOUNT_PATH_FOR_TRANSFERS = "/mountpath/**" 40 | 41 | // Source and Destination path for transfers 42 | const MOUNT_PATH_TRANSFERS = "/mountpath" 43 | 44 | // Controls the amount of diagnostic logs displayed on the console. 45 | // Minimal diagnostic information. This is the default log level 46 | const LOG_LEVEL_INFO = 1 47 | 48 | // Detailed information 49 | const LOG_LEVEL_VERBOSE = 2 50 | 51 | // Supported agent types 52 | const AGENT_TYPE_STANDARD = "STANDARD" 53 | const AGENT_TYPE_BRIDGE = "BRIDGE" 54 | 55 | // Supported log levels 56 | const LOG_LEVEL_INFO_TXT = "info" 57 | const LOG_LEVEL_VERBOSE_TXT = "verbose" 58 | 59 | // log file types 60 | const LOG_TYPE_TRANSFER = "tlog" 61 | const LOG_TYPE_CAPTURE = "capure" 62 | const LOG_TYPE_CONSOLE = "console" 63 | 64 | // Server type 65 | const LOG_SERVER_TYPE_DNA = "logDNA" 66 | const LOG_SERVER_TYPE_ELK = "elk" 67 | const LOG_SERVER_TYPE_DNA_NUM = 1 68 | const LOG_SERVER_TYPE_ELK_NUM = 2 69 | 70 | const KEY_TYPE = "type" 71 | const KEY_URL_DNA = "logDNA.url" 72 | const KEY_INJESTION_DNA = "logDNA.injestionKey" 73 | const KEY_URL_ELK = "elk.url" 74 | 75 | const DIR_AGENT_LOGS = "/mqft/logs/" 76 | const DIR_AGENTS = "/agents/" 77 | 78 | // License file path 79 | const DIR_LICENSE_FILES = "/opt/mqm/mqft/licences/" 80 | 81 | // Path used for storing keystores and truststores 82 | const KEYSTORES_PATH = "/run/keystores" 83 | 84 | // Coordination queue manager keystore file 85 | const COORD_QM_KEYSTORE = "coordkeystore.p12" 86 | const COORD_QM_TRUSTSTORE = "coordtruststore.p12" 87 | 88 | // Command queue manager keystore file 89 | const CMD_QM_KEYSTORE = "cmdkeystore.p12" 90 | const CMD_QM_TRUSTSTORE = "cmdtruststore.p12" 91 | 92 | // Agent queue manager keystore and trust file 93 | const AGENT_QM_KEYSTORE = "agentkeystore.p12" 94 | const AGENT_QM_TRUSTSTORE = "agenttruststore.p12" 95 | 96 | const coordinationQMCertPath = "/etc/mqmft/pki/coordination" 97 | const commandQMCertPath = "/etc/mqmft/pki/command" 98 | const agentQMCertPath = "/etc/mqmft/pki/agent" 99 | 100 | // Blank 101 | const TEXT_BLANK = "" 102 | const TEXT_YES = "yes" 103 | const TEXT_NO = "no" 104 | 105 | // Credential file names 106 | const MFT_CMD_CRED_SLASH = "/cmdcredentials.xml" 107 | const MFT_CORD_CRED_SLASH = "/coordcredentials.xml" 108 | const MFT_AGENT_CRED_SLASH = "/agentcredentials.xml" 109 | const MFT_USER_SANDBOX_SLASH = "/UserSandboxes.xml" 110 | 111 | // MFT config path 112 | const MFT_CONFIG_PATH_SUFFIX = "/mqft/config/" 113 | 114 | // MFT log path 115 | const MFT_LOG_PATH_SUFFIX = "/mqft/logs" 116 | 117 | // Agents 118 | const MFT_AGENTS_SLASH = "/agents/" 119 | const MFT_EXITS_SLASH = "/exits/" 120 | 121 | // command properties 122 | const MFT_CMD_PROPS_SLASH = "/command.properties" 123 | const MFT_CORD_PROPS_SLASH = "/coordination.properties" 124 | const MFT_AGENT_PROPS_SLASH = "/agent.properties" 125 | const MFT_PBA_PROPS_SLASH = "/ProtocolBridgeProperties.xml" 126 | 127 | // Error codes returned by runagent process 128 | const MFT_CONT_SUCCESS_CODE_0 = 0 129 | const MFT_CONT_ERR_CODE_1 = 1 130 | const MFT_CONT_ERR_CODE_2 = 2 131 | const MFT_CONT_ERR_CODE_3 = 3 132 | const MFT_CONT_ERR_CODE_4 = 4 133 | const MFT_CONT_ERR_CODE_5 = 5 134 | const MFT_CONT_ERR_CODE_6 = 6 135 | const MFT_CONT_ERR_CODE_7 = 7 136 | const MFT_CONT_ERR_CODE_8 = 8 137 | const MFT_CONT_ERR_CODE_9 = 9 138 | const MFT_CONT_ERR_CODE_10 = 10 139 | const MFT_CONT_ERR_CODE_11 = 11 140 | const MFT_CONT_ERR_CODE_12 = 12 141 | const MFT_CONT_ERR_CODE_13 = 13 142 | const MFT_CONT_ERR_CODE_14 = 14 143 | const MFT_CONT_ERR_CODE_15 = 15 144 | const MFT_CONT_ERR_CODE_16 = 16 145 | const MFT_CONT_ERR_CODE_17 = 17 146 | const MFT_CONT_ERR_CODE_18 = 18 147 | const MFT_CONT_ERR_CODE_19 = 19 148 | const MFT_CONT_ERR_CODE_20 = 20 149 | const MFT_CONT_ERR_CODE_21 = 21 150 | const MFT_CONT_ERR_CODE_22 = 22 151 | const MFT_CONT_ERR_CODE_23 = 23 152 | const MFT_CONT_ERR_CODE_24 = 24 153 | 154 | // Data types used by ProtocolBridgeProperties.xml 155 | const DATA_TYPE_STRING = 1 156 | const DATA_TYPE_INT = 2 157 | const DATA_TYPE_BOOL = 3 158 | -------------------------------------------------------------------------------- /cmd/runagent/coordinationconfig_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2022, 2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "fmt" 20 | "testing" 21 | 22 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 23 | ) 24 | 25 | func TestValidateCoordinationAttributesValidProperties(t *testing.T) { 26 | allAgentConfig, e := utils.ReadConfigurationDataFromFile("./data/test_agcfg.json") 27 | if e != nil { 28 | t.Fatal(e) 29 | } 30 | validated := validateCommandAttributes(allAgentConfig) 31 | if validated != nil { 32 | fmt.Printf("Command queue manager attributes validation failed. %v", validated) 33 | t.Fail() 34 | } 35 | } 36 | 37 | func TestValidateCoordinationAttributesMissingQmgrName(t *testing.T) { 38 | agentConfig := "{\"waitTimeToStart\":20,\"coordinationQMgr\":{\"host\":\"10.254.16.17\", \"port\":1414,\"channel\":\"QS_SVRCONN\",\"additionalProperties\": {}}}" 39 | 40 | validated := validateCoordinationAttributes(agentConfig) 41 | if validated != nil { 42 | t.Log("Coordination queue manager attributes validation failed as expected.") 43 | } else { 44 | t.Fail() 45 | } 46 | } 47 | 48 | func TestValidateCoordinationAttributesMissingQmgrHostName(t *testing.T) { 49 | agentConfig := "{\"waitTimeToStart\":20,\"coordinationQMgr\":{\"name\":\"SECUREQM\", \"port\":1414,\"channel\":\"QS_SVRCONN\",\"additionalProperties\": {}}}" 50 | 51 | validated := validateCoordinationAttributes(agentConfig) 52 | if validated != nil { 53 | t.Log("Coordination queue manager attributes validation failed as expected.") 54 | } else { 55 | t.Fail() 56 | } 57 | } 58 | func TestValidateCoordinationAttributesMissingChannelName(t *testing.T) { 59 | agentConfig := "{\"waitTimeToStart\":20,\"coordinationQMgr\":{\"name\":\"SECUREQM\",\"host\":\"10.254.16.17\", \"port\":1414,\"additionalProperties\": {}}}" 60 | 61 | validated := validateCoordinationAttributes(agentConfig) 62 | if validated == nil { 63 | t.Log("Coordination queue manager attributes with missing channel name validation passed as expected.") 64 | } else { 65 | t.Fail() 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /cmd/runagent/data/agent.properties: -------------------------------------------------------------------------------- 1 | agentQMgr=QUICKSTART 2 | agentQMgrPort=1414 3 | agentDesc= 4 | agentQMgrHost="10.254.16.19" 5 | agentQMgrChannel=QS_SVRCONN 6 | agentName=BRIDGE 7 | 8 | logCapture=true 9 | enableQueueInputOutput=false 10 | -------------------------------------------------------------------------------- /cmd/runagent/data/certificate.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3TYQlgjOSbahqr5mnGEF 3 | qVixN/SLzdSVNOlv+pwmGa3dQ3/Gy7G0dtI5TVQZvSbSylntDN7+h0Q5MCLQpD+E 4 | u3KrEnd0slIVUuFLRVeJCb9nFtE2WH/ZpB2Y4sSJf8a3mzxw79r75GBHNB7XV9mj 5 | Xxv7ooX6Z69nzeLDQZx55XexAf9ijfmDyK2XO8eGOZ4/dqnxl1cGta3ReoUSgsCi 6 | yC102X+Gt/8b19u/gDONUpPXhhPs+NKPZkDUW3A43v+2qfggWnREdeV8bJwQW01k 7 | WIicqrE1IhFn5CCXnDkHIWW9ZowLWhTPQftMN2Uk3+NSOPg5Q7ju9rsKayOYsjeK 8 | tQIDAQAB 9 | -----END PUBLIC KEY----- 10 | -------------------------------------------------------------------------------- /cmd/runagent/data/ocpagcfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "waitTimeToStart":20, 3 | "coordinationQMgr":{ 4 | "name":"SECUREQM", 5 | "host":"10.254.12.8", 6 | "port":1414, 7 | "channel":"QS_SVRCONN", 8 | "additionalProperties":{} 9 | }, 10 | "commandQMgr":{ 11 | "name":"SECUREQM", 12 | "host":"10.254.12.8", 13 | "port":1414, 14 | "channel":"QS_SVRCONN", 15 | "additionalProperties": {} 16 | }, 17 | "agents":[ 18 | { 19 | "name":"SRCSTD", 20 | "deleteOnTermination":true, 21 | "type":"STANDARD", 22 | "qmgrName":"AGENTQM", 23 | "qmgrHost":"10.254.12.41", 24 | "qmgrPort":1414, 25 | "qmgrChannel":"QS_SVRCONN", 26 | "additionalProperties":{ 27 | "enableQueueInputOutput":true, 28 | "trace":"all", 29 | "logCapture":"true" 30 | } 31 | },{ 32 | "name":"BRIDGE", 33 | "type":"BRIDGE", 34 | "deleteOnTermination":true, 35 | "cleanOnStart":"all", 36 | "qmgrName":"AGENTQM", 37 | "qmgrHost":"10.254.12.41", 38 | "qmgrPort":1414, 39 | "qmgrChannel":"QS_SVRCONN", 40 | "defaultServer" : "myFTPserver", 41 | "maxActiveDestinationTransfers": 25, 42 | "failTransferWhenCapacityReached":true, 43 | "additionalProperties":{ 44 | "logCapture":true, 45 | "enableQueueInputOutput":false, 46 | "protocolBridgeCredentialConfiguration":"/mnt/credentials/ProtocolBridgeCredentials.prop" 47 | }, 48 | "protocolServers": [{ 49 | "type":"SFTP", 50 | "name":"sftpserver", 51 | "host":"10.17.97.31", 52 | "platform":"UNIX", 53 | "locale":"en-GB", 54 | "listFormat":"UNIX", 55 | "limitedWrite":false, 56 | "fileEncoding":"UTF8", 57 | "controlEncoding":"UTF8" 58 | },{ 59 | "name":"myFTPserver", 60 | "type":"FTP", 61 | "host":"windows.hursley.ibm.com", 62 | "port":1234, 63 | "platform":"windows", 64 | "timeZone":"Europe/London", 65 | "locale":"en_GB", 66 | "fileEncoding":"UTF-8", 67 | "listFormat":"unix", 68 | "listFileRecentDateFormat":"unix", 69 | "listFileOldDateFormat":"unix", 70 | "limitedWrite":false, 71 | "maxListFileNames":100, 72 | "maxListDirectoryLevels":999999999, 73 | "maxSessions":60, 74 | "socketTimeout":30, 75 | "maxActiveDestinationTransfers":25, 76 | "passiveMode":"true" 77 | }, { 78 | "name":"mySFTPserver", 79 | "type":"SFTP", 80 | "host":"windows.hursley.ibm.com", 81 | "platform":"windows", 82 | "timeZone":"Europe/London", 83 | "locale":"en_GB", 84 | "fileEncoding":"UTF-8", 85 | "limitedWrite":false, 86 | "connectionTimeout":60 87 | }] 88 | }] 89 | } 90 | -------------------------------------------------------------------------------- /cmd/runagent/data/template_agent.properties: -------------------------------------------------------------------------------- 1 | agentQMgr=QUICKSTART 2 | agentQMgrPort=1414 3 | agentDesc= 4 | agentQMgrHost="10.254.16.19" 5 | agentQMgrChannel=QS_SVRCONN 6 | agentName=BRIDGE 7 | 8 | logCapture=true 9 | enableQueueInputOutput=false 10 | -------------------------------------------------------------------------------- /cmd/runagent/data/test_agcfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "waitTimeToStart":20, 3 | "coordinationQMgr":{ 4 | "name":"SECUREQM", 5 | "host":"10.254.16.17", 6 | "port":1414, 7 | "channel":"QS_SVRCONN", 8 | "additionalProperties":{ 9 | 10 | } 11 | }, 12 | "commandQMgr":{ 13 | "name":"SECUREQM", 14 | "host":"10.254.16.17", 15 | "port":1414, 16 | "channel":"QS_SVRCONN", 17 | "additionalProperties": { 18 | } 19 | }, 20 | "agents":[{ 21 | "name":"BRIDGE", 22 | "type":"BRIDGE", 23 | "deleteOnTermination":"true", 24 | "cleanOnStart":"all", 25 | "qmgrName":"QUICKSTART", 26 | "qmgrHost":"10.254.16.19", 27 | "qmgrPort":1414, 28 | "qmgrChannel":"QS_SVRCONN", 29 | "defaultServer" : "myFTPserver", 30 | "maxActiveDestinationTransfers": 25, 31 | "failTransferWhenCapacityReached":true, 32 | "protocolServers": [{ 33 | "type":"SFTP", 34 | "name":"newsftpserver", 35 | "host":"10.17.68.52", 36 | "platform":"UNIX", 37 | "locale":"en-GB", 38 | "listFormat":"UNIX", 39 | "limitedWrite":false, 40 | "fileEncoding":"UTF8", 41 | "controlEncoding":"UTF8" 42 | },{ 43 | "name":"myFTPserver", 44 | "type":"FTP", 45 | "host":"windows.hursley.ibm.com", 46 | "port":1234, 47 | "platform":"windows", 48 | "timeZone":"Europe/London", 49 | "locale":"en_GB", 50 | "fileEncoding":"UTF-8", 51 | "listFormat":"unix", 52 | "listFileRecentDateFormat":"unix", 53 | "listFileOldDateFormat" :"unix", 54 | "monthShortNames":"", 55 | "limitedWrite":false, 56 | "maxListFileNames": 100, 57 | "maxListDirectoryLevels": 999999999, 58 | "maxSessions": 60, 59 | "socketTimeout" : 30, 60 | "maxActiveDestinationTransfers" : 25, 61 | "passiveMode":true, 62 | "failTransferWhenCapacityReached": true 63 | }, { 64 | "name":"mySFTPserver", 65 | "type":"SFTP", 66 | "host":"windows.hursley.ibm.com", 67 | "platform":"windows", 68 | "timeZone":"Europe/London", 69 | "locale":"en_GB", 70 | "fileEncoding":"UTF-8", 71 | "limitedWrite":"false", 72 | "connectionTimeout":60 73 | }], 74 | "additionalProperties":{ 75 | "logCapture":true, 76 | "enableQueueInputOutput":false 77 | } 78 | }] 79 | } -------------------------------------------------------------------------------- /cmd/runagent/data/test_pba.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /cmd/runagent/data/test_pba_template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /cmd/runagent/envvars.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2020, 2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | /************************************************************************ 19 | * Environment variables used by image * 20 | ************************************************************************/ 21 | // Level of diagnostic information logged. If this variable is 22 | // not specified, LOG_LEVEL_INFO will be the default log level. 23 | const MFT_LOG_LEVEL = "MFT_LOG_LEVEL" 24 | 25 | // Name of the agent to be run by this image. This is a required 26 | // parameter. 27 | const MFT_AGENT_NAME = "MFT_AGENT_NAME" 28 | 29 | // Name of the input file used for configuring an agent 30 | // The contents of the input fill must be in JSON format 31 | const MFT_AGENT_CONFIG_FILE = "MFT_AGENT_CONFIG_FILE" 32 | 33 | // Envirornment variable pointing MFT Configuration and log data. 34 | // If this variable is not specified, /mnt/mftdata will be the 35 | // default path used for creating agent configuration and log files. 36 | const BFG_DATA = "BFG_DATA" 37 | 38 | // An agent might take some time to start after fteStartAgent command 39 | // is issued. This is the time, in seconds, the containeror will wait 40 | // for an agent to start. If an agent does not within the specified 41 | // wait time, the container will end. 42 | const MFT_AGENT_START_WAIT_TIME = "MFT_AGENT_START_WAIT_TIME" 43 | 44 | // Enable agent tracing. "Yes" and "No" are the valid values with 45 | // "No" being default 46 | const MFT_AGENT_ENABLE_TRACE = "MFT_AGENT_ENABLE_TRACE" 47 | 48 | // Display JSON formatted transfer logs on the console. "Yes" and "No" 49 | // are the supported values with "No" being the default. 50 | const MFT_AGENT_DISPLAY_CAPTURE_LOG = "MFT_AGENT_DISPLAY_CAPTURE_LOG" 51 | 52 | // Enable tracing of MFT commands. "Yes" and "No" are the supported values 53 | // with "No" being the default. 54 | const MFT_TRACE_COMMANDS = "MFT_TRACE_COMMANDS" 55 | 56 | // Environment variable pointing to path where files will be read from or written to 57 | const MFT_MOUNT_PATH = "MFT_MOUNT_PATH" 58 | 59 | // BFG_JVM_PROPERTIES 60 | const MFT_BFG_JVM_PROPERTIES = "BFG_JVM_PROPERTIES" 61 | 62 | // Configuration file containing details of logDNA or similar server 63 | const MFT_AGENT_TRANSFER_LOG_PUBLISH_CONFIG_FILE = "MFT_TLOG_PUBLISH_INFO" 64 | 65 | // Coordination queue manager cipherspec 66 | const MFT_COORD_QMGR_CIPHER = "MFT_COORD_QMGR_CIPHER" 67 | 68 | // Command queue manager cipherspec 69 | const MFT_CMD_QMGR_CIPHER = "MFT_CMD_QMGR_CIPHER" 70 | 71 | // Agent queue manager cipherspec 72 | const MFT_AGENT_QMGR_CIPHER = "MFT_AGENT_QMGR_CIPHER" 73 | -------------------------------------------------------------------------------- /cmd/runagent/license.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2020, 2021 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "errors" 20 | "fmt" 21 | "io/ioutil" 22 | "os" 23 | "path/filepath" 24 | "strings" 25 | 26 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 27 | ) 28 | 29 | // resolveLicenseFile returns the file name of the MQ MFT license file, taking into 30 | // account the language set by the LANG environment variable 31 | func resolveLicenseFile() string { 32 | lang, ok := os.LookupEnv("LANG") 33 | if !ok { 34 | return "Lic_en.txt" 35 | } 36 | switch { 37 | case strings.HasPrefix(lang, "zh_TW"): 38 | return "Lic_zh_tw.txt" 39 | case strings.HasPrefix(lang, "zh"): 40 | return "Lic_zh.txt" 41 | // Differentiate Czech (cs) and Kashubian (csb) 42 | case strings.HasPrefix(lang, "cs") && !strings.HasPrefix(lang, "csb"): 43 | return "Lic_cs.txt" 44 | case strings.HasPrefix(lang, "fr"): 45 | return "Lic_fr.txt" 46 | case strings.HasPrefix(lang, "de"): 47 | return "Lic_de.txt" 48 | case strings.HasPrefix(lang, "el"): 49 | return "Lic_el.txt" 50 | case strings.HasPrefix(lang, "id"): 51 | return "Lic_id.txt" 52 | case strings.HasPrefix(lang, "it"): 53 | return "Lic_it.txt" 54 | case strings.HasPrefix(lang, "ja"): 55 | return "Lic_ja.txt" 56 | // Differentiate Korean (ko) from Konkani (kok) 57 | case strings.HasPrefix(lang, "ko") && !strings.HasPrefix(lang, "kok"): 58 | return "Lic_ko.txt" 59 | case strings.HasPrefix(lang, "lt"): 60 | return "Lic_lt.txt" 61 | case strings.HasPrefix(lang, "pl"): 62 | return "Lic_pl.txt" 63 | case strings.HasPrefix(lang, "pt"): 64 | return "Lic_pt.txt" 65 | case strings.HasPrefix(lang, "ru"): 66 | return "Lic_ru.txt" 67 | case strings.HasPrefix(lang, "sl"): 68 | return "Lic_sl.txt" 69 | case strings.HasPrefix(lang, "es"): 70 | return "Lic_es.txt" 71 | case strings.HasPrefix(lang, "tr"): 72 | return "Lic_tr.txt" 73 | } 74 | return "Lic_en.txt" 75 | } 76 | 77 | func checkLicense() (bool, error) { 78 | lic, ok := os.LookupEnv("LICENSE") 79 | switch { 80 | case ok && lic == "accept": 81 | return true, nil 82 | case ok && lic == "view": 83 | // Display MFT Redistributable package license file 84 | file := filepath.Join(DIR_LICENSE_FILES, resolveLicenseFile()) 85 | // #nosec G304 86 | buf, err := ioutil.ReadFile(file) 87 | if err != nil { 88 | fmt.Println(err) 89 | return false, err 90 | } 91 | fmt.Println(string(buf)) 92 | return false, nil 93 | } 94 | return false, errors.New(utils.MFT_CONT_LICENES_NOT_ACCESSPTED_0004) 95 | } 96 | -------------------------------------------------------------------------------- /cmd/runagent/license_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2020 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE_2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "os" 20 | "testing" 21 | ) 22 | 23 | var licenseTests = []struct { 24 | in string 25 | out string 26 | }{ 27 | {"en_US.UTF_8", "Lic_en.txt"}, 28 | {"en_US.ISO-8859-15", "Lic_en.txt"}, 29 | {"es_GB", "Lic_es.txt"}, 30 | {"el_ES.UTF_8", "Lic_el.txt"}, 31 | // Cover a wide variety of valid values 32 | {"af", "Lic_en.txt"}, 33 | {"af_ZA", "Lic_en.txt"}, 34 | {"ar", "Lic_en.txt"}, 35 | {"ar_AE", "Lic_en.txt"}, 36 | {"ar_BH", "Lic_en.txt"}, 37 | {"ar_DZ", "Lic_en.txt"}, 38 | {"ar_EG", "Lic_en.txt"}, 39 | {"ar_IQ", "Lic_en.txt"}, 40 | {"ar_JO", "Lic_en.txt"}, 41 | {"ar_KW", "Lic_en.txt"}, 42 | {"ar_LB", "Lic_en.txt"}, 43 | {"ar_LY", "Lic_en.txt"}, 44 | {"ar_MA", "Lic_en.txt"}, 45 | {"ar_OM", "Lic_en.txt"}, 46 | {"ar_QA", "Lic_en.txt"}, 47 | {"ar_SA", "Lic_en.txt"}, 48 | {"ar_SY", "Lic_en.txt"}, 49 | {"ar_TN", "Lic_en.txt"}, 50 | {"ar_YE", "Lic_en.txt"}, 51 | {"az", "Lic_en.txt"}, 52 | {"az_AZ", "Lic_en.txt"}, 53 | {"az_AZ", "Lic_en.txt"}, 54 | {"be", "Lic_en.txt"}, 55 | {"be_BY", "Lic_en.txt"}, 56 | {"bg", "Lic_en.txt"}, 57 | {"bg_BG", "Lic_en.txt"}, 58 | {"bs_BA", "Lic_en.txt"}, 59 | {"ca", "Lic_en.txt"}, 60 | {"ca_ES", "Lic_en.txt"}, 61 | {"cs", "Lic_cs.txt"}, 62 | {"cs_CZ", "Lic_cs.txt"}, 63 | {"csb_PL", "Lic_en.txt"}, 64 | {"cy", "Lic_en.txt"}, 65 | {"cy_GB", "Lic_en.txt"}, 66 | {"da", "Lic_en.txt"}, 67 | {"da_DK", "Lic_en.txt"}, 68 | {"de", "Lic_de.txt"}, 69 | {"de_AT", "Lic_de.txt"}, 70 | {"de_CH", "Lic_de.txt"}, 71 | {"de_DE", "Lic_de.txt"}, 72 | {"de_LI", "Lic_de.txt"}, 73 | {"de_LU", "Lic_de.txt"}, 74 | {"dv", "Lic_en.txt"}, 75 | {"dv_MV", "Lic_en.txt"}, 76 | {"el", "Lic_el.txt"}, 77 | {"el_GR", "Lic_el.txt"}, 78 | {"en", "Lic_en.txt"}, 79 | {"en_AU", "Lic_en.txt"}, 80 | {"en_BZ", "Lic_en.txt"}, 81 | {"en_CA", "Lic_en.txt"}, 82 | {"en_CB", "Lic_en.txt"}, 83 | {"en_GB", "Lic_en.txt"}, 84 | {"en_IE", "Lic_en.txt"}, 85 | {"en_JM", "Lic_en.txt"}, 86 | {"en_NZ", "Lic_en.txt"}, 87 | {"en_PH", "Lic_en.txt"}, 88 | {"en_TT", "Lic_en.txt"}, 89 | {"en_US", "Lic_en.txt"}, 90 | {"en_ZA", "Lic_en.txt"}, 91 | {"en_ZW", "Lic_en.txt"}, 92 | {"eo", "Lic_en.txt"}, 93 | {"es", "Lic_es.txt"}, 94 | {"es_AR", "Lic_es.txt"}, 95 | {"es_BO", "Lic_es.txt"}, 96 | {"es_CL", "Lic_es.txt"}, 97 | {"es_CO", "Lic_es.txt"}, 98 | {"es_CR", "Lic_es.txt"}, 99 | {"es_DO", "Lic_es.txt"}, 100 | {"es_EC", "Lic_es.txt"}, 101 | {"es_ES", "Lic_es.txt"}, 102 | {"es_ES", "Lic_es.txt"}, 103 | {"es_GT", "Lic_es.txt"}, 104 | {"es_HN", "Lic_es.txt"}, 105 | {"es_MX", "Lic_es.txt"}, 106 | {"es_NI", "Lic_es.txt"}, 107 | {"es_PA", "Lic_es.txt"}, 108 | {"es_PE", "Lic_es.txt"}, 109 | {"es_PR", "Lic_es.txt"}, 110 | {"es_PY", "Lic_es.txt"}, 111 | {"es_SV", "Lic_es.txt"}, 112 | {"es_UY", "Lic_es.txt"}, 113 | {"es_VE", "Lic_es.txt"}, 114 | {"et", "Lic_en.txt"}, 115 | {"et_EE", "Lic_en.txt"}, 116 | {"eu", "Lic_en.txt"}, 117 | {"eu_ES", "Lic_en.txt"}, 118 | {"fa", "Lic_en.txt"}, 119 | {"fa_IR", "Lic_en.txt"}, 120 | {"fi", "Lic_en.txt"}, 121 | {"fi_FI", "Lic_en.txt"}, 122 | {"fo", "Lic_en.txt"}, 123 | {"fo_FO", "Lic_en.txt"}, 124 | {"fr", "Lic_fr.txt"}, 125 | {"fr_BE", "Lic_fr.txt"}, 126 | {"fr_CA", "Lic_fr.txt"}, 127 | {"fr_CH", "Lic_fr.txt"}, 128 | {"fr_FR", "Lic_fr.txt"}, 129 | {"fr_LU", "Lic_fr.txt"}, 130 | {"fr_MC", "Lic_fr.txt"}, 131 | {"gl", "Lic_en.txt"}, 132 | {"gl_ES", "Lic_en.txt"}, 133 | {"gu", "Lic_en.txt"}, 134 | {"gu_IN", "Lic_en.txt"}, 135 | {"he", "Lic_en.txt"}, 136 | {"he_IL", "Lic_en.txt"}, 137 | {"hi", "Lic_en.txt"}, 138 | {"hi_IN", "Lic_en.txt"}, 139 | {"hr", "Lic_en.txt"}, 140 | {"hr_BA", "Lic_en.txt"}, 141 | {"hr_HR", "Lic_en.txt"}, 142 | {"hu", "Lic_en.txt"}, 143 | {"hu_HU", "Lic_en.txt"}, 144 | {"hy", "Lic_en.txt"}, 145 | {"hy_AM", "Lic_en.txt"}, 146 | {"id", "Lic_id.txt"}, 147 | {"id_ID", "Lic_id.txt"}, 148 | {"is", "Lic_en.txt"}, 149 | {"is_IS", "Lic_en.txt"}, 150 | {"it", "Lic_it.txt"}, 151 | {"it_CH", "Lic_it.txt"}, 152 | {"it_IT", "Lic_it.txt"}, 153 | {"ja", "Lic_ja.txt"}, 154 | {"ja_JP", "Lic_ja.txt"}, 155 | {"ka", "Lic_en.txt"}, 156 | {"ka_GE", "Lic_en.txt"}, 157 | {"kk", "Lic_en.txt"}, 158 | {"kk_KZ", "Lic_en.txt"}, 159 | {"kn", "Lic_en.txt"}, 160 | {"kn_IN", "Lic_en.txt"}, 161 | {"ko", "Lic_ko.txt"}, 162 | {"ko_KR", "Lic_ko.txt"}, 163 | {"kok", "Lic_en.txt"}, 164 | {"kok_IN", "Lic_en.txt"}, 165 | {"ky", "Lic_en.txt"}, 166 | {"ky_KG", "Lic_en.txt"}, 167 | {"lt", "Lic_lt.txt"}, 168 | {"lt_LT", "Lic_lt.txt"}, 169 | {"lv", "Lic_en.txt"}, 170 | {"lv_LV", "Lic_en.txt"}, 171 | {"mi", "Lic_en.txt"}, 172 | {"mi_NZ", "Lic_en.txt"}, 173 | {"mk", "Lic_en.txt"}, 174 | {"mk_MK", "Lic_en.txt"}, 175 | {"mn", "Lic_en.txt"}, 176 | {"mn_MN", "Lic_en.txt"}, 177 | {"mr", "Lic_en.txt"}, 178 | {"mr_IN", "Lic_en.txt"}, 179 | {"ms", "Lic_en.txt"}, 180 | {"ms_BN", "Lic_en.txt"}, 181 | {"ms_MY", "Lic_en.txt"}, 182 | {"mt", "Lic_en.txt"}, 183 | {"mt_MT", "Lic_en.txt"}, 184 | {"nb", "Lic_en.txt"}, 185 | {"nb_NO", "Lic_en.txt"}, 186 | {"nl", "Lic_en.txt"}, 187 | {"nl_BE", "Lic_en.txt"}, 188 | {"nl_NL", "Lic_en.txt"}, 189 | {"nn_NO", "Lic_en.txt"}, 190 | {"ns", "Lic_en.txt"}, 191 | {"ns_ZA", "Lic_en.txt"}, 192 | {"pa", "Lic_en.txt"}, 193 | {"pa_IN", "Lic_en.txt"}, 194 | {"pl", "Lic_pl.txt"}, 195 | {"pl_PL", "Lic_pl.txt"}, 196 | {"ps", "Lic_en.txt"}, 197 | {"ps_AR", "Lic_en.txt"}, 198 | {"pt", "Lic_pt.txt"}, 199 | {"pt_BR", "Lic_pt.txt"}, 200 | {"pt_PT", "Lic_pt.txt"}, 201 | {"qu", "Lic_en.txt"}, 202 | {"qu_BO", "Lic_en.txt"}, 203 | {"qu_EC", "Lic_en.txt"}, 204 | {"qu_PE", "Lic_en.txt"}, 205 | {"ro", "Lic_en.txt"}, 206 | {"ro_RO", "Lic_en.txt"}, 207 | {"ru", "Lic_ru.txt"}, 208 | {"ru_RU", "Lic_ru.txt"}, 209 | {"sa", "Lic_en.txt"}, 210 | {"sa_IN", "Lic_en.txt"}, 211 | {"se", "Lic_en.txt"}, 212 | {"se_FI", "Lic_en.txt"}, 213 | {"se_FI", "Lic_en.txt"}, 214 | {"se_FI", "Lic_en.txt"}, 215 | {"se_NO", "Lic_en.txt"}, 216 | {"se_NO", "Lic_en.txt"}, 217 | {"se_NO", "Lic_en.txt"}, 218 | {"se_SE", "Lic_en.txt"}, 219 | {"se_SE", "Lic_en.txt"}, 220 | {"se_SE", "Lic_en.txt"}, 221 | {"sk", "Lic_en.txt"}, 222 | {"sk_SK", "Lic_en.txt"}, 223 | {"sl", "Lic_sl.txt"}, 224 | {"sl_SI", "Lic_sl.txt"}, 225 | {"sq", "Lic_en.txt"}, 226 | {"sq_AL", "Lic_en.txt"}, 227 | {"sr_BA", "Lic_en.txt"}, 228 | {"sr_BA", "Lic_en.txt"}, 229 | {"sr_SP", "Lic_en.txt"}, 230 | {"sr_SP", "Lic_en.txt"}, 231 | {"sv", "Lic_en.txt"}, 232 | {"sv_FI", "Lic_en.txt"}, 233 | {"sv_SE", "Lic_en.txt"}, 234 | {"sw", "Lic_en.txt"}, 235 | {"sw_KE", "Lic_en.txt"}, 236 | {"syr", "Lic_en.txt"}, 237 | {"syr_SY", "Lic_en.txt"}, 238 | {"ta", "Lic_en.txt"}, 239 | {"ta_IN", "Lic_en.txt"}, 240 | {"te", "Lic_en.txt"}, 241 | {"te_IN", "Lic_en.txt"}, 242 | {"th", "Lic_en.txt"}, 243 | {"th_TH", "Lic_en.txt"}, 244 | {"tl", "Lic_en.txt"}, 245 | {"tl_PH", "Lic_en.txt"}, 246 | {"tn", "Lic_en.txt"}, 247 | {"tn_ZA", "Lic_en.txt"}, 248 | {"tr", "Lic_tr.txt"}, 249 | {"tr_TR", "Lic_tr.txt"}, 250 | {"tt", "Lic_en.txt"}, 251 | {"tt_RU", "Lic_en.txt"}, 252 | {"ts", "Lic_en.txt"}, 253 | {"uk", "Lic_en.txt"}, 254 | {"uk_UA", "Lic_en.txt"}, 255 | {"ur", "Lic_en.txt"}, 256 | {"ur_PK", "Lic_en.txt"}, 257 | {"uz", "Lic_en.txt"}, 258 | {"uz_UZ", "Lic_en.txt"}, 259 | {"uz_UZ", "Lic_en.txt"}, 260 | {"vi", "Lic_en.txt"}, 261 | {"vi_VN", "Lic_en.txt"}, 262 | {"xh", "Lic_en.txt"}, 263 | {"xh_ZA", "Lic_en.txt"}, 264 | {"zh", "Lic_zh.txt"}, 265 | {"zh_CN", "Lic_zh.txt"}, 266 | {"zh_HK", "Lic_zh.txt"}, 267 | {"zh_MO", "Lic_zh.txt"}, 268 | {"zh_SG", "Lic_zh.txt"}, 269 | {"zh_TW", "Lic_zh_tw.txt"}, 270 | {"zu", "Lic_en.txt"}, 271 | {"zu_ZA", "Lic_en.txt"}, 272 | } 273 | 274 | func TestResolveLicenseFile(t *testing.T) { 275 | for _, table := range licenseTests { 276 | os.Setenv("LANG", table.in) 277 | f := resolveLicenseFile() 278 | if f != table.out { 279 | t.Errorf("resolveLicenseFile() with LANG=%v - expected %v, got %v", table.in, table.out, f) 280 | } 281 | } 282 | } 283 | -------------------------------------------------------------------------------- /cmd/runagent/mirror.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2020, 2021 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "bufio" 20 | "context" 21 | "fmt" 22 | "os" 23 | "sync" 24 | "time" 25 | ) 26 | 27 | // waitForFile waits until the specified file exists 28 | func waitForFile(ctx context.Context, path string) (os.FileInfo, error) { 29 | var fi os.FileInfo 30 | var err error 31 | // Wait for file to exist 32 | for { 33 | select { 34 | // Check to see if cancellation has been requested 35 | case <-ctx.Done(): 36 | return os.Stat(path) 37 | default: 38 | fi, err = os.Stat(path) 39 | if err != nil { 40 | if os.IsNotExist(err) { 41 | time.Sleep(500 * time.Millisecond) 42 | continue 43 | } else { 44 | return nil, fmt.Errorf("mirror: unable to get info on file %v", path) 45 | } 46 | } 47 | return fi, nil 48 | } 49 | } 50 | } 51 | 52 | type mirrorFunc func(msg string) bool 53 | 54 | // mirrorAvailableMessages prints lines from the file, until no more are available 55 | func mirrorAvailableMessages(f *os.File, mf mirrorFunc) { 56 | count := 0 57 | scanner := bufio.NewScanner(f) 58 | for scanner.Scan() { 59 | t := scanner.Text() 60 | if mf(t) { 61 | count++ 62 | } 63 | } 64 | if count > 0 { 65 | eventLog.Debugf("Mirrored %v log entries from %v", count, f.Name()) 66 | } 67 | err := scanner.Err() 68 | if err != nil { 69 | eventLog.Errorf("Error reading file %v: %v", f.Name(), err) 70 | return 71 | } 72 | } 73 | 74 | 75 | // mirrorLog tails the specified file, and logs each line to stdout. 76 | // This is useful for usability, as the container console log can show 77 | // messages from the MQ error logs. 78 | func mirrorLog(ctx context.Context, wg *sync.WaitGroup, path string, fromStart bool, mf mirrorFunc) (chan error, error) { 79 | errorChannel := make(chan error, 1) 80 | var offset int64 = -1 81 | var f *os.File 82 | var err error 83 | var fi os.FileInfo 84 | 85 | // Need to check if the file exists before returning, otherwise we have a 86 | // race to see if the new file get created before we can test for it 87 | fi, err = os.Stat(path) 88 | if err != nil { 89 | if os.IsNotExist(err) { 90 | // File doesn't exist, so ensure we start at the beginning 91 | offset = 0 92 | } else { 93 | return nil, err 94 | } 95 | } else { 96 | // If the file exists, open it now, before we return. This makes sure 97 | // the file is open before the queue manager is created or started. 98 | // Otherwise, there would be the potential for a nearly-full file to 99 | // rotate before the goroutine had a chance to open it. 100 | f, err = os.OpenFile(path, os.O_RDONLY, 0) 101 | if err != nil { 102 | return nil, err 103 | } 104 | // File already exists, so start reading at the end 105 | offset = fi.Size() 106 | } 107 | 108 | // Increment wait group counter, only if the goroutine gets started 109 | wg.Add(1) 110 | go func() { 111 | // Notify the wait group when this goroutine ends 112 | defer func() { 113 | eventLog.Debugf("Finished monitoring %v", path) 114 | wg.Done() 115 | }() 116 | if f == nil { 117 | // File didn't exist, so need to wait for it 118 | fi, err = waitForFile(ctx, path) 119 | if err != nil { 120 | eventLog.Error(err) 121 | errorChannel <- err 122 | return 123 | } 124 | if fi == nil { 125 | return 126 | } 127 | eventLog.Debugf("File exists: %v, %v", path, fi.Size()) 128 | f, err = os.OpenFile(path, os.O_RDONLY, 0) 129 | if err != nil { 130 | eventLog.Error(err) 131 | errorChannel <- err 132 | return 133 | } 134 | } 135 | 136 | fi, err = f.Stat() 137 | if err != nil { 138 | eventLog.Error(err) 139 | errorChannel <- err 140 | return 141 | } 142 | 143 | // The file now exists. If it didn't exist before we started, offset=0 144 | // Always start at the beginning if we've been told to go from the start 145 | if offset != 0 && !fromStart { 146 | eventLog.Debugf("Seeking offset %v in file %v", offset, path) 147 | _, err = f.Seek(offset, 0) 148 | if err != nil { 149 | eventLog.Errorf("Unable to return to offset %v: %v", offset, err) 150 | } 151 | } 152 | closing := false 153 | 154 | // Display messages in a loop 155 | for { 156 | mirrorAvailableMessages(f, mf) 157 | // Wait for the new log file (after rotation) 158 | newFI, err := waitForFile(ctx, path) 159 | if err != nil { 160 | eventLog.Error(err) 161 | errorChannel <- err 162 | return 163 | } 164 | if !os.SameFile(fi, newFI) { 165 | eventLog.Debugf("Detected log rotation in file %v", path) 166 | // WARNING: There is a possible race condition here. If *another* 167 | // log rotation happens before we can open the new file, then we 168 | // could skip all those messages. This could happen with a very small 169 | // MQ error log size. 170 | mirrorAvailableMessages(f, mf) 171 | err = f.Close() 172 | if err != nil { 173 | eventLog.Errorf("Unable to close mirror file handle: %v", err) 174 | } 175 | // Re-open file 176 | eventLog.Debugf("Re-opening error log file %v", path) 177 | f, err = os.OpenFile(path, os.O_RDONLY, 0) 178 | if err != nil { 179 | eventLog.Error(err) 180 | errorChannel <- err 181 | return 182 | } 183 | fi = newFI 184 | // Don't seek this time, because we know it's a new file 185 | mirrorAvailableMessages(f, mf) 186 | } 187 | select { 188 | case <-ctx.Done(): 189 | eventLog.Debugf("Context cancelled for mirroring %v", path) 190 | if closing { 191 | eventLog.Debugf("Shutting down mirror for %v", path) 192 | return 193 | } 194 | // Set a flag, to allow one more time through the loop 195 | closing = true 196 | default: 197 | time.Sleep(500 * time.Millisecond) 198 | } 199 | } 200 | }() 201 | return errorChannel, nil 202 | } 203 | -------------------------------------------------------------------------------- /cmd/runagent/post_init.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2020, 2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "bufio" 20 | "bytes" 21 | "fmt" 22 | "os" 23 | "os/exec" 24 | "path/filepath" 25 | "strings" 26 | 27 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 28 | ) 29 | 30 | var supportedCommands []string = []string{"fteCancelTransfer", 31 | "fteClearMonitorHistory", 32 | "fteCreateMonitor", 33 | "fteCreateTemplate", 34 | "fteCreateTransfer", 35 | "fteDeleteMonitor", 36 | "fteDeleteScheduledTransfer", 37 | "fteDeleteTemplates", 38 | "fteDisplayVersion", 39 | "fteListAgents", 40 | "fteListMonitors", 41 | "fteListScheduledTransfers", 42 | "fteListTemplates", 43 | "ftePingAgent", 44 | "fteSetAgentLogLevel", 45 | "fteSetAgentTraceLevel", 46 | "fteShowAgentDetails", 47 | "fteStartMonitor", 48 | "fteStopMonitor"} 49 | 50 | // Process additional MFT commands that have been specified through 51 | // file with "mftc" extension mounted at /etc/mqft/config directory 52 | // Each line in the mftc file must be a valid MFT command with all 53 | // applicable parameters specified 54 | func postInit() { 55 | cmdsDir := "/etc/mqft/config" 56 | fileList, err := os.ReadDir(cmdsDir) 57 | if err == nil && len(fileList) > 0 { 58 | for _, fileInfo := range fileList { 59 | if !fileInfo.IsDir() && fileInfo.Type().IsRegular() { 60 | if strings.Contains(fileInfo.Name(), ".mftc") { 61 | processCommand(filepath.Join(cmdsDir, fileInfo.Name())) 62 | } 63 | } 64 | } 65 | } 66 | } 67 | 68 | // Read one line at a time from the specified file and process 69 | // if it is a valid MFT command 70 | func processCommand(cmdFilePath string) { 71 | cmdFile, err := os.OpenFile(cmdFilePath, os.O_RDONLY, 0) 72 | if err != nil { 73 | utils.PrintLog(fmt.Sprintf("Error occurred while opening file %s. The error is %v", cmdFilePath, err)) 74 | return 75 | } 76 | defer cmdFile.Close() 77 | 78 | utils.PrintLog(fmt.Sprintf("Processing commands from file %s", cmdFilePath)) 79 | 80 | // Iterate through the lines and attempt to execute the valid MFT commands found 81 | scanner := bufio.NewScanner(cmdFile) 82 | for scanner.Scan() { 83 | cmdLine := strings.TrimSpace(scanner.Text()) 84 | // Line is not blank and it begins with valid MFT command. 85 | if len(cmdLine) > 0 && isValidCommand(cmdLine) { 86 | // Split and parameterize the line 87 | parameters := strings.Split(cmdLine, " ") 88 | if len(parameters) > 0 { 89 | cmdPath, lookPathErr := exec.LookPath(parameters[0]) 90 | if lookPathErr == nil { 91 | cmdParams := make([]string, 0) 92 | // Ignore the first token as it will be the command name itself. 93 | for index := 0; index < len(parameters); index++ { 94 | parameter := strings.TrimSpace(parameters[index]) 95 | if len(parameter) > 0 { 96 | cmdParams = append(cmdParams, parameter) 97 | } 98 | } 99 | 100 | cmdExec := &exec.Cmd{ 101 | Path: cmdPath, 102 | Args: cmdParams, 103 | } 104 | 105 | var outb, errb bytes.Buffer 106 | cmdExec.Stdout = &outb 107 | cmdExec.Stderr = &errb 108 | // Change current working directory that is writable because some commands create files 109 | chgErr := os.Chdir("/tmp") 110 | if chgErr != nil { 111 | utils.PrintLog("Failed to change current working directory to /tmp") 112 | } 113 | 114 | if err := cmdExec.Run(); err != nil { 115 | utils.PrintLog(fmt.Sprintf("Command execution error: %v %v\n", cmdExec, err)) 116 | utils.PrintLog(fmt.Sprintf(utils.MFT_CONT_CMD_ERROR_0042, outb.String(), errb.String())) 117 | } else { 118 | utils.PrintLog(fmt.Sprintf("Command output: \n%v\n%v", outb.String(), errb.String())) 119 | } 120 | } else { 121 | utils.PrintLog(fmt.Sprintf("Command not found. %v", lookPathErr)) 122 | } 123 | } 124 | } else { 125 | utils.PrintLog(fmt.Sprintf("%s is not a valid IBM MQ Managed File Transfer command", cmdLine)) 126 | } 127 | } 128 | } 129 | 130 | // Does the line begins with a valid MFT command 131 | func isValidCommand(cmdLine string) bool { 132 | for _, supportedCmd := range supportedCommands { 133 | if strings.HasPrefix(cmdLine, strings.TrimSpace(supportedCmd)) { 134 | return true 135 | } 136 | } 137 | return false 138 | } 139 | -------------------------------------------------------------------------------- /cmd/runagent/process.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2022-2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "context" 20 | "fmt" 21 | "os" 22 | "os/exec" 23 | "path/filepath" 24 | "strings" 25 | ) 26 | 27 | // Verifies that we are the main or only instance of this program 28 | func verifySingleProcess() error { 29 | programName, err := determineExecutable() 30 | if err != nil { 31 | return fmt.Errorf("Failed to determine name of this program - %v", err) 32 | } 33 | 34 | // Verify that there is only one runmqserver 35 | _, err = verifyOnlyOne(programName) 36 | if err != nil { 37 | return fmt.Errorf("You cannot run more than one instance of this program") 38 | } 39 | 40 | return nil 41 | } 42 | 43 | // Verifies that there is only one instance running of the given program name. 44 | func verifyOnlyOne(programName string) (int, error) { 45 | // #nosec G104 46 | out, _, _ := run("ps", "-e", "--format", "cmd") 47 | //if this goes wrong then assume we are the only one 48 | numOfProg := strings.Count(out, programName) 49 | if numOfProg != 1 { 50 | return numOfProg, fmt.Errorf("Expected there to be only 1 instance of %s but found %d", programName, numOfProg) 51 | } 52 | return numOfProg, nil 53 | } 54 | 55 | // Determines the name of the currently running executable. 56 | func determineExecutable() (string, error) { 57 | file, err := os.Executable() 58 | if err != nil { 59 | return "", err 60 | } 61 | 62 | _, exec := filepath.Split(file) 63 | return exec, nil 64 | } 65 | 66 | // Run runs an OS command. On Linux it waits for the command to 67 | // complete and returns the exit status (return code). 68 | // Do not use this function to run shell built-ins (like "cd"), because 69 | // the error handling works differently 70 | func run(name string, arg ...string) (string, int, error) { 71 | return runContext(context.Background(), name, arg...) 72 | } 73 | 74 | func runContext(ctx context.Context, name string, arg ...string) (string, int, error) { 75 | // Run the command and wait for completion 76 | // #nosec G204 77 | cmd := exec.CommandContext(ctx, name, arg...) 78 | out, err := cmd.CombinedOutput() 79 | rc := cmd.ProcessState.ExitCode() 80 | if err != nil { 81 | return string(out), rc, fmt.Errorf("%v: %v", cmd.Path, err) 82 | } 83 | return string(out), rc, nil 84 | } 85 | -------------------------------------------------------------------------------- /cmd/runagent/protocolbridgeproperties.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2022, 2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | /* 19 | * Contains a list of properties as defined in ProtocolBridgeProperties.xml. 20 | * These properties are valid only for prototcol bridge agents. The methods 21 | * in this file validate the properties specified in agent configuration 22 | * JSON file. 23 | */ 24 | // HashMap of Protocol bridge property name and it's type 25 | // 1 - string 26 | // 2 - integer 27 | // 3 - boolean 28 | var bridgeProperies map[string]int = make(map[string]int) 29 | 30 | func BuildBridgePropertyList() { 31 | bridgeProperies["defaultServer"] = DATA_TYPE_STRING 32 | bridgeProperies["maxActiveDestinationTransfers"] = DATA_TYPE_INT 33 | bridgeProperies["failTransferWhenCapacityReached"] = DATA_TYPE_BOOL 34 | bridgeProperies["name"] = DATA_TYPE_STRING 35 | bridgeProperies["type"] = DATA_TYPE_STRING 36 | bridgeProperies["host"] = DATA_TYPE_STRING 37 | bridgeProperies["port"] = DATA_TYPE_INT 38 | bridgeProperies["platform"] = DATA_TYPE_STRING 39 | bridgeProperies["timeZone"] = DATA_TYPE_STRING 40 | bridgeProperies["locale"] = DATA_TYPE_STRING 41 | bridgeProperies["fileEncoding"] = DATA_TYPE_STRING 42 | bridgeProperies["listFormat"] = DATA_TYPE_STRING 43 | bridgeProperies["listFileRecentDateFormat"] = DATA_TYPE_STRING 44 | bridgeProperies["listFileOldDateFormat"] = DATA_TYPE_STRING 45 | bridgeProperies["monthShortNames"] = DATA_TYPE_STRING 46 | bridgeProperies["limitedWrite"] = DATA_TYPE_BOOL 47 | bridgeProperies["maxListFileNames"] = DATA_TYPE_INT 48 | bridgeProperies["maxListDirectoryLevels"] = DATA_TYPE_INT 49 | bridgeProperies["maxSessions"] = DATA_TYPE_INT 50 | bridgeProperies["socketTimeout"] = DATA_TYPE_INT 51 | bridgeProperies["passiveMode"] = DATA_TYPE_BOOL 52 | bridgeProperies["connectionTimeout"] = DATA_TYPE_INT 53 | bridgeProperies["controlEncoding"] = DATA_TYPE_STRING 54 | } 55 | 56 | // Determine if the specified property is valid 57 | func ValidateBridgeProperty(propertyName string) (bool, int) { 58 | typeV, ok := bridgeProperies[propertyName] 59 | return ok, typeV 60 | } 61 | -------------------------------------------------------------------------------- /cmd/runagent/runagent_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2020, 2021 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "fmt" 20 | "io/ioutil" 21 | "os" 22 | "strings" 23 | "testing" 24 | 25 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 26 | ) 27 | 28 | /* 29 | * Unit test program to test methods of runagent. 30 | */ 31 | func TestReadConfigurationDataFromFile(t *testing.T) { 32 | var jsonFileName string 33 | 34 | // Test valid JSON data. 35 | var pathNames []string = strings.Split(t.Name(), "/") 36 | if len(pathNames) == 2 { 37 | jsonFileName = pathNames[1] 38 | } else { 39 | jsonFileName = pathNames[0] 40 | } 41 | 42 | validJson, err := ioutil.TempFile("", jsonFileName) 43 | if err != nil { 44 | t.Fatal(err) 45 | } 46 | 47 | t.Log(validJson.Name()) 48 | defer os.Remove(validJson.Name()) 49 | validJsonF, err := os.OpenFile(validJson.Name(), os.O_WRONLY, 0700) 50 | if err != nil { 51 | t.Fatal(err) 52 | } 53 | configDataValid := "{\"dataPath\":\"/mqmft/mftdata\",\"monitoringInterval\":300,\"displayAgentLogs\":true,\"displayLineCount\":50,\"waitTimeToStart\":10,\"coordinationQMgr\":{\"name\":\"QUICKSTART\",\"host\":\"10.254.0.4\",\"port\":1414,\"channel\":\"MFT_HA_CHN\"},\"commandsQMgr\":{\"name\":\"QUICKSTART\",\"host\":\"10.254.0.4\",\"port\":1414,\"channel\":\"MFT_HA_CHN\"},\"agent\":{\"name\":\"KXAGNT\",\"type\":\"STANDARD\",\"qmgrName\":\"QUICKSTART\",\"qmgrHost\":\"10.254.0.4\",\"qmgrPort\":1414,\"qmgrChannel\":\"MFT_HA_CHN\",\"credentialsFile\":\"/usr/local/bin/MQMFTCredentials.xml\",\"protocolBridge\":{\"credentialsFile\":\"/usr/local/bin/ProtocolBridgeCredentials.xml\",\"serverType\":\"SFTP\",\"serverHost\":\"9.199.144.110\",\"serverTimezone\":\"\",\"serverPlatform\":\"UNIX\",\"serverLocale\":\"en-US\",\"serverFileEncoding\":\"UTF-8\",\"serverPort\":22,\"serverTrustStoreFile\":\"\",\"serverLimitedWrite\":\"\",\"serverListFormat\":\"\",\"serverUserId\":\"root\",\"serverPassword\":\"Kitt@n0or\"},\"additionalProperties\":{\"enableQueueInputOutput\":\"true\"}}" 54 | fmt.Fprintln(validJsonF, configDataValid) 55 | 56 | validJsonData, err := utils.ReadConfigurationDataFromFile(validJson.Name()) 57 | if err != nil { 58 | t.Fatal(err) 59 | } else { 60 | t.Log(validJsonData) 61 | } 62 | 63 | // Test invalid JSON data. 64 | invalidJson, err := ioutil.TempFile("", jsonFileName) 65 | if err != nil { 66 | t.Fatal(err) 67 | } 68 | 69 | t.Log(invalidJson.Name()) 70 | defer os.Remove(invalidJson.Name()) 71 | invalidJsonF, err := os.OpenFile(invalidJson.Name(), os.O_WRONLY, 0700) 72 | if err != nil { 73 | t.Fatal(err) 74 | } 75 | 76 | t.Log(validJson.Name()) 77 | defer os.Remove(invalidJson.Name()) 78 | 79 | configDataInValid := "{\"adataPath\":\"/mqmft/mftdata\",\"monitoringInterval\":300,\"displayAgentLogs\":true,\"displayLineCount\":50,\"waitTimeToStart\":10,\"coordinationQMgr\":{\"name\":\"QUICKSTART\",\"host\":\"10.254.0.4\",\"port\":1414,\"channel\":\"MFT_HA_CHN\"},\"commandsQMgr\":{\"name\":\"QUICKSTART\",\"host\":\"10.254.0.4\",\"port\":1414,\"channel\":\"MFT_HA_CHN\"},\"agent\":{\"name\":\"KXAGNT\",\"type\":\"STANDARD\",\"qmgrName\":\"QUICKSTART\",\"qmgrHost\":\"10.254.0.4\",\"qmgrPort\":1414,\"qmgrChannel\":\"MFT_HA_CHN\",\"credentialsFile\":\"/usr/local/bin/MQMFTCredentials.xml\",\"protocolBridge\":{\"credentialsFile\":\"/usr/local/bin/ProtocolBridgeCredentials.xml\",\"serverType\":\"SFTP\",\"serverHost\":\"9.199.144.110\",\"serverTimezone\":\"\",\"serverPlatform\":\"UNIX\",\"serverLocale\":\"en-US\",\"serverFileEncoding\":\"UTF-8\",\"serverPort\":22,\"serverTrustStoreFile\":\"\",\"serverLimitedWrite\":\"\",\"serverListFormat\":\"\",\"serverUserId\":\"root\",\"serverPassword\":\"Kitt@n0or\"},\"additionalProperties\":{\"enableQueueInputOutput\":\"true\"}}" 80 | fmt.Fprintln(invalidJsonF, configDataInValid) 81 | invalidatedJson, err := utils.ReadConfigurationDataFromFile(invalidJson.Name()) 82 | if err != nil { 83 | t.Log(err) 84 | } else { 85 | t.Log(invalidatedJson) 86 | fmt.Println("Supplied agent configuration data has invalid attributes") 87 | } 88 | } 89 | 90 | // Test updating of agent properties file 91 | func TestupdateAgentProperties(t *testing.T) { 92 | configDataValid := "{\"dataPath\":\"/mqmft/mftdata\",\"monitoringInterval\":300,\"displayAgentLogs\":true,\"displayLineCount\":50,\"waitTimeToStart\":10,\"coordinationQMgr\":{\"name\":\"QUICKSTART\",\"host\":\"10.254.0.4\",\"port\":1414,\"channel\":\"MFT_HA_CHN\"},\"commandsQMgr\":{\"name\":\"QUICKSTART\",\"host\":\"10.254.0.4\",\"port\":1414,\"channel\":\"MFT_HA_CHN\"},\"agent\":{\"name\":\"KXAGNT\",\"type\":\"STANDARD\",\"qmgrName\":\"QUICKSTART\",\"qmgrHost\":\"10.254.0.4\",\"qmgrPort\":1414,\"qmgrChannel\":\"MFT_HA_CHN\",\"credentialsFile\":\"/usr/local/bin/MQMFTCredentials.xml\",\"protocolBridge\":{\"credentialsFile\":\"/usr/local/bin/ProtocolBridgeCredentials.xml\",\"serverType\":\"SFTP\",\"serverHost\":\"9.199.144.110\",\"serverTimezone\":\"\",\"serverPlatform\":\"UNIX\",\"serverLocale\":\"en-US\",\"serverFileEncoding\":\"UTF-8\",\"serverPort\":22,\"serverTrustStoreFile\":\"\",\"serverLimitedWrite\":\"\",\"serverListFormat\":\"\",\"serverUserId\":\"root\",\"serverPassword\":\"Kitt@n0or\"},\"additionalProperties\":{\"enableQueueInputOutput\":\"true\"}}" 93 | initialProps := "agentQMgr=MFTQM\nagentQMgrPort=1414\nagentDesc=\nagentQMgrHost=localhost\nagentQMgrChannel=MFT_CHN\nagentName=SRC\ntrace=com.ibm.wmqfte=all" 94 | compareTemplate := "agentQMgr=MFTQM\nagentQMgrPort=1414\nagentDesc=\nagentQMgrHost=localhost\nagentQMgrChannel=MFT_CHN\nagentName=SRC\ntrace=com.ibm.wmqfte=all\nenableQueueInputOutput=true" 95 | 96 | agentProps, err := ioutil.TempFile("", t.Name()) 97 | if err != nil { 98 | t.Fatal(err) 99 | } 100 | defer os.Remove(agentProps.Name()) 101 | t.Log(agentProps.Name()) 102 | agentPropsF, err := os.OpenFile(agentProps.Name(), os.O_WRONLY, 0644) 103 | if err != nil { 104 | t.Fatal(err) 105 | } 106 | // Write initial properties into file and close 107 | fmt.Fprintln(agentPropsF, initialProps) 108 | agentPropsF.Close() 109 | 110 | // Update the agent.properties file with data from configuration file 111 | updateAgentProperties(agentProps.Name(), configDataValid, "additionalProperties", false) 112 | 113 | content, err := ioutil.ReadFile(agentProps.Name()) 114 | if err != nil { 115 | t.Fatal(err) 116 | } 117 | 118 | // Convert []byte to string and print to screen 119 | updatedProps := string(content) 120 | 121 | // Now compare with template 122 | if strings.EqualFold(updatedProps, compareTemplate) == true { 123 | t.Log("OK: Properties file updated as expected") 124 | } else { 125 | t.Fatal("Properties file not updated correctly") 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /cmd/runagent/signals.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2020, 2021 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "bytes" 20 | "fmt" 21 | "os" 22 | "os/exec" 23 | "os/signal" 24 | "syscall" 25 | 26 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 27 | 28 | "golang.org/x/sys/unix" 29 | ) 30 | 31 | const ( 32 | startReaping = iota 33 | reapNow = iota 34 | ) 35 | 36 | func signalHandler(agentName string, coordinationQMgr string) chan int { 37 | control := make(chan int) 38 | // Use separate channels for the signals, to avoid SIGCHLD signals swamping 39 | // the buffer, and preventing other signals. 40 | stopSignals := make(chan os.Signal) 41 | reapSignals := make(chan os.Signal) 42 | signal.Notify(stopSignals, syscall.SIGTERM, syscall.SIGINT) 43 | go func() { 44 | for { 45 | select { 46 | case sig := <-stopSignals: 47 | utils.PrintLog(fmt.Sprintf(utils.MFT_CONT_SIGNAL_RECD_0071, sig)) 48 | signal.Stop(reapSignals) 49 | signal.Stop(stopSignals) 50 | // #nosec G104 51 | stopAgent(agentName, coordinationQMgr) 52 | // One final reap 53 | reapZombies() 54 | close(control) 55 | // End the goroutine 56 | return 57 | case <-reapSignals: 58 | if logLevel >= LOG_LEVEL_VERBOSE { 59 | utils.PrintLog(utils.MFT_CONT_SIGNAL_CHILD_0069) 60 | } 61 | reapZombies() 62 | case job := <-control: 63 | switch { 64 | case job == startReaping: 65 | // Add SIGCHLD to the list of signals we're listening to 66 | if logLevel >= LOG_LEVEL_VERBOSE { 67 | utils.PrintLog(utils.MFT_CONT_SIGNAL_LISTEN_0070) 68 | } 69 | signal.Notify(reapSignals, syscall.SIGCHLD) 70 | case job == reapNow: 71 | reapZombies() 72 | } 73 | } 74 | } 75 | }() 76 | return control 77 | } 78 | 79 | // reapZombies reaps any zombie (terminated) processes now. 80 | // This function should be called before exiting. 81 | func reapZombies() { 82 | for { 83 | var ws unix.WaitStatus 84 | pid, err := unix.Wait4(-1, &ws, unix.WNOHANG, nil) 85 | // If err or pid indicate "no child processes" 86 | if pid == 0 || err == unix.ECHILD { 87 | return 88 | } 89 | if logLevel >= LOG_LEVEL_VERBOSE { 90 | utils.PrintLog(fmt.Sprintf(utils.MFT_CONT_REAPED_PID_0072, pid)) 91 | } 92 | } 93 | } 94 | 95 | // Stops an agent when container stop is issued. 96 | func stopAgent(agentName string, coordinationQMgr string) { 97 | var outb, errb bytes.Buffer 98 | // Get the path of MFT fteStopAgent command. 99 | cmdStopAgntPath, lookPathErr := exec.LookPath("fteStopAgent") 100 | if lookPathErr != nil { 101 | utils.PrintLog(fmt.Sprintf(utils.MFT_CONT_CMD_NOT_FOUND_0028, lookPathErr)) 102 | os.Exit(1) 103 | } 104 | cmdStopAgnt := &exec.Cmd{ 105 | Path: cmdStopAgntPath, 106 | Args: []string{cmdStopAgntPath, "-p", coordinationQMgr, agentName, "-i"}, 107 | } 108 | 109 | outb.Reset() 110 | errb.Reset() 111 | cmdStopAgnt.Stdout = &outb 112 | cmdStopAgnt.Stderr = &errb 113 | err := cmdStopAgnt.Run() 114 | if err != nil { 115 | utils.PrintLog(fmt.Sprintf("An error occured when running fteStopAgent command. The error is: %s", err.Error())) 116 | utils.PrintLog(fmt.Sprintf("Command: %s\n", outb.String())) 117 | utils.PrintLog(fmt.Sprintf("Error %s\n", errb.String())) 118 | } else { 119 | utils.PrintLog(fmt.Sprintf(utils.MFT_CONT_AGENT_STOPPED_0068, agentName)) 120 | } 121 | } 122 | 123 | // Temporary logging 124 | func writeLog(messageToLog string) { 125 | logPath := os.Getenv("BFG_DATA") + "/mqft/logs/signal.log" 126 | f, err := os.OpenFile(logPath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644) 127 | if err != nil { 128 | utils.PrintLog(err.Error()) 129 | return 130 | } 131 | defer f.Close() 132 | 133 | // If we can't write to file 134 | _, errWrite := f.WriteString(messageToLog + "\n") 135 | if errWrite != nil { 136 | utils.PrintLog(errWrite.Error()) 137 | return 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /cmd/runagent/tls.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2022, 2022 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package main 17 | 18 | import ( 19 | "bytes" 20 | "errors" 21 | "fmt" 22 | "math/rand" 23 | "os" 24 | "os/exec" 25 | "path/filepath" 26 | "strings" 27 | "time" 28 | 29 | "github.com/ibm-messaging/mq-container-mft/pkg/utils" 30 | ) 31 | 32 | /** 33 | * Create keystore and include user specified certificates 34 | */ 35 | func CreateKeyStore(keyStoreDir string, keyStoreFile string, certFilePath string, certStorePassword string) error { 36 | // First verify if the certificate file exists 37 | if !utils.DoesFileExist(certFilePath) { 38 | errorMsg := "Certificate file " + certFilePath + " does not exist" 39 | return errors.New(errorMsg) 40 | } 41 | 42 | keyStorePathFinal := filepath.Join(keyStoreDir, keyStoreFile) 43 | // Delete if keystore already exists 44 | finfo, err := os.Lstat(keyStoreDir) 45 | if err == nil { 46 | if logLevel >= LOG_LEVEL_VERBOSE { 47 | utils.PrintLog(fmt.Sprintf("Keystore path %v exists.", finfo.Name())) 48 | } 49 | certInfo, err := os.Lstat(keyStorePathFinal) 50 | if err == nil { 51 | if logLevel >= LOG_LEVEL_VERBOSE { 52 | utils.PrintLog(fmt.Sprintf("Keystore %v already exists. Deleting it...", certInfo.Name())) 53 | } 54 | delErr := os.Remove(keyStorePathFinal) 55 | if delErr == nil { 56 | if logLevel >= LOG_LEVEL_VERBOSE { 57 | utils.PrintLog(fmt.Sprintf("Existing keystore %v deleted", keyStorePathFinal)) 58 | } 59 | } else { 60 | errorMsg := fmt.Sprintf("An error occurred while deleting keystore %v. The error is: %v", keyStorePathFinal, delErr) 61 | return errors.New(errorMsg) 62 | } 63 | } 64 | } 65 | 66 | // Create directory 67 | errCreateDataPath := utils.CreatePath(keyStoreDir) 68 | if errCreateDataPath != nil { 69 | return errCreateDataPath 70 | } 71 | 72 | // A new keystore will be created if it does not exist. 73 | var outb, errb bytes.Buffer 74 | cmdKeyToolPath, lookPathErr := exec.LookPath("keytool") 75 | if lookPathErr == nil { 76 | var cmdArgs []string 77 | cmdArgs = append(cmdArgs, cmdKeyToolPath, 78 | "-importcert", 79 | "-trustcacerts", 80 | "-keystore", keyStorePathFinal, 81 | "-storetype", "pkcs12", 82 | "-storepass", certStorePassword, 83 | "-noprompt", 84 | "-v", 85 | "-alias", "agentstore", 86 | "-file", certFilePath) 87 | 88 | cmdKeyTool := &exec.Cmd{ 89 | Path: cmdKeyToolPath, 90 | Args: cmdArgs, 91 | } 92 | 93 | cmdKeyTool.Stdout = &outb 94 | cmdKeyTool.Stderr = &errb 95 | // Execute the keytool command. Log an error an exit in case of any error. 96 | if err := cmdKeyTool.Run(); err != nil { 97 | errorMsg := fmt.Sprintf("Error occurred while creating keystore. Command Output: %v Error Output: %vError: %v", 98 | outb.String(), errb.String(), err.Error()) 99 | return errors.New(errorMsg) 100 | } else { 101 | if logLevel >= LOG_LEVEL_VERBOSE { 102 | utils.PrintLog(fmt.Sprintf("Created keystore. Output: %v %v", outb.String(), errb.String())) 103 | } 104 | } 105 | 106 | // Change the permisions on the keystore 107 | err := os.Chmod(keyStorePathFinal, 0600) 108 | if err != nil { 109 | errorMsg := fmt.Sprintf(utils.MFT_FAILED_PERMISSION_KEYSTORE, keyStorePathFinal, err) 110 | return errors.New(errorMsg) 111 | } 112 | } 113 | return nil 114 | } 115 | 116 | // Generates a random 12 character password from the characters a-z, A-Z, 0-9 117 | func generateRandomPassword() string { 118 | rand.Seed(time.Now().Unix()) 119 | validChars := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 120 | validcharArray := []byte(validChars) 121 | password := "" 122 | for i := 0; i < 12; i++ { 123 | password = password + string(validcharArray[rand.Intn(len(validcharArray))]) 124 | } 125 | 126 | return password 127 | } 128 | 129 | // Search the specified directory for certificate files 130 | func getKeyFile(keysDir string, fileType string) string { 131 | fileList, err := os.ReadDir(keysDir) 132 | if err == nil && len(fileList) > 0 { 133 | for _, fileInfo := range fileList { 134 | if strings.Contains(fileInfo.Name(), fileType) { 135 | //Return the first file having extension specified 136 | return filepath.Join(keysDir, fileInfo.Name()) 137 | } 138 | } 139 | } 140 | return "" 141 | } 142 | -------------------------------------------------------------------------------- /credentialsexit/BridgeCredentialExit/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /credentialsexit/BridgeCredentialExit/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | BridgeCredentialExit 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | 19 | 1710842127418 20 | 21 | 30 22 | 23 | org.eclipse.core.resources.regexFilterMatcher 24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /credentialsexit/BridgeCredentialExit/src/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Created-By: IBM Corporation 3 | Specification-Title: com.ibm.wmq.bridgecredentialexit.jar 4 | Specification-Version: 9.2.4.0 5 | Specification-Vendor: IBM Corporation 6 | Implementation-Title: com.ibm.wmq.bridgecredentialexit.jar 7 | Implementation-Version: 9.2.4.0 8 | Implementation-Vendor: IBM Corporation 9 | Sealed: true 10 | 11 | -------------------------------------------------------------------------------- /credentialsexit/BridgeCredentialExit/src/com/ibm/bridgecredentialexit/ProtocolBridgeCredentials.json: -------------------------------------------------------------------------------- 1 | { 2 | "servers": [ 3 | { 4 | "serverHostName":"elbow", 5 | "transferRequesterId":"mquserid", 6 | "serverType": "SFTP", 7 | "serverUserId": "atsftp", 8 | "serverAssocName": "mftassoc1", 9 | "serverPassword": "MFT03ftp", 10 | "serverHostKey": "ZTQ6Zjk6MzQ6NGU6ZDk6Nzk6NWY6N2E6ZjU6MGQ6MjA6OGU6OGI6Y2U6NjI6MTE=", 11 | "serverPrivateKey": "Iy0tLS0tQkVHSU4gUlNBIFBSSVZBVEUgS0VZLS0tLS0KUHJvYy1UeXBlOiA0LEVOQ1JZUFRFRApERUstSW5mbzogQUVTLTEyOC1DQkMsNjU1NUQyMkQ3MkJEOEUxQ0ZEOEEyRkIzQ0M3RjFEQ0IKCkFUNGVEZ0t2V252V1RpNXUyMVdGZXFFZnRTQWNyL3lIM2hZbXZHcGxIc3ZJb2FhVUhVRUd6MmVNNmNxK3NGVHcKZlNmSnJheFFQMnBvWnJ1TVIvcDQzRjc0QkhNUEhkUFVSTWVsa1FjdDlTazZSYkxiLytlb3A0aDBuaHZleW10TgpZS2cyeFA3Rmp4NUhFV01GV3pJMWVQZEh4M2FMRitvclZRZlVLZ2M2VFdBaEUwbkFJbEM0OENpRzFZOS9HNFpuCkdyakVJVVdhbGlmSlMwTkJoUUltbmpKZFpGZ2hNalMwQU1hYkI1alVJaWkvSWx6MGM5YzBEM0lFRlBVTVpPZkIKRlh6UUc0RXBiTlJpWU9kNFN6Wk44dGZUNTBaeXNwQWVyZFE4eEYzbkhMZ0pCc0ErZnduUTV2cE51U1hkMTE2VApYYm1GRWtNTGI3Nkx5ajN1em1GUmZKUjFJQmRHNkNRbUh5U1VKWXo0ZmdjR1hvMHhZcWoxTXRHOEVDNDJJQlpKCmI2bzVEN3hqZ0lGZFR5SzJtaDNGaU0zYjhRckhGK0lSdmVJOWpxWE9OcXIwanlyekgwdVFPTElvbTVNV1cwVDYKQmJZR2hWNERvcjMzODg5dG5FRThyNzduQkE1NHlnN3hyLzV4VVk0VlpBdnJjNHJyclRKVWV2RlhrSWNYaVJ3agpYMmMxTHhSWTdqWXkrSS9GTnNwbVQ1OTBiZzNMVW13eTBSaTBWTU1Sbnk4b2tsczdqUHRPZjY2RFdSUENwcW1RCm14SjhyS2FSRS9LdEtaWFdSNENSdldIOVBPa2lUODRhSlpoMUlSK2pjM00rNFdIR05ITkRiNEt1U1V2RmJiWVcKQ0xoQkVnRlB4MVpjdmxSN0Jmc3F1SEVSYk14ZkRPbG1YOThONzJmalpqTERuRm5ZUU13SkJnbEZoakg4UkhkYQpiT0hZRElsK0U3ME5vblNSdWhxRFBVWjZFeUZ4RzNRdkRFc21tTXV1cjhzS2JUNldaV0JybWdENE9LTkdMZnpqCnl3N2pXcEI0eEYrTkV3Y2VsNDNWZnNjTzBnTTE5dm1JU0k4ekZhSkdQNmR6RzFnMGNncGJ3NU9DdDMwL3VNOHoKVExrVmUwZ1BJYlVrNk90emVOMUQ1cWJVME5FMWNQcWRKczh4ZjBiQ3lXTklEOHlJdzl1a25FY3E5Vmd0VE80NQp2MzdvL1VLOWgrbFk4R0dLUlV0Y3phN3IzbTFydG5WOG4wbGVGR2NNZnJaYUZEdG9ucEFXRFVHcGxXQkZqTDJvCnNIM2Q4KzJNcmpoR0t0NkhjK09NVlhuUXQ0eEFJZmVGM2JuQldoYnNPcDliM2E5MjRqVkEyOVNGZHJRRnVJWmYKSHZFMjcwelRrN3pUSDd0bXdlSTdZOVN6VWZjTE5tUjlPTWxPMnVHN2E5TEZMM0NJcFVheDd4WityU2lhSm56UApydTNrd0tzRFdvdFdOYTdwdFdDbmgxWERJaE5iR3drTXZ0bWxyUm53cnFhcWlpS0hSREU2U3BNSjFKM3pWZHl2CnFjY1c3KzBmdGgyVDlXZnpGVHJKYWxrbTBObjUzNXRoSXBOMEhlSXNWaVFhSUowRnkvN01SczBlNUJvQVA1RUoKU1VhVExIZThtK0Vuckl2UHI0dHNkNHlDU0pvaHVSeWZ2QU9EVkppQUp3Z0tOUkNob052dzU5UWpIK3l1MmlmWQozL1RwLzE3VVZBZGh4MG9wQkFwQW45VXEvclUyNUxkS1lFYjFLTkQ3NGg5WU1WdHArUnhKQ1dVQ0NwNUljcHorCjByRjhZam91cEFwOGNnMHFsK08vK2N5UVIrQWRjRFdrRjB2MndFK1ZXVUI4bzhqbm1DaTBYaW9mdzlNeTNnakIKbmd6RjJZV0NUTjVYRFBZL1VwZUFVWkVKSHZudzR1VnZkNkdyWitWQzVGMkVlK0VwcXh5MkI0Z3E4TWN4MVFIRQpVRTZISHZYVFJoVVFwVDN6b0RBQ1pQR1pkVzFTSkNlRm51bXJsYzZXVXNXK2p6Q214QXJDTGMxT3gzMkpUMVJwCjNKbkt0QjhyWUt6VHFzSmMrNlhMajZUalpMRXZQWi9CaWpXckVveUFJekRENmV3K29hZ2oya25zSTVTNGZXYzAKLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K" 12 | }, 13 | { 14 | "serverHostName":"kakapo", 15 | "transferRequesterId":"mquserid", 16 | "serverType": "SFTP", 17 | "serverUserId": "atsftp", 18 | "serverAssocName": "mftassoc1", 19 | "serverPassword": "MFT03ftp", 20 | "serverHostKey": "ZTQ6Zjk6MzQ6NGU6ZDk6Nzk6NWY6N2E6ZjU6MGQ6MjA6OGU6OGI6Y2U6NjI6MTE=", 21 | "serverPrivateKey": "Iy0tLS0tQkVHSU4gUlNBIFBSSVZBVEUgS0VZLS0tLS0KUHJvYy1UeXBlOiA0LEVOQ1JZUFRFRApERUstSW5mbzogQUVTLTEyOC1DQkMsNjU1NUQyMkQ3MkJEOEUxQ0ZEOEEyRkIzQ0M3RjFEQ0IKCkFUNGVEZ0t2V252V1RpNXUyMVdGZXFFZnRTQWNyL3lIM2hZbXZHcGxIc3ZJb2FhVUhVRUd6MmVNNmNxK3NGVHcKZlNmSnJheFFQMnBvWnJ1TVIvcDQzRjc0QkhNUEhkUFVSTWVsa1FjdDlTazZSYkxiLytlb3A0aDBuaHZleW10TgpZS2cyeFA3Rmp4NUhFV01GV3pJMWVQZEh4M2FMRitvclZRZlVLZ2M2VFdBaEUwbkFJbEM0OENpRzFZOS9HNFpuCkdyakVJVVdhbGlmSlMwTkJoUUltbmpKZFpGZ2hNalMwQU1hYkI1alVJaWkvSWx6MGM5YzBEM0lFRlBVTVpPZkIKRlh6UUc0RXBiTlJpWU9kNFN6Wk44dGZUNTBaeXNwQWVyZFE4eEYzbkhMZ0pCc0ErZnduUTV2cE51U1hkMTE2VApYYm1GRWtNTGI3Nkx5ajN1em1GUmZKUjFJQmRHNkNRbUh5U1VKWXo0ZmdjR1hvMHhZcWoxTXRHOEVDNDJJQlpKCmI2bzVEN3hqZ0lGZFR5SzJtaDNGaU0zYjhRckhGK0lSdmVJOWpxWE9OcXIwanlyekgwdVFPTElvbTVNV1cwVDYKQmJZR2hWNERvcjMzODg5dG5FRThyNzduQkE1NHlnN3hyLzV4VVk0VlpBdnJjNHJyclRKVWV2RlhrSWNYaVJ3agpYMmMxTHhSWTdqWXkrSS9GTnNwbVQ1OTBiZzNMVW13eTBSaTBWTU1Sbnk4b2tsczdqUHRPZjY2RFdSUENwcW1RCm14SjhyS2FSRS9LdEtaWFdSNENSdldIOVBPa2lUODRhSlpoMUlSK2pjM00rNFdIR05ITkRiNEt1U1V2RmJiWVcKQ0xoQkVnRlB4MVpjdmxSN0Jmc3F1SEVSYk14ZkRPbG1YOThONzJmalpqTERuRm5ZUU13SkJnbEZoakg4UkhkYQpiT0hZRElsK0U3ME5vblNSdWhxRFBVWjZFeUZ4RzNRdkRFc21tTXV1cjhzS2JUNldaV0JybWdENE9LTkdMZnpqCnl3N2pXcEI0eEYrTkV3Y2VsNDNWZnNjTzBnTTE5dm1JU0k4ekZhSkdQNmR6RzFnMGNncGJ3NU9DdDMwL3VNOHoKVExrVmUwZ1BJYlVrNk90emVOMUQ1cWJVME5FMWNQcWRKczh4ZjBiQ3lXTklEOHlJdzl1a25FY3E5Vmd0VE80NQp2MzdvL1VLOWgrbFk4R0dLUlV0Y3phN3IzbTFydG5WOG4wbGVGR2NNZnJaYUZEdG9ucEFXRFVHcGxXQkZqTDJvCnNIM2Q4KzJNcmpoR0t0NkhjK09NVlhuUXQ0eEFJZmVGM2JuQldoYnNPcDliM2E5MjRqVkEyOVNGZHJRRnVJWmYKSHZFMjcwelRrN3pUSDd0bXdlSTdZOVN6VWZjTE5tUjlPTWxPMnVHN2E5TEZMM0NJcFVheDd4WityU2lhSm56UApydTNrd0tzRFdvdFdOYTdwdFdDbmgxWERJaE5iR3drTXZ0bWxyUm53cnFhcWlpS0hSREU2U3BNSjFKM3pWZHl2CnFjY1c3KzBmdGgyVDlXZnpGVHJKYWxrbTBObjUzNXRoSXBOMEhlSXNWaVFhSUowRnkvN01SczBlNUJvQVA1RUoKU1VhVExIZThtK0Vuckl2UHI0dHNkNHlDU0pvaHVSeWZ2QU9EVkppQUp3Z0tOUkNob052dzU5UWpIK3l1MmlmWQozL1RwLzE3VVZBZGh4MG9wQkFwQW45VXEvclUyNUxkS1lFYjFLTkQ3NGg5WU1WdHArUnhKQ1dVQ0NwNUljcHorCjByRjhZam91cEFwOGNnMHFsK08vK2N5UVIrQWRjRFdrRjB2MndFK1ZXVUI4bzhqbm1DaTBYaW9mdzlNeTNnakIKbmd6RjJZV0NUTjVYRFBZL1VwZUFVWkVKSHZudzR1VnZkNkdyWitWQzVGMkVlK0VwcXh5MkI0Z3E4TWN4MVFIRQpVRTZISHZYVFJoVVFwVDN6b0RBQ1pQR1pkVzFTSkNlRm51bXJsYzZXVXNXK2p6Q214QXJDTGMxT3gzMkpUMVJwCjNKbkt0QjhyWUt6VHFzSmMrNlhMajZUalpMRXZQWi9CaWpXckVveUFJekRENmV3K29hZ2oya25zSTVTNGZXYzAKLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K" 22 | }, 23 | { 24 | "serverHostName":"mykanos", 25 | "transferRequesterId":"mquserid", 26 | "serverType": "FTP", 27 | "serverUserId": "atsftp", 28 | "serverPassword": "MFT03ftp" 29 | }] 30 | } 31 | -------------------------------------------------------------------------------- /credentialsexit/BridgeCredentialExit/src/com/ibm/bridgecredentialexit/ProtocolBridgeCredentials.prop: -------------------------------------------------------------------------------- 1 | 10.17.68.52=root!1!S2l0dEBuMG9y 2 | 10.18.68.52=greekman!0!Santorini -------------------------------------------------------------------------------- /credentialsexit/BridgeCredentialExit/src/com/ibm/bridgecredentialexit/ProtocolBridgeCredsNoAssoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "servers": [ 3 | { 4 | "serverHostName":"noassconame", 5 | "transferRequesterId":"mquserid", 6 | "serverType": "SFTP", 7 | "serverUserId": "atsftp", 8 | "serverPassword": "MFT03ftp", 9 | "serverHostKey": "ZTQ6Zjk6MzQ6NGU6ZDk6Nzk6NWY6N2E6ZjU6MGQ6MjA6OGU6OGI6Y2U6NjI6MTE=", 10 | "serverPrivateKey": "Iy0tLS0tQkVHSU4gUlNBIFBSSVZBVEUgS0VZLS0tLS0KUHJvYy1UeXBlOiA0LEVOQ1JZUFRFRApERUstSW5mbzogQUVTLTEyOC1DQkMsNjU1NUQyMkQ3MkJEOEUxQ0ZEOEEyRkIzQ0M3RjFEQ0IKCkFUNGVEZ0t2V252V1RpNXUyMVdGZXFFZnRTQWNyL3lIM2hZbXZHcGxIc3ZJb2FhVUhVRUd6MmVNNmNxK3NGVHcKZlNmSnJheFFQMnBvWnJ1TVIvcDQzRjc0QkhNUEhkUFVSTWVsa1FjdDlTazZSYkxiLytlb3A0aDBuaHZleW10TgpZS2cyeFA3Rmp4NUhFV01GV3pJMWVQZEh4M2FMRitvclZRZlVLZ2M2VFdBaEUwbkFJbEM0OENpRzFZOS9HNFpuCkdyakVJVVdhbGlmSlMwTkJoUUltbmpKZFpGZ2hNalMwQU1hYkI1alVJaWkvSWx6MGM5YzBEM0lFRlBVTVpPZkIKRlh6UUc0RXBiTlJpWU9kNFN6Wk44dGZUNTBaeXNwQWVyZFE4eEYzbkhMZ0pCc0ErZnduUTV2cE51U1hkMTE2VApYYm1GRWtNTGI3Nkx5ajN1em1GUmZKUjFJQmRHNkNRbUh5U1VKWXo0ZmdjR1hvMHhZcWoxTXRHOEVDNDJJQlpKCmI2bzVEN3hqZ0lGZFR5SzJtaDNGaU0zYjhRckhGK0lSdmVJOWpxWE9OcXIwanlyekgwdVFPTElvbTVNV1cwVDYKQmJZR2hWNERvcjMzODg5dG5FRThyNzduQkE1NHlnN3hyLzV4VVk0VlpBdnJjNHJyclRKVWV2RlhrSWNYaVJ3agpYMmMxTHhSWTdqWXkrSS9GTnNwbVQ1OTBiZzNMVW13eTBSaTBWTU1Sbnk4b2tsczdqUHRPZjY2RFdSUENwcW1RCm14SjhyS2FSRS9LdEtaWFdSNENSdldIOVBPa2lUODRhSlpoMUlSK2pjM00rNFdIR05ITkRiNEt1U1V2RmJiWVcKQ0xoQkVnRlB4MVpjdmxSN0Jmc3F1SEVSYk14ZkRPbG1YOThONzJmalpqTERuRm5ZUU13SkJnbEZoakg4UkhkYQpiT0hZRElsK0U3ME5vblNSdWhxRFBVWjZFeUZ4RzNRdkRFc21tTXV1cjhzS2JUNldaV0JybWdENE9LTkdMZnpqCnl3N2pXcEI0eEYrTkV3Y2VsNDNWZnNjTzBnTTE5dm1JU0k4ekZhSkdQNmR6RzFnMGNncGJ3NU9DdDMwL3VNOHoKVExrVmUwZ1BJYlVrNk90emVOMUQ1cWJVME5FMWNQcWRKczh4ZjBiQ3lXTklEOHlJdzl1a25FY3E5Vmd0VE80NQp2MzdvL1VLOWgrbFk4R0dLUlV0Y3phN3IzbTFydG5WOG4wbGVGR2NNZnJaYUZEdG9ucEFXRFVHcGxXQkZqTDJvCnNIM2Q4KzJNcmpoR0t0NkhjK09NVlhuUXQ0eEFJZmVGM2JuQldoYnNPcDliM2E5MjRqVkEyOVNGZHJRRnVJWmYKSHZFMjcwelRrN3pUSDd0bXdlSTdZOVN6VWZjTE5tUjlPTWxPMnVHN2E5TEZMM0NJcFVheDd4WityU2lhSm56UApydTNrd0tzRFdvdFdOYTdwdFdDbmgxWERJaE5iR3drTXZ0bWxyUm53cnFhcWlpS0hSREU2U3BNSjFKM3pWZHl2CnFjY1c3KzBmdGgyVDlXZnpGVHJKYWxrbTBObjUzNXRoSXBOMEhlSXNWaVFhSUowRnkvN01SczBlNUJvQVA1RUoKU1VhVExIZThtK0Vuckl2UHI0dHNkNHlDU0pvaHVSeWZ2QU9EVkppQUp3Z0tOUkNob052dzU5UWpIK3l1MmlmWQozL1RwLzE3VVZBZGh4MG9wQkFwQW45VXEvclUyNUxkS1lFYjFLTkQ3NGg5WU1WdHArUnhKQ1dVQ0NwNUljcHorCjByRjhZam91cEFwOGNnMHFsK08vK2N5UVIrQWRjRFdrRjB2MndFK1ZXVUI4bzhqbm1DaTBYaW9mdzlNeTNnakIKbmd6RjJZV0NUTjVYRFBZL1VwZUFVWkVKSHZudzR1VnZkNkdyWitWQzVGMkVlK0VwcXh5MkI0Z3E4TWN4MVFIRQpVRTZISHZYVFJoVVFwVDN6b0RBQ1pQR1pkVzFTSkNlRm51bXJsYzZXVXNXK2p6Q214QXJDTGMxT3gzMkpUMVJwCjNKbkt0QjhyWUt6VHFzSmMrNlhMajZUalpMRXZQWi9CaWpXckVveUFJekRENmV3K29hZ2oya25zSTVTNGZXYzAKLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K" 11 | } 12 | 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /credentialsexit/BridgeCredentialExit/src/com/ibm/bridgecredentialexit/ProtocolBridgeCredsNoPwd.json: -------------------------------------------------------------------------------- 1 | { 2 | "servers": [ 3 | { 4 | "serverHostName":"nopassword", 5 | "transferRequesterId":"mquserid", 6 | "serverAssocName": "mftassoc1", 7 | "serverType": "SFTP", 8 | "serverUserId": "atsftp", 9 | "serverHostKey": "ZTQ6Zjk6MzQ6NGU6ZDk6Nzk6NWY6N2E6ZjU6MGQ6MjA6OGU6OGI6Y2U6NjI6MTE=", 10 | "serverPrivateKey": "Iy0tLS0tQkVHSU4gUlNBIFBSSVZBVEUgS0VZLS0tLS0KUHJvYy1UeXBlOiA0LEVOQ1JZUFRFRApERUstSW5mbzogQUVTLTEyOC1DQkMsNjU1NUQyMkQ3MkJEOEUxQ0ZEOEEyRkIzQ0M3RjFEQ0IKCkFUNGVEZ0t2V252V1RpNXUyMVdGZXFFZnRTQWNyL3lIM2hZbXZHcGxIc3ZJb2FhVUhVRUd6MmVNNmNxK3NGVHcKZlNmSnJheFFQMnBvWnJ1TVIvcDQzRjc0QkhNUEhkUFVSTWVsa1FjdDlTazZSYkxiLytlb3A0aDBuaHZleW10TgpZS2cyeFA3Rmp4NUhFV01GV3pJMWVQZEh4M2FMRitvclZRZlVLZ2M2VFdBaEUwbkFJbEM0OENpRzFZOS9HNFpuCkdyakVJVVdhbGlmSlMwTkJoUUltbmpKZFpGZ2hNalMwQU1hYkI1alVJaWkvSWx6MGM5YzBEM0lFRlBVTVpPZkIKRlh6UUc0RXBiTlJpWU9kNFN6Wk44dGZUNTBaeXNwQWVyZFE4eEYzbkhMZ0pCc0ErZnduUTV2cE51U1hkMTE2VApYYm1GRWtNTGI3Nkx5ajN1em1GUmZKUjFJQmRHNkNRbUh5U1VKWXo0ZmdjR1hvMHhZcWoxTXRHOEVDNDJJQlpKCmI2bzVEN3hqZ0lGZFR5SzJtaDNGaU0zYjhRckhGK0lSdmVJOWpxWE9OcXIwanlyekgwdVFPTElvbTVNV1cwVDYKQmJZR2hWNERvcjMzODg5dG5FRThyNzduQkE1NHlnN3hyLzV4VVk0VlpBdnJjNHJyclRKVWV2RlhrSWNYaVJ3agpYMmMxTHhSWTdqWXkrSS9GTnNwbVQ1OTBiZzNMVW13eTBSaTBWTU1Sbnk4b2tsczdqUHRPZjY2RFdSUENwcW1RCm14SjhyS2FSRS9LdEtaWFdSNENSdldIOVBPa2lUODRhSlpoMUlSK2pjM00rNFdIR05ITkRiNEt1U1V2RmJiWVcKQ0xoQkVnRlB4MVpjdmxSN0Jmc3F1SEVSYk14ZkRPbG1YOThONzJmalpqTERuRm5ZUU13SkJnbEZoakg4UkhkYQpiT0hZRElsK0U3ME5vblNSdWhxRFBVWjZFeUZ4RzNRdkRFc21tTXV1cjhzS2JUNldaV0JybWdENE9LTkdMZnpqCnl3N2pXcEI0eEYrTkV3Y2VsNDNWZnNjTzBnTTE5dm1JU0k4ekZhSkdQNmR6RzFnMGNncGJ3NU9DdDMwL3VNOHoKVExrVmUwZ1BJYlVrNk90emVOMUQ1cWJVME5FMWNQcWRKczh4ZjBiQ3lXTklEOHlJdzl1a25FY3E5Vmd0VE80NQp2MzdvL1VLOWgrbFk4R0dLUlV0Y3phN3IzbTFydG5WOG4wbGVGR2NNZnJaYUZEdG9ucEFXRFVHcGxXQkZqTDJvCnNIM2Q4KzJNcmpoR0t0NkhjK09NVlhuUXQ0eEFJZmVGM2JuQldoYnNPcDliM2E5MjRqVkEyOVNGZHJRRnVJWmYKSHZFMjcwelRrN3pUSDd0bXdlSTdZOVN6VWZjTE5tUjlPTWxPMnVHN2E5TEZMM0NJcFVheDd4WityU2lhSm56UApydTNrd0tzRFdvdFdOYTdwdFdDbmgxWERJaE5iR3drTXZ0bWxyUm53cnFhcWlpS0hSREU2U3BNSjFKM3pWZHl2CnFjY1c3KzBmdGgyVDlXZnpGVHJKYWxrbTBObjUzNXRoSXBOMEhlSXNWaVFhSUowRnkvN01SczBlNUJvQVA1RUoKU1VhVExIZThtK0Vuckl2UHI0dHNkNHlDU0pvaHVSeWZ2QU9EVkppQUp3Z0tOUkNob052dzU5UWpIK3l1MmlmWQozL1RwLzE3VVZBZGh4MG9wQkFwQW45VXEvclUyNUxkS1lFYjFLTkQ3NGg5WU1WdHArUnhKQ1dVQ0NwNUljcHorCjByRjhZam91cEFwOGNnMHFsK08vK2N5UVIrQWRjRFdrRjB2MndFK1ZXVUI4bzhqbm1DaTBYaW9mdzlNeTNnakIKbmd6RjJZV0NUTjVYRFBZL1VwZUFVWkVKSHZudzR1VnZkNkdyWitWQzVGMkVlK0VwcXh5MkI0Z3E4TWN4MVFIRQpVRTZISHZYVFJoVVFwVDN6b0RBQ1pQR1pkVzFTSkNlRm51bXJsYzZXVXNXK2p6Q214QXJDTGMxT3gzMkpUMVJwCjNKbkt0QjhyWUt6VHFzSmMrNlhMajZUalpMRXZQWi9CaWpXckVveUFJekRENmV3K29hZ2oya25zSTVTNGZXYzAKLS0tLS1FTkQgUlNBIFBSSVZBVEUgS0VZLS0tLS0K" 11 | } 12 | 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /external-how-to-docs/agentdeployment.md: -------------------------------------------------------------------------------- 1 | # Agent deployment file 2 | 3 | A deployment YAML is required to deploy an agent in OpenShift Container Platfrom. The following section describes the required deployment attributes and sample values. 4 | 5 | ``` 6 | kind: Deployment 7 | apiVersion: apps/v1 8 | metadata: 9 | name: ibm-mq-managed-file-transfer-bridgeagent <- Name of the container 10 | namespace: ibmmqmft <- Project namespace 11 | spec: 12 | replicas: 1 <- Number of replicas. The supported maximum value is 1 13 | selector: 14 | matchLabels: 15 | app: ibm-mq-managed-file-transfer-bridgeagent 16 | template: 17 | metadata: 18 | labels: 19 | app: ibm-mq-managed-file-transfer-bridgeagent 20 | deploymentconfig: ibm-mq-managed-file-transfer-bridgeagent 21 | 22 | spec: 23 | volumes: 24 | - name: mqmft-agent-config-map <- Name of volume where agent definition attributes in JSON format are defined 25 | configMap: 26 | name: mqmft-agent-config <- Name of the configMap containing the definitions of an agent 27 | 28 | - name: mqmft-protocol-bridge-cred-map 29 | configMap: 30 | name: pba-custom-cred-map <- Name of the ConfigMap containing the credential information required for connecting a SFTP/FTP/FTPS server 31 | 32 | - name: mqmft-nfs-config 33 | persistentVolumeClaim: 34 | claimName: nfs-mft-pvc - <- Persistent volume that will contain agent configuration and logs 35 | 36 | containers: 37 | - resources: {} 38 | readinessProbe: 39 | exec: 40 | command: 41 | - agentready <- Readiness probe that monitors agent readiness 42 | initialDelaySeconds: 15 43 | timeoutSeconds: 3 44 | periodSeconds: 30 45 | successThreshold: 1 46 | failureThreshold: 3 47 | 48 | terminationMessagePath: /dev/termination-log 49 | 50 | name: ibm-mq-managed-file-transfer-bridgeagent <- Name of the container 51 | livenessProbe: 52 | exec: 53 | command: 54 | - agentalive <- Liveness probe that monitors agent health 55 | initialDelaySeconds: 90 56 | timeoutSeconds: 5 57 | periodSeconds: 90 58 | successThreshold: 1 59 | failureThreshold: 3 60 | 61 | env: 62 | - name: MFT_AGENT_NAME <- Required. Environment variable containing the name of the agent to deploy 63 | value: BRIDGE 64 | - name: LICENSE <- Required. Environment variable for accepting license to use an agent 65 | value: accept 66 | - name: BFG_DATA <- Optional. Path where configuration and log files are created. 67 | value=/mnt/mftdata 68 | - name: MFT_AGENT_CONFIG_FILE <- Name of environment variable containing the name of the JSON file containing information required to cofingure an agent. The JSON file must reside in a ConfigMap 69 | value: /mqmftcfg/agentconfig/mqmftcfg.json <- Path of the JSON file containing agent definitions 70 | - name: MFT_BRIDGE_CREDENTIAL_FILE <- Required for BRIDGE agent only. Name of the environment variable that points to path of a file containing credential information for connecting to SFTP/FTP/FTPS file server. The file can reside either in a configMap or secret. 71 | value: /mqmftbridgecred/agentcreds/ProtocolBridgeCredentials.prop <- Path of the file containing bridge credential information 72 | - name: MFT_LOG_LEVEL Optional. Controls the amount of debug information displayed while deploying the container. Default is "info" 73 | value="verbose" 74 | - name: MFT_TRACE_COMMAND Optional. Enable tracing of MFT commands. Default is "no". 75 | value="yes" 76 | - name: MFT_TRACE_COMMAND_PATH Required if MFT_TRACE_COMMAND is set to yes. The path where trace files will be created. 77 | value: /mnt/mftdata 78 | - name: MFT_AGENT_START_WAIT_TIME Optional. Time in seconds to for container to wait for agent to start. Default is 10 seconds. If the agent does not start in the specified time, the container ends. 79 | value=15 80 | imagePullPolicy: Always 81 | 82 | volumeMounts: 83 | - name: mqmft-agent-config-map <- Mount path where JSON file containing information required to confiure an agent resides 84 | mountPath: /mqmftcfg/agentconfig 85 | 86 | - name: mqmft-protocol-bridge-cred-map <- Mount path where custom credential file for a BRIDGE agent resides. 87 | mountPath: /mqmftbridgecred/agentcreds 88 | 89 | - name: mqmft-nfs-config <-Optional: Mount path where configuration and log files of an agent would be created 90 | mountPath: /mnt/mftdata 91 | subPath: mftdata 92 | 93 | terminationMessagePolicy: File 94 | 95 | image: >- 96 | icr.io/ibm-messaging/mqmft:latest <- URI from where an agent container image will be pulled for deployment 97 | ``` 98 | -------------------------------------------------------------------------------- /external-how-to-docs/build.md: -------------------------------------------------------------------------------- 1 | # Building a container image 2 | 3 | ## Prerequisites 4 | 5 | You need to have the following tools installed: 6 | 7 | * [Docker](https://www.docker.com/) V17.06.1 or later, or [Podman](https://podman.io) V1.0 or later 8 | 9 | If you are working in the Windows Subsystem for Linux, follow [this guide by Microsoft to set up Docker](https://blogs.msdn.microsoft.com/commandline/2017/12/08/cross-post-wsl-interoperability-with-docker/) first. 10 | 11 | You will also need a [Red Hat Account](https://access.redhat.com) to be able to access the Red Hat Registry. 12 | 13 | ## Building your MFT container image 14 | 15 | This procedure works for building the MQ Managed File Transfer Redistributable package on `amd64` architectures. 16 | 17 | 1. Clone the GitHub repository to local directory. 18 | 2. Login to the Red Hat Registry: `podman login registry.redhat.io` using your Customer Portal credentials. 19 | 3. Navigate to directory where `Dockerfile-agent` is located. 20 | 4. Download **9.4.1.0-IBM-MQFA-Redist-LinuxX64.tar.gz** or higher from [IBM Fixcentral](https://www.ibm.com/support/fixcentral/) into the current directory. 21 | **Note:** The redistributable MFT package must be present in same path as the **Dockerfile-agent** file. 22 | 5. Unpack the **9.4.1.0-IBM-MQFA-Redist-LinuxX64.tar.gz** to a temporay directory. Copy com.ibm.wmqfte.com.ibm.wmqfte.exitroutines.api.jar to credentialsexit/BridgeCredentialExit/thirdparty directory. 23 | 6. Download json-20240303.jar file from [Maven Repository](https://mvnrepository.com/artifact/org.json/json/20240303) and copy to credentialsexit/BridgeCredentialExit/thirdparty directory. 24 | 7. Run the following command to build container image 25 | 26 | `podman build -f Dockerfile-agent -t mqmft:9.4.1.0 --build-arg ARG_MQMFT_REDIST_FILE=9.4.1.0-IBM-MQFA-Redist-LinuxX64.tar.gz .` 27 | 28 | You can replace the `9.4.1.0-IBM-MQFA-Redist-LinuxX64.tar.gz` with the version of the redistributable package of your choice. 29 | 30 | ## Installed components 31 | 32 | This image includes the following components 33 | 1. MQ Managed File Transfer Agent - Core MFT product. 34 | 2. IBM Java Runtime Environment - IBM JRE. 35 | 3. json-20240205.jar - Third party JSON parse. 36 | 4. Custom Protocol Bridge Credential Exit bridgecredentialexit.jar 37 | 5. mqfts - A command line utility to parse and display contents of capture0.log file. -------------------------------------------------------------------------------- /external-how-to-docs/custompbacred.md: -------------------------------------------------------------------------------- 1 | # Protocol Bridge Credential File. 2 | A bridge agent requires additional information, like the user id and password to connect to external FTP/FTPS/SFTP servers. This information must be provided as key value pairs in a file as described below. The file must be available on a mount point and name of the file is provided as value of `protocolBridgeCredentialConfiguration` attribute in agent's JSON configuration file. For example `"protocolBridgeCredentialConfiguration" : "/mqmftbridgecred/agentcreds/ProtocolBridgeCredentials.prop"`. 3 | 4 | A configMap or a secret can also be used when running on OpenShift Container Platform. 5 | 6 | The credential information can be specified in one of the following two formats. 7 | 8 | ### Key value pair of Hostname-credentials 9 | 10 | `=!!` 11 | 12 | Where 13 | - **hostName** - Host name or IP address of the SFTP/FTP/FTPS server. 14 | - **User ID** - User id for connecting to the SFTP/FTP/FTPS server. 15 | - **Type** - Type of password - plain text or Base64 encoded 16 | 17 | 0 - Plain text password 18 | 19 | 1 - Base64 encoded password. 20 | 21 | - **Password** - Password of the user for connecting to the SFTP/FTP server. 22 | 23 | Example: 24 | 25 | Specify credentials in a file: 26 | 27 | sftp.server.com=sftpuid!0!SftpPassw0rd 28 | 29 | Specify confidentials as a OpenShift ConfigMap 30 | ``` 31 | kind: ConfigMap 32 | apiVersion: v1 33 | metadata: 34 | name: pba-custom-cred-map 35 | namespace: ibmmqmft 36 | data: 37 | ProtocolBridgeCredentials.prop: sftp.server.com=sftpuid!0!SftpPassw0rd 38 | ``` 39 | 40 | ### Supplying attributes as a JSON object. 41 | Parameters required by ProtocolBridgeAgent for connecting to SFTP server must be supplied through a JSON object. The following are the supported attributes. 42 | 43 | - **serverHostName** - Host name or the IP address of the file server. 44 | - **transferRequesterId** - User Id to match with incoming transfer requests source agent. Transfer requests that don't match the user Id specified will be rejected by the destinatio agent. Please note that in an OpenShift Cluster, agent container may running under a dynamically created user. Hence you may specify '*' to match all user Ids. 45 | - **serverType** - Type of the file server. SFTP and FTP are the supported values. Default is FTP. 46 | - **serverAssocName** - Name to associate. 47 | - **serverUserId** - User Id for connecting to SFTP file server. 48 | - **serverHostKey** - Host key required for connecting to SFTP file server. Must be in Base64 encoded format. 49 | - **serverPrivateKey** - Private key required for connecting to SFTP file server. Must be in Base64 encoded format. 50 | - **serverPassword** - Password for the private key. 51 | 52 | An example configmap: 53 | 54 | ``` 55 | kind: ConfigMap 56 | apiVersion: v1 57 | metadata: 58 | name: pba-custom-cred-map 59 | data: 60 | ProtocolBridgeCredentials.prop: { 61 | "servers": [ 62 | { 63 | "serverHostName":"sftp.host.com", 64 | "transferRequesterId":"mquserid", 65 | "serverType": "SFTP", 66 | "serverUserId": "sftpuserid", 67 | "serverAssocName": "", 68 | "serverHostKey": "", 69 | "serverPassword": "", 70 | "serverPrivateKey": "" 71 | } 72 | ] 73 | } 74 | ``` 75 | -------------------------------------------------------------------------------- /external-how-to-docs/images/IBM Cloud Bucket details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/IBM Cloud Bucket details.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect1.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect10.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect11.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect2.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect3.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect4.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect5.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect6.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect7.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect8.png -------------------------------------------------------------------------------- /external-how-to-docs/images/connect9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-messaging/mq-container-mft/3d7fa11aac28ded7fa5b2a12c2cc892bf4b3fc9c/external-how-to-docs/images/connect9.png -------------------------------------------------------------------------------- /external-how-to-docs/run-with-podman/bridgeagentconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "waitTimeToStart": 20, 3 | "coordinationQMgr": { 4 | "name": "MFTQM", 5 | "host": "172.17.0.1", 6 | "port": 1414, 7 | "channel": "QS_SVRCONN", 8 | "additionalProperties": {}, 9 | "qmgrCredentials": { 10 | "mqUserId": "app", 11 | "mqPassword": "passw0rd" 12 | } 13 | }, 14 | "commandQMgr": { 15 | "name": "MFTQM", 16 | "host": "172.17.0.1", 17 | "port": 1414, 18 | "channel": "QS_SVRCONN", 19 | "additionalProperties": {}, 20 | "qmgrCredentials": { 21 | "mqUserId": "app", 22 | "mqPassword": "passw0rd" 23 | } 24 | }, 25 | "agents": [ 26 | { 27 | "name": "BRIDGE", 28 | "type": "BRIDGE", 29 | "deleteOnTermination": true, 30 | "cleanOnStart": "all", 31 | "qmgrName": "MFTQM", 32 | "qmgrHost": "172.17.0.1", 33 | "qmgrPort": 1414, 34 | "qmgrChannel": "QS_SVRCONN", 35 | "defaultServer": "172.17.0.3", 36 | "maxActiveDestinationTransfers": 25, 37 | "failTransferWhenCapacityReached": true, 38 | "protocolServers": [ 39 | { 40 | "name": "172.17.0.3", 41 | "type": "SFTP", 42 | "host": "172.17.0.3", 43 | "port": 22, 44 | "platform": "unix", 45 | "timeZone": "Europe/London", 46 | "locale": "en_GB", 47 | "fileEncoding": "UTF-8", 48 | "listFormat": "unix", 49 | "limitedWrite": false, 50 | "maxListFileNames": 100, 51 | "maxListDirectoryLevels": 10, 52 | "maxSessions": 60, 53 | "socketTimeout": 30, 54 | "maxActiveDestinationTransfers": 25, 55 | "passiveMode": "true" 56 | } 57 | ], 58 | "additionalProperties": { 59 | "logCapture": true, 60 | "enableQueueInputOutput": false, 61 | "agentLog": "on", 62 | "protocolBridgeCredentialConfiguration": "/mnt/credentials/bridgeagentcrede.json" 63 | }, 64 | "qmgrCredentials": { 65 | "mqUserId": "app", 66 | "mqPassword": "passw0rd" 67 | } 68 | } 69 | ] 70 | } -------------------------------------------------------------------------------- /external-how-to-docs/run-with-podman/bridgeagentcrede.json: -------------------------------------------------------------------------------- 1 | { 2 | "servers": [ 3 | { 4 | "serverHostName": "172.17.0.3", 5 | "transferRequesterId": "*", 6 | "serverType": "SFTP", 7 | "serverUserId": "sftpuser", 8 | "serverAssocName": "mftassoc1", 9 | "serverHostKey": "Base64 encoded host key", 10 | "serverPrivateKey": "Base64 server private key", 11 | "serverPassword": "Password for the private key" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /external-how-to-docs/run-with-podman/run-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # © Copyright IBM Corporation 2024 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set +ex 18 | 19 | # This is a simple shell script to setup MFT agents - one standard and a 20 | # bridge agent. The commands in the shell script must be run manually in 21 | # the sequence there given below. 22 | 23 | # The script uses a bunch of json files and a shell script. All files must 24 | # exist in the same directory as this script file. 25 | # 26 | # The value for "qmgrHost" key in sourceagentconfig.json and bridgeagentconfig.json 27 | # file must be set to the host name or IP address of the machine where your 28 | # queue manager is running. This script deploys an instance of the queue manager 29 | # container on the same machine as agents. 30 | # 31 | # The values in the bridgeagentcrede.json file must be updated to point to your 32 | # sftp server. The values for "serverHostKey" and "serverPrivateKey" keys must be 33 | # base64 encoded, otherwise bridge agent will fail to connect to SFTP server. 34 | 35 | 36 | # Get MQ images first. 37 | podman pull icr.io/ibm-messaging/mq:latest 38 | 39 | # Get MFT container image 40 | podman pull icr.io/ibm-messaging/mqmft:latest 41 | 42 | # Stop if queue manager container is already running 43 | podman stop mftqm 44 | # Delete container 45 | podman rm mftqm 46 | 47 | # Stop if MFT srcagent container is running 48 | podman stop srcagent 49 | # Delete container 50 | podman rm srcagent 51 | # Stop if MFT srcagent container is running 52 | podman stop bridgeagent 53 | # Delete container 54 | podman rm bridgeagent 55 | 56 | # Delete if secrets already exist 57 | podman secret rm mqAdminPassword 58 | podman secret rm mqAppPassword 59 | 60 | # Create podman secret for MQ Container. 61 | printf "passw0rd" | podman secret create mqAdminPassword - 62 | printf "passw0rd" | podman secret create mqAppPassword - 63 | 64 | # Start the MQ Container with container name mftqm 65 | podman run --secret mqAdminPassword,type=mount,mode=0777 --secret mqAppPassword,type=mount,mode=0777 --env LICENSE=accept --env MQ_QMGR_NAME=MFTQM --publish 1414:1414 --publish 9443:9443 --detach --name mftqm icr.io/ibm-messaging/mq:latest 66 | 67 | # Copy queue manager configuration file for MFT and execute it to create MFT configuration. 68 | # You may have do chmod 777 ./qmconfig.mqsc so that other users are able to execute inside the container 69 | podman cp ./qmconfig.mqsc mftqm:/run 70 | # Copy a shell script containing commands to setup authorities on queue manager objects 71 | # You may have do chmod 777 ./setauth.sh so that other users are able to execute inside the container 72 | podman cp ./setauth.sh mftqm:/run 73 | 74 | # Create objects required for MFT. 75 | podman exec -it mftqm /bin/bash -c "runmqsc MFTQM < /run/qmconfig.mqsc" 76 | # Set authorities on qm objects so that agent running MFT Container can connect to queue manager 77 | podman exec -it mftqm /bin/bash -c "/run/setauth.sh" 78 | 79 | # Run a standard agent. The agent configuration JSON file in the current directory is mounted into the container. 80 | podman run --volume "${PWD}":/mftagentcfg/agentcfg --env BFG_JVM_PROPERTIES="-Djava.util.prefs.systemRoot=/jprefs/.java/.systemPrefs -Djava.util.prefs.userRoot=/jprefs/.java/.userPrefs" --env LICENSE=accept --env MFT_AGENT_NAME=SRC --env MFT_AGENT_CONFIG_FILE=/mftagentcfg/agentcfg/sourceagentconfig.json --detach --name srcagent icr.io/ibm-messaging/mqmft:latest 81 | 82 | # Run a bridge agent. The agent configuration JSON file and credential files in the current directory is mounted into the container. 83 | podman run --volume "${PWD}":/mftagentcfg/agentcfg --volume "${PWD}":/mnt/credentials --env BFG_JVM_PROPERTIES="-Djava.util.prefs.systemRoot=/jprefs/.java/.systemPrefs -Djava.util.prefs.userRoot=/jprefs/.java/.userPrefs" --env LICENSE=accept --env MFT_AGENT_NAME=BRIDGE --env MFT_AGENT_CONFIG_FILE=/mftagentcfg/agentcfg/bridgeagentconfig.json --detach --name bridgeagent icr.io/ibm-messaging/mqmft:latest 84 | 85 | -------------------------------------------------------------------------------- /external-how-to-docs/run-with-podman/setauth.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # © Copyright IBM Corporation 2024 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set +ex 18 | 19 | setmqaut -m MFTQM -n SYSTEM.FTE -t q -p app +all 20 | setmqaut -m MFTQM -n SYSTEM.FTE -t topic -p app +all 21 | setmqaut -m MFTQM -n SYSTEM.DEFAULT.MODEL.QUEUE -t q -p app +all 22 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHADM1.SRC -t q -p app +all 23 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHAGT1.SRC -t q -p app +all 24 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHMON1.SRC -t q -p app +all 25 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHOPS1.SRC -t q -p app +all 26 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHSCH1.SRC -t q -p app +all 27 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHTRN1.SRC -t q -p app +all 28 | setmqaut -m MFTQM -n SYSTEM.FTE.COMMAND.SRC -t q -p app +all 29 | setmqaut -m MFTQM -n SYSTEM.FTE.DATA.SRC -t q -p app +all 30 | setmqaut -m MFTQM -n SYSTEM.FTE.EVENT.SRC -t q -p app +all 31 | setmqaut -m MFTQM -n SYSTEM.FTE.REPLY.SRC -t q -p app +all 32 | setmqaut -m MFTQM -n SYSTEM.FTE.STATE.SRC -t q -p app +all 33 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHADM1.BRIDGE -t q -p app +all 34 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHAGT1.BRIDGE -t q -p app +all 35 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHMON1.BRIDGE -t q -p app +all 36 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHOPS1.BRIDGE -t q -p app +all 37 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHSCH1.BRIDGE -t q -p app +all 38 | setmqaut -m MFTQM -n SYSTEM.FTE.AUTHTRN1.BRIDGE -t q -p app +all 39 | setmqaut -m MFTQM -n SYSTEM.FTE.COMMAND.BRIDGE -t q -p app +all 40 | setmqaut -m MFTQM -n SYSTEM.FTE.DATA.BRIDGE -t q -p app +all 41 | setmqaut -m MFTQM -n SYSTEM.FTE.EVENT.BRIDGE -t q -p app +all 42 | setmqaut -m MFTQM -n SYSTEM.FTE.REPLY.BRIDGE -t q -p app +all 43 | setmqaut -m MFTQM -n SYSTEM.FTE.STATE.BRIDGE -t q -p app +all 44 | -------------------------------------------------------------------------------- /external-how-to-docs/run-with-podman/sourceagentconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "waitTimeToStart": 20, 3 | "coordinationQMgr": { 4 | "name": "MFTQM", 5 | "host": "172.17.0.1", 6 | "port": 1414, 7 | "channel": "QS_SVRCONN", 8 | "additionalProperties": {}, 9 | "qmgrCredentials": { 10 | "mqUserId": "app", 11 | "mqPassword": "passw0rd" 12 | } 13 | }, 14 | "commandQMgr": { 15 | "name": "MFTQM", 16 | "host": "172.17.0.1", 17 | "port": 1414, 18 | "channel": "QS_SVRCONN", 19 | "additionalProperties": {}, 20 | "qmgrCredentials": { 21 | "mqUserId": "app", 22 | "mqPassword": "passw0rd" 23 | } 24 | }, 25 | "agents": [ 26 | { 27 | "name": "SRC", 28 | "deleteOnTermination": "true", 29 | "type": "STANDARD", 30 | "qmgrName": "MFTQM", 31 | "qmgrHost": "172.17.0.1", 32 | "qmgrPort": 1414, 33 | "qmgrChannel": "QS_SVRCONN", 34 | "qmgrCredentials": { 35 | "mqUserId": "app", 36 | "mqPassword": "passw0rd" 37 | }, 38 | "additionalProperties": { 39 | "enableQueueInputOutput": "true", 40 | "logCapture": "true" 41 | } 42 | } 43 | ] 44 | } -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/agentconfig.yaml: -------------------------------------------------------------------------------- 1 | kind: ConfigMap 2 | apiVersion: v1 3 | metadata: 4 | name: mqmft-agent-config 5 | namespace: ibmmqmft 6 | 7 | data: 8 | mqmftcfg.json: > 9 | {"waitTimeToStart":20,"coordinationQMgr":{"name":"SECUREQM","host":"10.254.16.17","port":1414,"channel":"QS_SVRCONN","additionalProperties":{}},"commandQMgr":{"name":"SECUREQM","host":"10.254.16.17","port":1414,"channel":"QS_SVRCONN","additionalProperties": {}},"agents":[{"name":"SRCSTD","deleteOnTermination":"true","type":"STANDARD","qmgrName":"QUICKSTART","qmgrHost":"10.254.16.19","qmgrPort":1414,"qmgrChannel":"QS_SVRCONN","additionalProperties":{"enableQueueInputOutput":"true", "trace":"all","logCapture":"true"}} ,{"name":"BRIDGE","type":"BRIDGE", "deleteOnTermination":"true","cleanOnStart":"all", "qmgrName":"QUICKSTART","qmgrHost":"10.254.16.19","qmgrPort":1414,"qmgrChannel":"QS_SVRCONN","protocolBridge": {"serverType":"SFTP","serverHost":"10.17.68.52","serverPlatform":"UNIX","serverLocale":"en-GB","listFormat"="UNIX", "limitedWrite"="false", "serverFileEncoding"="UTF8", "passiveMode"="true", "protocolBridgeProperties" : {}}, "additionalProperties":{"logCapture":"true","enableQueueInputOutput":"false", "protocolBridgeCredentialConfiguration":"/mnt/credentials/ProtocolBridgeCredentials.prop"}}]} 10 | -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/bridge-agent-config.yaml: -------------------------------------------------------------------------------- 1 | kind: ConfigMap 2 | apiVersion: v1 3 | metadata: 4 | name: pba-config 5 | namespace: ibm-mqmft 6 | data: 7 | bridge.json: > 8 | {"waitTimeToStart":20,"coordinationQMgr":{"name":"MFTQM","host":"mftqm-ibm-mq.ibm-mqmft.svc.cluster.local","port":1414,"channel":"QS_SVRCONN","additionalProperties":{}},"commandQMgr":{"name":"MFTQM","host":"mftqm-ibm-mq.ibm-mqmft.svc.cluster.local","port":1414,"channel":"QS_SVRCONN","additionalProperties":{}},"agents":[{"name":"BRIDGE","type":"BRIDGE","deleteOnTermination":true,"cleanOnStart":"all","qmgrName":"MFTQM","qmgrHost":"mftqm-ibm-mq.ibm-mqmft.svc.cluster.local","qmgrPort":1414,"qmgrChannel":"QS_SVRCONN", "defaultServer":"9.20.120.105","maxActiveDestinationTransfers":25,"failTransferWhenCapacityReached":true,"protocolServers":[{"name":"9.20.120.105","type":"SFTP","host":"9.20.120.105","port":22,"platform":"unix","timeZone":"Europe/London","locale":"en_GB","fileEncoding":"UTF-8","listFormat":"unix","limitedWrite":false,"maxListFileNames":100,"maxListDirectoryLevels":10,"maxSessions":60,"socketTimeout":30,"maxActiveDestinationTransfers":25,"passiveMode":"true"}],"additionalProperties":{"logCapture":true,"enableQueueInputOutput":false,"agentLog":"on","protocolBridgeCredentialConfiguration":"/mnt/credentials/ProtocolBridgeCredentials.prop"}}]} -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/dest-agent-config.yaml: -------------------------------------------------------------------------------- 1 | kind: ConfigMap 2 | apiVersion: v1 3 | metadata: 4 | name: dest-agent-config 5 | namespace: ibm-mqmft 6 | data: 7 | destagent.json: > 8 | "{"waitTimeToStart":20,"coordinationQMgr":{"name":"MFTQM","host":"mftqm-ibm-mq.ibm-mqmft.svc.cluster.local","port":1414,"channel":"QS_SVRCONN","additionalProperties":{}},"commandQMgr":{"name":"MFTQM","host":"mftqm-ibm-mq.ibm-mqmft.svc.cluster.local","port":1414,"channel":"QS_SVRCONN","additionalProperties":{}},"agents":[{"name":"DEST","deleteOnTermination":"true","type":"STANDARD","qmgrName":"MFTQM","qmgrHost":"mftqm-ibm-mq.ibm-mqmft.svc.cluster.local","qmgrPort":1414,"qmgrChannel":"QS_SVRCONN","additionalProperties":{"enableQueueInputOutput":"true","trace":"all","logCapture":"true"}}]}" 9 | -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/dest-agent-deployment.yaml: -------------------------------------------------------------------------------- 1 | kind: Deployment 2 | apiVersion: apps/v1 3 | metadata: 4 | name: dest-agent 5 | namespace: ibm-mqmft 6 | spec: 7 | replicas: 1 8 | selector: 9 | matchLabels: 10 | app: dest-agent 11 | template: 12 | metadata: 13 | labels: 14 | app: dest-agent 15 | deploymentconfig: dest-agent 16 | spec: 17 | volumes: 18 | - name: dest-agent-config-map 19 | configMap: 20 | name: dest-agent-config 21 | defaultMode: 420 22 | - name: dest-volume 23 | persistentVolumeClaim: 24 | claimName: pvc-dest 25 | containers: 26 | - resources: {} 27 | readinessProbe: 28 | exec: 29 | command: 30 | - agentready 31 | initialDelaySeconds: 15 32 | timeoutSeconds: 3 33 | periodSeconds: 30 34 | successThreshold: 1 35 | failureThreshold: 3 36 | terminationMessagePath: /mnt/termination-log 37 | name: dest 38 | livenessProbe: 39 | exec: 40 | command: 41 | - agentalive 42 | initialDelaySeconds: 90 43 | timeoutSeconds: 5 44 | periodSeconds: 90 45 | successThreshold: 1 46 | failureThreshold: 3 47 | env: 48 | - name: MFT_AGENT_NAME 49 | value: DEST 50 | - name: LICENSE 51 | value: accept 52 | - name: MFT_AGENT_CONFIG_FILE 53 | value: /mqmftcfg/agentconfig/destagent.json 54 | - name: MFT_MOUNT_PATH 55 | value: /mountpath 56 | - name: MFT_AGENT_DISPLAY_CAPTURE_LOG 57 | value: "yes" 58 | - name: BFG_JVM_PROPERTIES 59 | value: -Djava.util.prefs.systemRoot=/jprefs/.java/.systemPrefs -Djava.util.prefs.userRoot=/jprefs/.java/.userPrefs 60 | imagePullPolicy: Always 61 | volumeMounts: 62 | - name: dest-agent-config-map 63 | mountPath: /mqmftcfg/agentconfig 64 | - name: dest-volume 65 | mountPath: /mountpath 66 | terminationMessagePolicy: File 67 | image: >- 68 | icr.io/ibm-messaging/mqmft:latest 69 | restartPolicy: Always 70 | terminationGracePeriodSeconds: 60 71 | dnsPolicy: ClusterFirst 72 | securityContext: {} 73 | schedulerName: default-scheduler -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/ocp-clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # © Copyright IBM Corporation 2024 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set +ex 18 | 19 | # This script deploys MFT Agents on a OpenShift Cluster. 20 | 21 | # This script expects: 22 | # 1) oc client is installed on the machine where this script will be executed. 23 | # 2) User has done a oc login with valid credentials. 24 | # 3) MQ Operator 3.2 or latest to be installed ibm-mqmft namespace. 25 | # 4) Namespace ibm-mqmft is created in OpenShift cluster. 26 | # 27 | 28 | # Queue Manager deployment Name 29 | OC_QM_NAME=mftqm 30 | # Bridge Agent deployment name 31 | OC_BRIDGE_AGENT="bridge-agent" 32 | # Source Agent deployment name 33 | OC_SRC_AGENT="source-agent" 34 | # Destination agent deployment name 35 | OC_DEST_AGENT="dest-agent" 36 | # Source agent PVC 37 | PVC_SOURCE="pvc-source" 38 | # Destination agent PVC 39 | PVC_DEST="pvc-dest" 40 | # Queue manager configMap 41 | QM_CONFIG_MAP=agent-qm-configmap 42 | # Source agent configMap 43 | SOURCE_AGENT_CONFIG_MAP=src-agent-config 44 | # Bridge agent configMap 45 | BRIDGE_AGENT_CONFIG_MAP=pba-config 46 | # Bridge agent credentials configMap 47 | BRIDGE_AGENT_CRED_CONFIG_MAP=pba-custom-cred 48 | # Destination agent configMap 49 | DEST_AGENT_CONFIG_MAP=dest-agent-config 50 | 51 | # STEP 1: Switch to ibm-mqmft namespace 52 | ocrc=$(oc project "${OC_NAMESPACE}" > /dev/null 2>&1) 53 | # shellcheck disable=SC2181 54 | if [ $? -gt 0 ] ; then 55 | echo "ibm-mqmft namespace may not exist. Command failed with return code $ocrc Script will end now.$ocrc" 56 | exit 1 57 | fi 58 | 59 | # STEP2: Delete source agent 60 | echo "Deleting agent $OC_SRC_AGENT" 61 | ocrc=$(oc get deployment $OC_SRC_AGENT > /dev/null 2>&1) 62 | # shellcheck disable=SC2181 63 | if [ $? -eq 0 ] ; then 64 | ocrc=$(oc delete deployment $OC_SRC_AGENT > /dev/null 2>&1) 65 | if [ $? -eq 0 ]; then 66 | echo "Agent $OC_SRC_AGENT deleted" 67 | else 68 | echo "An error $ocrc occurred while trying to delete agent $OC_SRC_AGENT" 69 | fi 70 | else 71 | echo "Agent deployment $OC_SRC_AGENT not found." 72 | fi 73 | 74 | # STEP3: Delete destination agent 75 | echo "Deleting agent $OC_DEST_AGENT" 76 | ocrc=$(oc get deployment $OC_DEST_AGENT > /dev/null 2>&1) 77 | # shellcheck disable=SC2181 78 | if [ $? -eq 0 ] ; then 79 | ocrc=$(oc delete deployment $OC_DEST_AGENT > /dev/null 2>&1) 80 | if [ $? -eq 0 ]; then 81 | echo "Agent $OC_DEST_AGENT deleted" 82 | else 83 | echo "An error $ocrc occurred while trying to delete agent $OC_DEST_AGENT" 84 | fi 85 | else 86 | echo "Agent deployment $OC_DEST_AGENT not found." 87 | fi 88 | 89 | # STEP4: Delete bridge agent 90 | echo "Deleting agent $OC_BRIDGE_AGENT" 91 | ocrc=$(oc get deployment $OC_BRIDGE_AGENT > /dev/null 2>&1) 92 | # shellcheck disable=SC2181 93 | if [ $? -eq 0 ] ; then 94 | ocrc=$(oc delete deployment $OC_BRIDGE_AGENT > /dev/null 2>&1) 95 | if [ $? -eq 0 ]; then 96 | echo "Agent $OC_BRIDGE_AGENT deleted" 97 | else 98 | echo "An error $ocrc occurred while trying to delete agent $OC_BRIDGE_AGENT" 99 | fi 100 | else 101 | echo "Agent $OC_BRIDGE_AGENT deployment not found." 102 | fi 103 | 104 | # STEP5: Delete bridge agent configmap 105 | echo "Deleting ConfigMap $BRIDGE_AGENT_CONFIG_MAP" 106 | ocrc=$(oc get configmap $BRIDGE_AGENT_CONFIG_MAP > /dev/null 2>&1) 107 | # shellcheck disable=SC2181 108 | if [ $? -eq 0 ] ; then 109 | ocrc=$(oc delete configmap $BRIDGE_AGENT_CONFIG_MAP > /dev/null 2>&1) 110 | if [ $? -eq 0 ]; then 111 | echo "$BRIDGE_AGENT_CONFIG_MAP deleted" 112 | else 113 | echo "An error $ocrc occurred while trying to delete agent configmap $BRIDGE_AGENT_CONFIG_MAP" 114 | fi 115 | else 116 | echo "Configmap $BRIDGE_AGENT_CONFIG_MAP not found." 117 | fi 118 | 119 | # STEP6: Delete bridge agent credentials configmap 120 | echo "Deleting ConfigMap $BRIDGE_AGENT_CRED_CONFIG_MAP" 121 | ocrc=$(oc get configmap $BRIDGE_AGENT_CRED_CONFIG_MAP > /dev/null 2>&1) 122 | # shellcheck disable=SC2181 123 | if [ $? -eq 0 ] ; then 124 | ocrc=$(oc delete configmap $BRIDGE_AGENT_CRED_CONFIG_MAP > /dev/null 2>&1) 125 | if [ $? -eq 0 ]; then 126 | echo "$BRIDGE_AGENT_CRED_CONFIG_MAP deleted" 127 | else 128 | echo "An error $ocrc occurred while trying to delete agent configmap $BRIDGE_AGENT_CRED_CONFIG_MAP" 129 | fi 130 | else 131 | echo "Configmap $BRIDGE_AGENT_CRED_CONFIG_MAP not found." 132 | fi 133 | 134 | # STEP7: Delete source agent configmap 135 | echo "Deleting ConfigMap $SOURCE_AGENT_CONFIG_MAP" 136 | ocrc=$(oc get configmap $SOURCE_AGENT_CONFIG_MAP > /dev/null 2>&1) 137 | # shellcheck disable=SC2181 138 | if [ $? -eq 0 ] ; then 139 | ocrc=$(oc delete configmap $SOURCE_AGENT_CONFIG_MAP > /dev/null 2>&1) 140 | if [ $? -eq 0 ]; then 141 | echo "$SOURCE_AGENT_CONFIG_MAP deleted" 142 | else 143 | echo "An error $ocrc occurred while trying to delete agent configmap $SOURCE_AGENT_CONFIG_MAP" 144 | fi 145 | else 146 | echo "Configmap $SOURCE_AGENT_CONFIG_MAP not found." 147 | fi 148 | 149 | # STEP8: Delete destination agent configmap 150 | echo "Deleting ConfigMap $DEST_AGENT_CONFIG_MAP" 151 | ocrc=$(oc get configmap $DEST_AGENT_CONFIG_MAP > /dev/null 2>&1) 152 | # shellcheck disable=SC2181 153 | if [ $? -eq 0 ] ; then 154 | ocrc=$(oc delete configmap $DEST_AGENT_CONFIG_MAP > /dev/null 2>&1) 155 | if [ $? -eq 0 ]; then 156 | echo "$DEST_AGENT_CONFIG_MAP deleted" 157 | else 158 | echo "An error $ocrc occurred while trying to delete agent configmap $DEST_AGENT_CONFIG_MAP" 159 | fi 160 | else 161 | echo "Configmap $DEST_AGENT_CONFIG_MAP not found." 162 | fi 163 | 164 | # STEP9: Delete Destination Persistent Volume Claims 165 | echo "Deleting Persistent Volume Claim $PVC_DEST" 166 | ocrc=$(oc get pvc $PVC_DEST > /dev/null 2>&1) 167 | # shellcheck disable=SC2181 168 | if [ $? -eq 0 ] ; then 169 | ocrc=$(oc delete pvc $PVC_DEST > /dev/null 2>&1) 170 | if [ $? -eq 0 ]; then 171 | echo "$PVC_DEST deleted" 172 | else 173 | echo "An error $ocrc occurred while trying to Persistent Volume Claim $PVC_DEST" 174 | fi 175 | else 176 | echo "Persistent Volume Claim $PVC_DEST not found." 177 | fi 178 | 179 | # STEP10: Delete Source Persistent Volume Claims 180 | echo "Deleting Persistent Volume Claim $PVC_SOURCE" 181 | ocrc=$(oc get pvc $PVC_SOURCE > /dev/null 2>&1) 182 | # shellcheck disable=SC2181 183 | if [ $? -eq 0 ] ; then 184 | ocrc=$(oc delete pvc $PVC_SOURCE > /dev/null 2>&1) 185 | if [ $? -eq 0 ]; then 186 | echo "$PVC_SOURCE deleted" 187 | else 188 | echo "An error $ocrc occurred while trying to delete Persistent Volume Claim $PVC_SOURCE" 189 | fi 190 | else 191 | echo "Persistent Volume Claim $PVC_SOURCE not found." 192 | fi 193 | 194 | # STEP11: Delete queue manager configmap 195 | echo "Deleting ConfigMap $QM_CONFIG_MAP" 196 | ocrc=$(oc get configmap $QM_CONFIG_MAP > /dev/null 2>&1) 197 | # shellcheck disable=SC2181 198 | if [ $? -eq 0 ] ; then 199 | ocrc=$(oc delete configmap $QM_CONFIG_MAP > /dev/null 2>&1) 200 | if [ $? -eq 0 ]; then 201 | echo "$QM_CONFIG_MAP deleted" 202 | else 203 | echo "An error $ocrc occurred while trying to delete queue manager configmap $QM_CONFIG_MAP" 204 | fi 205 | else 206 | echo "Configmap $QM_CONFIG_MAP not found." 207 | fi 208 | 209 | 210 | # STEP12: Delete queue manager 211 | echo "Deleting queue manager $OC_QM_NAME" 212 | ocrc=$(oc get queuemanager $OC_QM_NAME > /dev/null 2>&1) 213 | # shellcheck disable=SC2181 214 | if [ $? -eq 0 ] ; then 215 | ocrc=$(oc delete queuemanager $OC_QM_NAME > /dev/null 2>&1) 216 | if [ $? -eq 0 ]; then 217 | echo "$OC_QM_NAME deleted" 218 | else 219 | echo "An error $ocrc occurred while trying to delete queue manager $OC_QM_NAME" 220 | fi 221 | else 222 | echo "Queue manager $OC_QM_NAME not found." 223 | fi 224 | 225 | -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/pba-cust-cred-map.yaml: -------------------------------------------------------------------------------- 1 | kind: ConfigMap 2 | apiVersion: v1 3 | metadata: 4 | name: pba-custom-cred 5 | namespace: ibm-mqmft 6 | data: 7 | bridge.json: > 8 | {"servers": [{"serverHostName": "172.17.0.3","transferRequesterId": "*","serverType": "SFTP","serverUserId": "sftpuser","serverAssocName": "mftassoc1","serverPassword": "passw0rd","serverHostKey": "","serverPrivateKey": ""}]} 9 | -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/pvc-dest.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | name: pvc-dest 5 | namespace: ibm-mqmft 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | resources: 10 | requests: 11 | storage: 8Gi 12 | 13 | -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/pvc-source.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | name: pvc-source 5 | namespace: ibm-mqmft 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | resources: 10 | requests: 11 | storage: 8Gi 12 | 13 | -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/qm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: mq.ibm.com/v1beta1 2 | kind: QueueManager 3 | metadata: 4 | name: mftqm 5 | namespace: ibm-mqmft 6 | spec: 7 | license: 8 | accept: true 9 | license: L-JTPV-KYG8TF 10 | use: Production 11 | queueManager: 12 | name: MFTQM 13 | mqsc: 14 | - configMap: 15 | name: agent-qm-configmap 16 | items: 17 | - agentcfg.mqsc 18 | storage: 19 | queueManager: 20 | type: persistent-claim 21 | template: 22 | pod: 23 | containers: 24 | - env: 25 | - name: MQSNOAUT 26 | value: 'yes' 27 | name: qmgr 28 | version: 9.4.0.0-r1 29 | web: 30 | enabled: false 31 | -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/readme.md: -------------------------------------------------------------------------------- 1 | # Simple scripts to deploy MFT Agent container and a queue manager on OpenShift Cluster. 2 | - This directory in source. This directory contains two main shell scripts and supporting yaml files. 3 | - The [ocp-deploy](./ocp-deploy.sh) is the main script that deploys agents and queue manager in a OpenShift cluster. 4 | - Run `./ocp-deploy.sh 10 30` - This command will attempt to deploy a queue manager instance, 2 instances of standard agent and one bridge agent instance. 5 | - Will run a transfer between two standard agents. 6 | - Run the [ocp-clean](../test/ocp-deploy/ocp-clean.sh) script to clean the deployment. 7 | -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/source-agent-config.yaml: -------------------------------------------------------------------------------- 1 | kind: ConfigMap 2 | apiVersion: v1 3 | metadata: 4 | name: src-agent-config 5 | namespace: ibm-mqmft 6 | data: 7 | srcagent.json: > 8 | "{"waitTimeToStart":20,"coordinationQMgr":{"name":"MFTQM","host":"mftqm-ibm-mq.ibm-mqmft.svc.cluster.local","port":1414,"channel":"QS_SVRCONN","additionalProperties":{}},"commandQMgr":{"name":"MFTQM","host":"mftqm-ibm-mq.ibm-mqmft.svc.cluster.local","port":1414,"channel":"QS_SVRCONN","additionalProperties":{}},"agents":[{"name":"SRC","deleteOnTermination":"true","type":"STANDARD","qmgrName":"MFTQM","qmgrHost":"mftqm-ibm-mq.ibm-mqmft.svc.cluster.local","qmgrPort":1414,"qmgrChannel":"QS_SVRCONN","additionalProperties":{"enableQueueInputOutput":"true","trace":"all","logCapture":"true"}}]}" 9 | -------------------------------------------------------------------------------- /external-how-to-docs/sample-deployments/source-agent-deployment.yaml: -------------------------------------------------------------------------------- 1 | kind: Deployment 2 | apiVersion: apps/v1 3 | metadata: 4 | name: source-agent 5 | namespace: ibm-mqmft 6 | spec: 7 | replicas: 1 8 | selector: 9 | matchLabels: 10 | app: source-agent 11 | template: 12 | metadata: 13 | labels: 14 | app: source-agent 15 | deploymentconfig: source-agent 16 | spec: 17 | volumes: 18 | - name: src-agent-config-map 19 | configMap: 20 | name: src-agent-config 21 | defaultMode: 420 22 | - name: source-volume 23 | persistentVolumeClaim: 24 | claimName: pvc-source 25 | containers: 26 | - resources: {} 27 | readinessProbe: 28 | exec: 29 | command: 30 | - agentready 31 | initialDelaySeconds: 15 32 | timeoutSeconds: 3 33 | periodSeconds: 30 34 | successThreshold: 1 35 | failureThreshold: 3 36 | terminationMessagePath: /mnt/termination-log 37 | name: src 38 | livenessProbe: 39 | exec: 40 | command: 41 | - agentalive 42 | initialDelaySeconds: 90 43 | timeoutSeconds: 5 44 | periodSeconds: 90 45 | successThreshold: 1 46 | failureThreshold: 3 47 | env: 48 | - name: MFT_AGENT_NAME 49 | value: SRC 50 | - name: LICENSE 51 | value: accept 52 | - name: MFT_AGENT_CONFIG_FILE 53 | value: /mqmftcfg/agentconfig/srcagent.json 54 | - name: MFT_MOUNT_PATH 55 | value: /mountpath 56 | - name: MFT_AGENT_DISPLAY_CAPTURE_LOG 57 | value: "yes" 58 | - name: BFG_JVM_PROPERTIES 59 | value: -Djava.util.prefs.systemRoot=/jprefs/.java/.systemPrefs -Djava.util.prefs.userRoot=/jprefs/.java/.userPrefs 60 | imagePullPolicy: Always 61 | volumeMounts: 62 | - name: src-agent-config-map 63 | mountPath: /mqmftcfg/agentconfig 64 | - name: source-volume 65 | mountPath: /mountpath 66 | terminationMessagePolicy: File 67 | image: >- 68 | icr.io/ibm-messaging/mqmft:latest 69 | restartPolicy: Always 70 | terminationGracePeriodSeconds: 60 71 | dnsPolicy: ClusterFirst 72 | securityContext: {} 73 | schedulerName: default-scheduler -------------------------------------------------------------------------------- /external-how-to-docs/usage-podman.md: -------------------------------------------------------------------------------- 1 | # Running the IBM MQ Managed File Transfer container image using Podman Runtime 2 | See [here](./run-with-podman/run-test.sh) for a step-by-step guide 3 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/ibm-messaging/mq-container-mft 2 | 3 | go 1.21 4 | 5 | require ( 6 | github.com/Jeffail/gabs v1.4.0 7 | github.com/antchfx/xmlquery v1.3.12 8 | github.com/docker/docker v25.0.5+incompatible 9 | github.com/docker/go-connections v0.4.0 10 | github.com/icza/backscanner v0.0.0-20210726202459-ac2ffc679f94 11 | github.com/spf13/pflag v1.0.5 12 | github.com/subchen/go-xmldom v1.1.2 13 | github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 14 | github.com/tidwall/gjson v1.14.1 15 | github.com/tidwall/sjson v1.2.4 16 | golang.org/x/sys v0.20.0 17 | ) 18 | 19 | require ( 20 | github.com/Microsoft/go-winio v0.5.2 // indirect 21 | github.com/antchfx/xpath v1.2.1 // indirect 22 | github.com/containerd/log v0.1.0 // indirect 23 | github.com/distribution/reference v0.6.0 // indirect 24 | github.com/docker/go-units v0.5.0 // indirect 25 | github.com/felixge/httpsnoop v1.0.4 // indirect 26 | github.com/go-logr/logr v1.4.1 // indirect 27 | github.com/go-logr/stdr v1.2.2 // indirect 28 | github.com/gogo/protobuf v1.3.2 // indirect 29 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect 30 | github.com/moby/term v0.5.0 // indirect 31 | github.com/morikuni/aec v1.0.0 // indirect 32 | github.com/opencontainers/go-digest v1.0.0 // indirect 33 | github.com/opencontainers/image-spec v1.1.0 // indirect 34 | github.com/pkg/errors v0.9.1 // indirect 35 | github.com/tidwall/match v1.1.1 // indirect 36 | github.com/tidwall/pretty v1.2.0 // indirect 37 | go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect 38 | go.opentelemetry.io/otel v1.27.0 // indirect 39 | go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0 // indirect 40 | go.opentelemetry.io/otel/metric v1.27.0 // indirect 41 | go.opentelemetry.io/otel/sdk v1.27.0 // indirect 42 | go.opentelemetry.io/otel/trace v1.27.0 // indirect 43 | golang.org/x/net v0.25.0 // indirect 44 | golang.org/x/text v0.15.0 // indirect 45 | golang.org/x/time v0.5.0 // indirect 46 | gotest.tools/v3 v3.5.1 // indirect 47 | ) 48 | -------------------------------------------------------------------------------- /pkg/logger/logger_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | © Copyright IBM Corporation 2018, 2019 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package logger 18 | 19 | import ( 20 | "bytes" 21 | "encoding/json" 22 | "strings" 23 | "testing" 24 | ) 25 | 26 | func TestJSONLogger(t *testing.T) { 27 | buf := new(bytes.Buffer) 28 | l, err := NewLogger(buf, true, true, t.Name(), "", "", 1) 29 | if err != nil { 30 | t.Fatal(err) 31 | } 32 | s := "Hello world" 33 | l.Print(s) 34 | var e map[string]interface{} 35 | err = json.Unmarshal([]byte(buf.String()), &e) 36 | if err != nil { 37 | t.Error(err) 38 | } 39 | if s != e["message"] { 40 | t.Errorf("Expected JSON to contain message=%v; got %v", s, buf.String()) 41 | } 42 | } 43 | 44 | func TestSimpleLogger(t *testing.T) { 45 | buf := new(bytes.Buffer) 46 | l, err := NewLogger(buf, true, false, t.Name(), "", "", 1) 47 | if err != nil { 48 | t.Fatal(err) 49 | } 50 | s := "Hello world" 51 | l.Print(s) 52 | if !strings.Contains(buf.String(), s) { 53 | t.Errorf("Expected log output to contain %v; got %v", s, buf.String()) 54 | } 55 | } 56 | --------------------------------------------------------------------------------