Skip to content

Commit b8a7167

Browse files
authored
MQ V9.1.3.0 (#348)
* MQ 9.1.3 changes * Use crtmqdir -a * Allow generation of TLS certificate with given hostname * Remove check for certificate env variable * Updated manifests and changelog for 913 * Use MQ externals to configure console frame ancestors * Create /run/mqm * Go sec fixes * Set SAN when generating certificates * Remove image source and commit
1 parent dc00231 commit b8a7167

File tree

18 files changed

+152
-119
lines changed

18 files changed

+152
-119
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Change log
22

3+
## 9.1.3.0 (2019-07-19)
4+
5+
* Updated to MQ version 9.1.3.0
6+
* Allow generation of TLS certificate with given hostname
7+
* Fixes for the following issues:
8+
* `MQ_EPHEMERAL_PREFIX` UNIX sockets fix
9+
* Fix Makefile for Windows
10+
* Use -a option on crtmqdir
11+
* Remove check for certificate environment variable
12+
313
## 9.1.2.0-UBI (2019-06-21)
414

515
**Breaking changes**:
@@ -13,6 +23,7 @@
1323

1424
## 9.1.2.0 (2019-03-21)
1525

26+
* Updated to MQ version 9.1.2.0
1627
* Now runs using the "mqm" user instead of root. See new [security doc](https://github.com/ibm-messaging/mq-container/blob/master/docs/security.md)
1728
* New [IGNSTATE](https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.pro.doc/q132310_.htm#q132310___ignstateparm) parameter used in default developer config
1829
* Termination log moved from `/dev/termination-log` to `/run/termination-log`, to make permissions easier to handle

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
# the command line
1818
###############################################################################
1919
# MQ_VERSION is the fully qualified MQ version number to build
20-
MQ_VERSION ?= 9.1.2.0
20+
MQ_VERSION ?= 9.1.3.0
2121
# RELEASE shows what release of the container code has been built
22-
RELEASE ?= 3
22+
RELEASE ?= 1
2323
# MQ_ARCHIVE is the name of the file, under the downloads directory, from which MQ Advanced can
2424
# be installed. The default value is derived from MQ_VERSION, BASE_IMAGE and architecture
2525
# Does not apply to MQ Advanced for Developers.
@@ -68,7 +68,7 @@ IMAGE_REVISION=$(shell git rev-parse HEAD)
6868
IMAGE_SOURCE=$(shell git config --get remote.origin.url)
6969
EMPTY:=
7070
SPACE:= $(EMPTY) $(EMPTY)
71-
# MQ_VERSION_VRM is MQ_VERSION with only the Version, Release and Modifier fields (no Fix field). e.g. 9.1.2 instead of 9.1.2.0
71+
# MQ_VERSION_VRM is MQ_VERSION with only the Version, Release and Modifier fields (no Fix field). e.g. 9.1.3 instead of 9.1.3.0
7272
MQ_VERSION_VRM=$(subst $(SPACE),.,$(wordlist 1,3,$(subst .,$(SPACE),$(MQ_VERSION))))
7373

7474
# Set variable if running on a Red Hat Enterprise Linux host
@@ -102,6 +102,7 @@ endif
102102
MQ_ARCHIVE_DEV_9.1.0.0=mqadv_dev910_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
103103
MQ_ARCHIVE_DEV_9.1.1.0=mqadv_dev911_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
104104
MQ_ARCHIVE_DEV_9.1.2.0=mqadv_dev912_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
105+
MQ_ARCHIVE_DEV_9.1.3.0=mqadv_dev913_$(MQ_ARCHIVE_DEV_PLATFORM)_$(MQ_DEV_ARCH).tar.gz
105106

106107
###############################################################################
107108
# Build targets

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ For issues relating specifically to the container image or Helm chart, please us
4444
The Dockerfiles and associated code and scripts are licensed under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
4545
Licenses for the products installed within the images are as follows:
4646

47-
- [IBM MQ Advanced for Developers](http://www14.software.ibm.com/cgi-bin/weblap/lap.pl?la_formnum=Z125-3301-14&li_formnum=L-APIG-AVCJ4S) (International License Agreement for Non-Warranted Programs). This license may be viewed from an image using the `LICENSE=view` environment variable as described above or by following the link above.
48-
- [IBM MQ Advanced](http://www14.software.ibm.com/cgi-bin/weblap/lap.pl?la_formnum=Z125-3301-14&li_formnum=L-APIG-AZYF4X) (International Program License Agreement). This license may be viewed from an image using the `LICENSE=view` environment variable as described above or by following the link above.
47+
- [IBM MQ Advanced for Developers](http://www14.software.ibm.com/cgi-bin/weblap/lap.pl?la_formnum=Z125-3301-14&li_formnum=L-APIG-BBZHCQ) (International License Agreement for Non-Warranted Programs). This license may be viewed from an image using the `LICENSE=view` environment variable as described above or by following the link above.
48+
- [IBM MQ Advanced](http://www14.software.ibm.com/cgi-bin/weblap/lap.pl?la_formnum=Z125-3301-14&li_formnum=L-APIG-BBSHJL) (International Program License Agreement). This license may be viewed from an image using the `LICENSE=view` environment variable as described above or by following the link above.
4949
- License information for Ubuntu packages may be found in `/usr/share/doc/${package}/copyright`
5050

5151
Note: The IBM MQ Advanced for Developers license does not permit further distribution and the terms restrict usage to a developer machine.

cmd/runmqserver/main.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -117,29 +117,6 @@ func doMain() error {
117117
return err
118118
}
119119

120-
// handle /var/mqm/ permissions in upgrade to UBI
121-
if *initFlag {
122-
varMqmDirs := []string{
123-
"/var/mqm/config",
124-
"/var/mqm/conv",
125-
"/var/mqm/errors",
126-
"/var/mqm/exits",
127-
"/var/mqm/exits64",
128-
"/var/mqm/log",
129-
"/var/mqm/mqft",
130-
"/var/mqm/qmgrs",
131-
"/var/mqm/shared",
132-
"/var/mqm/sockets",
133-
"/var/mqm/trace",
134-
"/var/mqm/web",
135-
}
136-
err = configureOwnership(varMqmDirs)
137-
if err != nil {
138-
logTermination(err)
139-
return err
140-
}
141-
}
142-
143120
// If init flag is set, exit now
144121
if *initFlag {
145122
return nil

cmd/runmqserver/qmgr.go

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ import (
2424
"path/filepath"
2525
"strings"
2626

27-
"golang.org/x/sys/unix"
28-
2927
"github.com/ibm-messaging/mq-container/internal/command"
3028
containerruntime "github.com/ibm-messaging/mq-container/internal/containerruntime"
3129
"github.com/ibm-messaging/mq-container/internal/mqscredact"
@@ -34,7 +32,7 @@ import (
3432

3533
// createDirStructure creates the default MQ directory structure under /var/mqm
3634
func createDirStructure() error {
37-
out, _, err := command.Run("/opt/mqm/bin/crtmqdir", "-f", "-s")
35+
out, _, err := command.Run("/opt/mqm/bin/crtmqdir", "-f", "-a")
3836
if err != nil {
3937
log.Printf("Error creating directory structure: %v\n", string(out))
4038
return err
@@ -43,47 +41,6 @@ func createDirStructure() error {
4341
return nil
4442
}
4543

46-
// configureOwnership recursively handles ownership of files within the given filepath
47-
func configureOwnership(paths []string) error {
48-
uid, gid, err := command.LookupMQM()
49-
if err != nil {
50-
return err
51-
}
52-
var fileInfo *unix.Stat_t
53-
fileInfo = new(unix.Stat_t)
54-
for _, root := range paths {
55-
_, err = os.Stat(root)
56-
if err != nil {
57-
if os.IsNotExist(err) {
58-
continue
59-
}
60-
return err
61-
}
62-
err = filepath.Walk(root, func(from string, info os.FileInfo, err error) error {
63-
if err != nil {
64-
return err
65-
}
66-
to := fmt.Sprintf("%v%v", root, from[len(root):])
67-
err = unix.Stat(to, fileInfo)
68-
if err != nil {
69-
return err
70-
}
71-
fileUID := fmt.Sprint(fileInfo.Uid)
72-
if strings.Compare(fileUID, "999") == 0 {
73-
err = os.Chown(to, uid, gid)
74-
if err != nil {
75-
return err
76-
}
77-
}
78-
return nil
79-
})
80-
if err != nil {
81-
return err
82-
}
83-
}
84-
return nil
85-
}
86-
8744
// createQueueManager creates a queue manager, if it doesn't already exist.
8845
// It returns true if one was created (or a standby was created), or false if one already existed
8946
func createQueueManager(name string) (bool, error) {

cmd/runmqserver/tls.go

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"strings"
2323

2424
"github.com/ibm-messaging/mq-container/internal/command"
25+
"github.com/ibm-messaging/mq-container/internal/keystore"
2526
"github.com/ibm-messaging/mq-container/internal/mqtemplate"
2627
"github.com/ibm-messaging/mq-container/internal/tls"
2728
)
@@ -38,7 +39,7 @@ const trustDir = "/etc/mqm/pki/trust"
3839
// configureWebTLS configures TLS for Web Console
3940
func configureWebTLS(label string) error {
4041
// Return immediately if we have no certificate to use as identity
41-
if label == "" {
42+
if label == "" && os.Getenv("MQ_GENERATE_CERTIFICATE_HOSTNAME") == "" {
4243
return nil
4344
}
4445

@@ -129,8 +130,30 @@ func configureSSOTLS(p12TrustStore tls.KeyStoreData) (string, error) {
129130
// Check keystore exists
130131
ks := filepath.Join(keyStoreDir, webKeyStoreName)
131132
_, err := os.Stat(ks)
132-
if err != nil {
133-
return "", fmt.Errorf("Failed to find existing keystore %s: %v", ks, err)
133+
// Now we know if the file exists let's check whether we should have it or not.
134+
// Check if we're being told to generate the certificate
135+
genHostName := os.Getenv("MQ_GENERATE_CERTIFICATE_HOSTNAME")
136+
if genHostName != "" {
137+
// We've got to generate the certificate with the hostname given
138+
if err == nil {
139+
log.Printf("Replacing existing keystore %s - generating new certificate", ks)
140+
}
141+
// Keystore doesn't exist so create it and populate a certificate
142+
newKS := keystore.NewPKCS12KeyStore(ks, p12TrustStore.Password)
143+
err = newKS.Create()
144+
if err != nil {
145+
return "", fmt.Errorf("Failed to create keystore %s: %v", ks, err)
146+
}
147+
148+
err = newKS.CreateSelfSignedCertificate("default", fmt.Sprintf("CN=%s", genHostName), genHostName)
149+
if err != nil {
150+
return "", fmt.Errorf("Failed to generate certificate in keystore %s with DN of 'CN=%s': %v", ks, genHostName, err)
151+
}
152+
} else {
153+
// Keystore should already exist
154+
if err != nil {
155+
return "", fmt.Errorf("Failed to find existing keystore %s: %v", ks, err)
156+
}
134157
}
135158

136159
// Check truststore exists

cmd/runmqserver/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ func logDateStamp() {
3838
}
3939

4040
func logGitRepo() {
41-
log.Printf("Image revision: %v", ImageRevision)
41+
// log.Printf("Image revision: %v", ImageRevision)
4242
}
4343

4444
func logGitCommit() {
45-
log.Printf("Image source: %v", ImageSource)
45+
// log.Printf("Image source: %v", ImageSource)
4646
}
4747

4848
func logImageTag() {

cmd/runmqserver/webserver.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ func configureSSO(p12TrustStore tls.KeyStoreData) (string, error) {
9292
"MQ_OIDC_TOKEN_ENDPOINT",
9393
"MQ_OIDC_JWK_ENDPOINT",
9494
"MQ_OIDC_ISSUER_IDENTIFIER",
95-
"MQ_OIDC_CERTIFICATE",
9695
}
9796
for _, envVar := range requiredEnvVars {
9897
if len(os.Getenv(envVar)) == 0 {

docs/building.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ If you are working in the Windows Subsystem for Linux, follow [this guide by Mic
1414
This procedure works for building the MQ Continuous Delivery release, on `amd64`, `ppc64le` and `s390x` architectures.
1515

1616
1. Create a `downloads` directory in the root of this repository
17-
2. Download MQ from [IBM Passport Advantage](https://www.ibm.com/software/passportadvantage/) or [IBM Fix Central](https://www.ibm.com/support/fixcentral), and place the downloaded file (for example, `IBM_MQ_9.1.2_UBUNTU_X86-64.tar.gz`) in the `downloads` directory
17+
2. Download MQ from [IBM Passport Advantage](https://www.ibm.com/software/passportadvantage/) or [IBM Fix Central](https://www.ibm.com/support/fixcentral), and place the downloaded file (for example, `IBM_MQ_9.1.3_LINUX_X86-64.tar.gz`) in the `downloads` directory
1818
3. Run `make build-advancedserver`
1919

2020
> **Warning**: Note that MQ offers two different sets of packaging on Linux: one is called "MQ for Linux" and contains RPM files for installing on Red Hat Enterprise Linux and SUSE Linux Enterprise Server. The MQ container build uses a Red Hat Universal Base Image, so you need the "MQ for Linux" RPM files.

docs/security.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ docker run \
1616
--env LICENSE=accept \
1717
--env MQ_QMGR_NAME=QM1 \
1818
--detach \
19-
mqadvanced-server:9.1.2.0-amd64
19+
mqadvanced-server:9.1.3.0-amd64
2020
```
2121

2222
The MQ Advanced for Developers image does require the "chown", "setuid", "setgid" and "audit_write" capabilities (plus "dac_override" if you're using an image based on Red Hat Enterprise Linux). This is because it uses the "sudo" command to change passwords inside the container. For example, in Docker, you could do the following:
@@ -31,7 +31,7 @@ docker run \
3131
--env LICENSE=accept \
3232
--env MQ_QMGR_NAME=QM1 \
3333
--detach \
34-
mqadvanced-server-dev:9.1.2.0-amd64
34+
mqadvanced-server-dev:9.1.3.0-amd64
3535
```
3636

3737
### SELinux

0 commit comments

Comments
 (0)