Skip to content

Commit ae46cb1

Browse files
authored
OSASINFRA-3111: Warn if user/pass auth used in clouds.yaml (openshift#6911)
Application credentials [1] have a number of advantage over username/password combinations, not least the ease of rotation. However, the 'clouds.yaml' files generated by various OpenStack tools like Horizon default to username/password combinations and users tend to pass these through unmodified. We don't want to outright reject these - at least, not yet - but we can indicate an explicit preference for application credentials. We do this by inspecting the 'clouds.yaml' file that the user has provided before we store it as a secret for use in the deployment. If the user has provided password-based credentials, we will emit a log encouraging them to migrate and warning about the potential removal of support for password-based auth in a future release. [1] https://docs.openstack.org/keystone/latest/user/application_credentials.html Signed-off-by: Stephen Finucane <[email protected]>
1 parent 55c6136 commit ae46cb1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/asset/manifests/openshift.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010

1111
"github.com/gophercloud/utils/openstack/clientconfig"
1212
"github.com/pkg/errors"
13+
"github.com/sirupsen/logrus"
14+
"k8s.io/apimachinery/pkg/util/sets"
1315
"sigs.k8s.io/yaml"
1416

1517
"github.com/openshift/installer/pkg/asset"
@@ -159,6 +161,16 @@ func (o *Openshift) Generate(dependencies asset.Parents) error {
159161
cloud.CACertFile = "/etc/kubernetes/static-pod-resources/configmaps/cloud-config/ca-bundle.pem"
160162
}
161163

164+
// Application credentials are easily rotated in the event of a leak and should be preferred. Encourage their use.
165+
authTypes := sets.New(clientconfig.AuthPassword, clientconfig.AuthV2Password, clientconfig.AuthV3Password)
166+
if cloud.AuthInfo != nil && authTypes.Has(cloud.AuthType) {
167+
logrus.Warnf(
168+
"clouds.yaml file is using %q type auth. Consider using the %q auth type instead to rotate credentials more easily.",
169+
cloud.AuthType,
170+
clientconfig.AuthV3ApplicationCredential,
171+
)
172+
}
173+
162174
clouds := make(map[string]map[string]*clientconfig.Cloud)
163175
clouds["clouds"] = map[string]*clientconfig.Cloud{
164176
osmachine.CloudName: cloud,

0 commit comments

Comments
 (0)