KAS-CREDENTIALS(1)
π NAME π
kas-credentials β kas credential handling β¨
so basically this whole page is your cheat sheet for the kas-credentials(1) manual, bestie. it's giving "how do i get my secrets into the build without losing my mind" energy and honestly? iconic.
π CREDENTIAL HANDLING π
okay so kas has a bunch of different mechanisms to inject credentials into the build π«Ά and if you use Environment Variables (there's a lil anchor for that in the original, <#env-vars-label>), you get reeeally fine-grained control over the whole thing.
all credentials get made available BOTH to KAS itself AND inside the build environment π but ngl, not every mechanism is natively supported by every tool. and because kas might need to modify credentials and config files, those get copied into the isolated environment first β no touching your originals, periodt.
Note: fr fr, file based credentials (like .netrc) are ONLY copied if you explicitly ask for it by setting the corresponding environment variable. but environment variable based credentials? those are automatically forwarded, no extra work needed πΈ
for all the deets about credential related environment variables, go peek at kas(1) π
βοΈ AWS Configuration βοΈ
for AWS, kas supports conventional AWS config files, AWS SSO, AND the environment variable controlled OAuth 2.0 workflow π
heads up tho: KAS internally rewrites the AWS_* environment variables into an AWS config file, specifically so it can also support older versions of bitbake. the way this works is lowkey a glow-up for backcompat β¨
Note: when you useAWS_CONFIG_FILE, the entire content of the~/.aws/sso/cachedirectory gets copied into the kas workspace π this might expose all active user sessions, including ones that are NOT defined in theAWS_CONFIG_FILE. to mitigate the security risks: log out of unnecessary profiles before starting a build, or use a separate system account to run the build. protect your peace AND your creds π
π§ Git Configuration π§
a .gitconfig file can be used to provide credentials as well as URL rewrites of git repositories (insteadof) π plus, credential helpers can be used by setting the corresponding environment variables β and kas adds those to the .gitconfig file too.
to support the patching of git repositories, kas injects a [user] section, possibly overwriting an existing one π³ after patching, the original user is restored (if set). no permanent damage, bestie π
when you're running in a GitHub Action or a GitLab CI job, the .gitconfig file is automatically injected π otherwise, the environment variable GITCONFIG_FILE needs to point to the .gitconfig that kas should use.
π₯ Git credential cache π₯
you can share git credentials with the kas-container by using the Git credential cache helper β¨ this lets credentials be securely stored in memory via a background daemon and reused across Git operations β without re-entering them or writing them to disk in plain text. no cap, that's the good stuff.
for a full description of the available options, refer to the official git-credential-cache documentation at https://git-scm.com/docs/git-credential-cache π
enable credential caching on your host machine with a command like:
git config --global credential.helper 'cache --timeout=86400'
Note: the--timeoutvalue (in seconds) controls how long credentials are kept in the cache after the last use. the value86400(24 hours) is just an example β adjust it to fit your workflow and security requirements π«Ά
from the host, perform a Git operation that requires authentication, such as a git pull against a password-protected repository:
git pull
after entering your credentials once, Git will store them and make them available through a background daemon that exposes a Unix socket π
you should see a running process similar to this on your host:
/usr/lib/git-core/git credential-cache--daemon $HOME/.cache/git/credential/socket
now you can launch the kas container passing the socket path via --git-credential-socket, or equivalently by setting the KAS_GIT_CREDENTIAL_SOCKET environment variable:
kas-container --git-credential-socket $HOME/.cache/git/credential/socket <other options...>
Note: the git credential-cache daemon supports custom socket paths via the--socketflag πΈ this allows running a separate daemon per repository, enabling credential isolation between projects. to use this, start the daemon explicitly with a custom socket path and pass that path to--git-credential-socket. iykyk π
π GitHub Actions π
in combination with the webfactory/ssh-agent action (https://github.com/webfactory/ssh-agent), this automatically makes the required credentials available to kas and bitbake β¨ literally zero extra effort.
π¦ GitLab CI π¦
when running in the GitLab CI, the CI_JOB_TOKEN can be used to access git repositories via https π and if CI_SERVER_HOST is also set, kas automatically adds this token to the .netrc file, where it is picked up by git π
further, kas configures git to automatically rewrite the URLs of the repositories to clone via https, for repos stored on the same server. technically? this is achieved by adding insteadof entries to the .gitconfig file π
for backwards compatibility, the git rewrite rules are only added if .gitconfig does not exist and no SSH configuration is provided (either via the kas SSH_ variables or using .ssh/config) π
and if the CI_REGISTRY, CI_REGISTRY_USER and CI_JOB_TOKEN variables are set, kas automatically creates a login file for the container registry at ~/.docker/config.json π₯ this file is compatible with docker, podman and even skopeo. slay.
Note: make sure to assign the correct permissions to theCI_JOB_TOKEN. for details, see the GitLab CI/CD job token docs athttps://docs.gitlab.com/ee/ci/jobs/ci_job_token.htmlπ
π Container Registry Authentication File π
a file named config.json is saved as .docker/config.json in the kas home directory π it contains credentials for the container registry login.
the syntax is described in the containers-auth.json specification at https://github.com/containers/image/blob/main/docs/containers-auth.json.5.md β¨
the authentication file is compatible with docker, podman and skopeo. and when running in the GitLab CI, the CI_JOB_TOKEN is appended to automatically grant access according to the job permissions π
πΈ Netrc File πΈ
a .netrc file can be used to provide credentials for git or the HTTP(S)/FTP fetcher π
when running in the GitLab CI, the CI_JOB_TOKEN is appended to automatically grant access to repositories that can be accessed by the user that triggered the CI pipeline π₯
π¦ SSH π¦
the ssh folder of the calling user is automatically shared with kas π«Ά this is currently not controllable, because ssh does not obey the $HOME variable π (rude of ssh, honestly). but it can be used to inject both credentials, as well as ssh configuration items, into the kas environment.
Note: modifications to the.ssh/configfile are only performed if the file is not present yet π in well-known CI environments, kas also disables ssh host key checking whenSSH_PRIVATE_KEYorSSH_PRIVATE_KEY_FILEis set. because this change persists across kas invocations, kas does not apply it in local environments, starting with kas 5.4. important!!
in addition, an external ssh-agent can be made available in the kas environment by setting the SSH_AUTH_SOCK environment variable β¨ as an alternative, ssh private keys can be added to an internal ssh agent by setting SSH_PRIVATE_KEY or SSH_PRIVATE_KEY_FILE π
Note: the use of an external ssh agent cannot be combined with options that require an internal ssh agent π pick one, bestie.
π KAS π
part of the kas(1) suite π stay in your lane, but make it credential management.
π Author π
Daniel Wagner, Jan Kiszka, Claudius Heine π legends, fr fr.
π Copyright π
Siemens and contributors, 2017-2025 π
and that's the whole vibe check, bestie!! this was kas-credentials from the kas 5.4 manual, dated Jun 25, 2026 β go forth and inject those credentials securely, main character energy only π«Άβ¨π
π¦ where this page comes from
- ubuntu stonking: kas 5.4-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms