Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Appendix C. Whole Disk Images
The main overcloud image is a flat partition image that contains no partitioning information or bootloader on the images itself. The director uses a separate kernel and ramdisk when booting nodes and creates a basic partitioning layout when writing the overcloud image to disk. However, you can create a whole disk image, which includes a partitioning layout, bootloader, and hardened security.
The following process uses the director’s image building feature. Red Hat only supports images built using the guidelines contained in this section. Custom images built outside of these specifications are not supported.
A security hardened image includes extra security measures necessary for Red Hat OpenStack Platform deployments where security is an important feature. Consider the following list of recommendations when you create a security hardened image:
-
The
/tmp
directory is mounted on a separate volume or partition and has therw
,nosuid
,nodev
,noexec
, andrelatime
flags -
The
/var
,/var/log
and the/var/log/audit
directories are mounted on separate volumes or partitions, with therw
andrelatime
flags -
The
/home
directory is mounted on a separate partition or volume and has therw
,nodev
, andrelatime
flags Include the following changes to the
GRUB_CMDLINE_LINUX
setting:-
To enable auditing, add the
audit=1
kernel boot flag. -
To disable the kernel support for USB using boot loader configuration, add
nousb
. -
To remove the insecure boot flags, set
crashkernel=auto
-
To enable auditing, add the
-
Blacklist insecure modules (
usb-storage
,cramfs
,freevxfs
,jffs2
,hfs
,hfsplus
,squashfs
,udf
,vfat
) and prevent these modules from loading. -
Remove any insecure packages (
kdump
installed bykexec-tools
andtelnet
) from the image as they are installed by default -
Add the new
screen
package necessary for security
To build a security hardened image, complete the following steps:
- Download a base Red Hat Enterprise Linux 7 image
- Set the environment variables specific to registration
- Customize the image by modifying the partition schema and the size
- Create the image
- Upload the image to director
The following sections contain procedures to achieve these tasks.
C.1. Downloading the Base Cloud Image Link kopierenLink in die Zwischenablage kopiert!
Before building a whole disk image, you must download an existing cloud image of Red Hat Enterprise Linux to use as a basis. Navigate to the Red Hat Customer Portal and select the KVM Guest Image to download. For example, the KVM Guest Image for the latest Red Hat Enterprise Linux is available on the following page:
C.2. Disk Image Environment Variables Link kopierenLink in die Zwischenablage kopiert!
As a part of the disk image building process, the director requires a base image and registration details to obtain packages for the new overcloud image. Define these attributes with the following Linux environment variables.
The image building process temporarily registers the image with a Red Hat subscription and unregisters the system once the image building process completes.
To build a disk image, set Linux environment variables that suit your environment and requirements:
- DIB_LOCAL_IMAGE
- Sets the local image that you want to use as the basis for your whole disk image.
- REG_ACTIVATION_KEY
- Use an activation key instead of login details as part of the registration process.
- REG_AUTO_ATTACH
- Defines whether to attach the most compatible subscription automatically.
- REG_BASE_URL
-
The base URL of the content delivery server containing packages for the image. The default Customer Portal Subscription Management process uses
https://cdn.redhat.com
. If you use a Red Hat Satellite 6 server, set this parameter to the base URL of your Satellite server. - REG_ENVIRONMENT
- Registers to an environment within an organization.
- REG_METHOD
-
Sets the method of registration. Use
portal
to register a system to the Red Hat Customer Portal. Usesatellite
to register a system with Red Hat Satellite 6. - REG_ORG
- The organization where you want to register the images.
- REG_POOL_ID
- The pool ID of the product subscription information.
- REG_PASSWORD
- Gives the password for the user account that registers the image.
- REG_REPOS
A comma-separated string of repository names. Each repository in this string is enabled through
subscription-manager
.Use the following repositories for a security hardened whole disk image:
-
rhel-7-server-rpms
-
rhel-7-server-extras-rpms
-
rhel-ha-for-rhel-7-server-rpms
-
rhel-7-server-optional-rpms
-
rhel-7-server-openstack-14-rpms
-
- REG_SAT_URL
- The base URL of the Satellite server to register Overcloud nodes. Use the Satellite’s HTTP URL and not the HTTPS URL for this parameter. For example, use http://satellite.example.com and not https://satellite.example.com.
- REG_SERVER_URL
-
Gives the hostname of the subscription service to use. The default is for the Red Hat Customer Portal at
subscription.rhn.redhat.com
. If using a Red Hat Satellite 6 server, set this parameter to the hostname of your Satellite server. - REG_USER
- Gives the user name for the account that registers the image.
Use the following set of example commands to export a set of environment variables and temporarily register a local QCOW2 image to the Red Hat Customer Portal:
C.3. Customizing the Disk Layout Link kopierenLink in die Zwischenablage kopiert!
The default security hardened image size is 20G and uses predefined partitioning sizes. However, you must modify the partitioning layout to accommodate overcloud container images. Complete the steps in the following sections to increase the image size to 40G. You can modify the partitioning layout and disk size to further suit your needs.
To modify the partitioning layout and disk size, perform the following steps:
-
Modify the partitioning schema using the
DIB_BLOCK_DEVICE_CONFIG
environment variable. -
Modify the global size of the image by updating the
DIB_IMAGE_SIZE
environment variable.
C.3.1. Modifying the Partitioning Schema Link kopierenLink in die Zwischenablage kopiert!
You can modify the partitioning schema to alter the partitioning size, create new partitions, or remove existing ones. You can define a new partitioning schema with the following environment variable:
export DIB_BLOCK_DEVICE_CONFIG='<yaml_schema_with_partitions>'
$ export DIB_BLOCK_DEVICE_CONFIG='<yaml_schema_with_partitions>'
The following YAML structure represents the modified logical volume partitioning layout to accommodate enough space to pull overcloud container images:
Use this sample YAML content as a basis for your image’s partition schema. Modify the partition sizes and layout to suit your needs.
You must define the correct partition sizes for the image as you cannot resize them after the deployment.
C.3.2. Modifying the Image Size Link kopierenLink in die Zwischenablage kopiert!
The global sum of the modified partitioning schema might exceed the default disk size (20G). In this situation, you might need to modify the image size. To modify the image size, edit the configuration files that create the image.
Create a copy of the /usr/share/openstack-tripleo-common/image-yaml/overcloud-hardened-images.yaml
:
cp /usr/share/openstack-tripleo-common/image-yaml/overcloud-hardened-images.yaml \ /home/stack/overcloud-hardened-images-custom.yaml
# cp /usr/share/openstack-tripleo-common/image-yaml/overcloud-hardened-images.yaml \
/home/stack/overcloud-hardened-images-custom.yaml
Edit the DIB_IMAGE_SIZE
in the configuration file and adjust the values as necessary:
- 1
- Adjust this value to the new total disk size.
Save this file.
When you deploy the overcloud, the director creates a RAW version of the overcloud image. This means your undercloud must have enough free space to accommodate the RAW image. For example, if you increase the security hardened image size to 40G, you must have 40G of space available on the undercloud’s hard disk.
When the director writes the image to the physical disk, the director creates a 64MB configuration drive primary partition at the end of the disk. When you create your whole disk image, ensure the size of the physical disk accommodates this extra partition.
C.4. Creating a Security Hardened Whole Disk Image Link kopierenLink in die Zwischenablage kopiert!
After you have set the environment variables and customized the image, create the image using the openstack overcloud image build
command:
openstack overcloud image build \ --image-name overcloud-hardened-full \ --config-file /home/stack/overcloud-hardened-images-custom.yaml \ --config-file /usr/share/openstack-tripleo-common/image-yaml/overcloud-hardened-images-rhel7.yaml
# openstack overcloud image build \
--image-name overcloud-hardened-full \
--config-file /home/stack/overcloud-hardened-images-custom.yaml \
--config-file /usr/share/openstack-tripleo-common/image-yaml/overcloud-hardened-images-rhel7.yaml
- 1
- This is the custom configuration file containing the new disk size from Section C.3.2, “Modifying the Image Size”. If you are not using a different custom disk size, use the original
/usr/share/openstack-tripleo-common/image-yaml/overcloud-hardened-images.yaml
file instead.
This command creates an image called overcloud-hardened-full.qcow2
, which contains all the necessary security features.
C.5. Uploading a Security Hardened Whole Disk Image Link kopierenLink in die Zwischenablage kopiert!
Upload the image to the OpenStack Image (glance) service and start using it from the Red Hat OpenStack Platform director. To upload a security hardened image, complete the following steps:
Rename the newly generated image and move the image to your
images
directory:mv overcloud-hardened-full.qcow2 ~/images/overcloud-full.qcow2
# mv overcloud-hardened-full.qcow2 ~/images/overcloud-full.qcow2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove all the old overcloud images:
openstack image delete overcloud-full openstack image delete overcloud-full-initrd openstack image delete overcloud-full-vmlinuz
# openstack image delete overcloud-full # openstack image delete overcloud-full-initrd # openstack image delete overcloud-full-vmlinuz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Upload the new overcloud image:
openstack overcloud image upload --image-path /home/stack/images --whole-disk
# openstack overcloud image upload --image-path /home/stack/images --whole-disk
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If you want to replace an existing image with the security hardened image, use the --update-existing
flag. This flag overwrites the original overcloud-full
image with a new security hardened image.