Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snap install fails on long hostnames #4445

Open
mxm-tr opened this issue Feb 29, 2024 · 2 comments
Open

Snap install fails on long hostnames #4445

mxm-tr opened this issue Feb 29, 2024 · 2 comments
Labels

Comments

@mxm-tr
Copy link

mxm-tr commented Feb 29, 2024

Summary

The snap install of microk8s fails when generating certificates on long hostnames, it fails with the following error message:

+ chown 0:0 /var/snap/microk8s/6541/certs/kubelet.key
+ chmod 0600 /var/snap/microk8s/6541/certs/kubelet.key
+ /snap/microk8s/6541/usr/bin/openssl req -new -sha256 -subj /CN=system:node:test-microk8s-snap-with-very-very-very-very-very-long-hostname/O=system:nodes -key /var/snap/microk8s/6541/certs/kubelet.key -addext 'subjectAltName = DNS:test-microk8s-snap-with-very-very-very-very-very-long-hostname, IP:57.128.88.67, IP:2001:41d0:304:500::323'
problems making Certificate Request
140456057689792:error:0D07A097:asn1 encoding routines:ASN1_mbstring_ncopy:string too long:../crypto/asn1/a_mbstr.c:107:maxsize=64

What Should Happen Instead?

We should be able to install the snap on servers with a hostname longer than 64, the value set for ub-common-name-length defined in rfc5280

Reproduction Steps

  1. Configure a server with a long hostname (>64 chars)
  2. Run snap install:
ubuntu@test-microk8s-snap-with-very-very-very-very-very-long-hostname:~$ sudo snap install microk8s --classic`

Introspection Report

NA: microk8s is not installed

Can you suggest a fix?

  • Override the hostname of the server with a shorter version, and configure the alias in /etc/hosts?

  • Or something else

Are you interested in contributing with a fix?

yes

@neoaggelos
Copy link
Contributor

Hi @mxm-tr

MicroK8s uses the output of the hostname internally, so the only practical fix would be to ensure that the hostname does not exceed that limit.

One way to do it is to use hostnamectl set-hostname shorter-hostname

Copy link

stale bot commented Jan 25, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants