<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Cole Arendt</title>
    <description>The latest articles on DEV Community by Cole Arendt (@colearendt).</description>
    <link>https://dev.to/colearendt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F794354%2F1e1ad750-c7c0-4b9c-afb9-8f8e0643a7d3.jpeg</url>
      <title>DEV Community: Cole Arendt</title>
      <link>https://dev.to/colearendt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/colearendt"/>
    <language>en</language>
    <item>
      <title>Helm Intro and Cheatsheet</title>
      <dc:creator>Cole Arendt</dc:creator>
      <pubDate>Tue, 11 Oct 2022 02:20:59 +0000</pubDate>
      <link>https://dev.to/colearendt/helm-intro-and-cheatsheet-1252</link>
      <guid>https://dev.to/colearendt/helm-intro-and-cheatsheet-1252</guid>
      <description>&lt;p&gt;Below is an introduction to Helm! If you want to skip to the&lt;br&gt;
cheatsheet, you can &lt;a href="https://www.analogous.dev/download/cheatsheet/helm.pdf"&gt;download it here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Helm
&lt;/h2&gt;

&lt;p&gt;According to &lt;a href="https://helm.sh/docs/"&gt;its own docs&lt;/a&gt;, Helm is "the" package manager for Kubernetes. What does this mean?&lt;/p&gt;

&lt;p&gt;It's a way of keeping track of all your Kubernetes stuff!&lt;/p&gt;

&lt;p&gt;Helm as I describe it is a mechanism for packaging and parameterizing standard Kubernetes YAML files. It uses &lt;a href="https://blog.gopheracademy.com/advent-2017/using-go-templates/"&gt;Go Templating&lt;/a&gt; for most of this mechanism, and adds a layer of version / metadata tracking as well. All of this packaged up into tarballs used by a client-side-only (as of &lt;code&gt;helm&lt;/code&gt; v3) CLI.&lt;/p&gt;

&lt;p&gt;So basically: Helm = YAML + Go Templating + Versioning + Tarballs.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why use it?
&lt;/h2&gt;

&lt;p&gt;Why use it? There are lots of alternatives out there, and many purported "Helm replacements," but Helm has yet to give up its throne, and I have not found anything better for my own use cases... yet. So what are Helm's strengths?&lt;/p&gt;

&lt;p&gt;I will do my best not to wax poetic. I am biased and a big fan of Helm. As a layer of abstraction between an application and Kubernetes, I think it is a fantastic asset.&lt;/p&gt;

&lt;p&gt;In particular, I think this is because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No runtime dependency&lt;/li&gt;
&lt;li&gt;Client-side only utility&lt;/li&gt;
&lt;li&gt;Data stored server side for collaboration&lt;/li&gt;
&lt;li&gt;output represents native Kubernetes objects (i.e. interoperable with other tools)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;helm template&lt;/code&gt; gives rapid feedback on iterating and testing&lt;/li&gt;
&lt;li&gt;plain text file output / diffs is very easy to parse&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a system administrator, it is nice because it offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Version pinning for reproducibility&lt;/li&gt;
&lt;li&gt;Everything is open source tarballs, so dependencies are easy to track and introspect&lt;/li&gt;
&lt;li&gt;application vendors will ideally maintain their own chart and good NEWS files&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  When to use it?
&lt;/h2&gt;

&lt;p&gt;So that's &lt;em&gt;what&lt;/em&gt; it is, and &lt;em&gt;why&lt;/em&gt; it is desirable. But &lt;em&gt;when&lt;/em&gt; is it useful?&lt;/p&gt;

&lt;p&gt;I find that helm particularly shines in a handful of situations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Managing an array of applications deployed on Kubernetes&lt;/li&gt;
&lt;li&gt;Packaging your own application for use by customers&lt;/li&gt;
&lt;li&gt;Encoding complex knowledge about "how to run an application" (to an extent, then you get to &lt;a href="https://kubernetes.io/docs/concepts/extend-kubernetes/operator/"&gt;operators&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;To set up easy "roll-back" policies for applications that support the behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Occasionally a wrapper like &lt;a href="https://argoproj.github.io/cd/"&gt;ArgoCD&lt;/a&gt;, &lt;a href="https://fluxcd.io/"&gt;Flux&lt;/a&gt;, &lt;a href="https://github.com/helmfile/helmfile"&gt;helmfile&lt;/a&gt;, or &lt;a href="https://www.pulumi.com/docs/get-started/kubernetes/"&gt;pulumi&lt;/a&gt; will be useful to manage your helm deployments too, so that you don't have to keep track of a bunch of CLI commands.&lt;/p&gt;
&lt;h2&gt;
  
  
  When not to use it?
&lt;/h2&gt;

&lt;p&gt;Helm can definitely be overkill in some "hello world" or very simple deployment situations. Unfortunately, it also &lt;strong&gt;does not have a great answer for &lt;a href="https://helm.sh/docs/topics/charts/#custom-resource-definitions-crds"&gt;CRDs&lt;/a&gt; yet&lt;/strong&gt;. Moreover, it is &lt;strong&gt;only useful for Kubernetes&lt;/strong&gt;, so if you are unfamiliar with Kubernetes, it will have limited utility for you.&lt;/p&gt;

&lt;p&gt;The other case where it may not be useful is in some &lt;strong&gt;internal applications&lt;/strong&gt;. Maintaining a helm chart for an application can end up being a sizable amount of work, and they do not allow arbitrary inputs, so if you miss some key (i.e. "imagePullSecrets,") you can end up spending a lot of time key-chasing across your charts. I have heard of folks using &lt;a href="https://kustomize.io/"&gt;Kustomize&lt;/a&gt; in such a situation, although another option is to use a meta chart (one chart for many apps) or Functions-as-a-Service (FaaS) framework like &lt;a href="https://www.serverless.com/"&gt;Serverless&lt;/a&gt;, &lt;a href="https://www.openfaas.com/"&gt;OpenFaas&lt;/a&gt;, &lt;a href="https://knative.dev/docs/"&gt;Knative&lt;/a&gt;, etc.&lt;/p&gt;

&lt;p&gt;Also, helm charts do have a &lt;strong&gt;complexity ceiling&lt;/strong&gt;. Go Templating provides lots of flexibility, but being DRY is hard, and there are many parts of the process that are not optimal from a software development point of view. As&lt;br&gt;
charts become more complex, an &lt;a href="https://kubernetes.io/docs/concepts/extend-kubernetes/operator/"&gt;operator&lt;/a&gt; becomes increasingly beneficial as a mechanism to provide better software semantics to the application management process. However, the learning curve for operators can also be a bit steep.&lt;/p&gt;

&lt;p&gt;Finally, helm charts unfortunately &lt;strong&gt;do not have hard-and-fast standards about how values are used&lt;/strong&gt; across the ecosystem. As a result, you will often encounter wild variations in chart quality, value naming, and value behavior.&lt;/p&gt;
&lt;h2&gt;
  
  
  Hello World
&lt;/h2&gt;

&lt;p&gt;Let's get started on a hello world example! First, you need to &lt;a href="https://kubernetes.io/docs/tasks/tools/#kubectl"&gt;install kubectl&lt;/a&gt;, &lt;a href="https://helm.sh/docs/intro/install/"&gt;install helm&lt;/a&gt;, and have a kubernetes cluster available.  Once those things are taken care of, a hello world example of a helm deployment is pretty straightforward!&lt;/p&gt;

&lt;p&gt;For this example, we will use my &lt;a href="https://github.com/colearendt/helm/tree/main/charts/generic"&gt;generic chart&lt;/a&gt;, useful for deploying simple services with standard configuration or helm needs.&lt;/p&gt;

&lt;p&gt;We are also going to use &lt;a href="https://hub.docker.com/r/paulbouwer/hello-kubernetes"&gt;this hello-world container&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First, add the repository that houses our example chart:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm repo add colearendt https://colearendt.github.io/helm/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can look at the values available for the chart:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm show values colearendt/generic

# I like to pipe it to a pager for search and such
helm show values colearendt/generic | less
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then create a YAML file called &lt;em&gt;my-values.yaml&lt;/em&gt; to hold values:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;my-values.yaml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;image:
  repository: paulbouwer/hello-kubernetes
  tag: "1.10"
pod:
  port: 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then template the output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm template hello-world colearendt/generic -f my-values.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And install it into the Kubernetes cluster!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm upgrade --install hello-world colearendt/generic -f my-values.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you should be able to see the app deployed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm list
kubectl get pods
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And view the service in your web browser at &lt;a href="http://localhost:8080:"&gt;http://localhost:8080:&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl port-forward svc/hello-world-generic 8080:80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Clean Up
&lt;/h3&gt;

&lt;p&gt;If you want to clean up after yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# delete the helm release&lt;/span&gt;
helm delete hello-world

&lt;span class="c"&gt;# delete the repository reference&lt;/span&gt;
helm repo remove colearendt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unfortunately, I have not taken much time to dive into troubleshooting here! If you are hitting issues, please &lt;a href="//mailto:info@analogous.dev"&gt;shoot me an email&lt;/a&gt; - I would love to have feedback on what to improve! Maybe someday I will take the time to set up comments 😅&lt;/p&gt;

&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;p&gt;So now you have a "Hello World" deployment under your belt. However, it also helps to keep in mind some best practices as you keep improving. Below is a handful of helm chart conventions that may be unfamiliar if you are new to the community:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure to pin helm chart versions with the &lt;code&gt;--version&lt;/code&gt; flag&lt;/li&gt;
&lt;li&gt;Maintain a &lt;code&gt;NEWS.md&lt;/code&gt; file (or read the &lt;code&gt;NEWS.md&lt;/code&gt; file) to keep track of changes between versions&lt;/li&gt;
&lt;li&gt;Keep an eye out for "upgrading directions" in the &lt;code&gt;README.md&lt;/code&gt; or elsewhere&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;helm show values&lt;/code&gt; to see the default values (and comment strings associated). Ideally these are presented or discussed in a &lt;code&gt;README&lt;/code&gt; as well.&lt;/li&gt;
&lt;li&gt;Avoid &lt;a href="https://helm.sh/docs/chart_template_guide/subcharts_and_globals/"&gt;&lt;code&gt;sub-charts&lt;/code&gt;&lt;/a&gt; if you can. It is tempting as a DRY software principle, but turns out to be a pretty advanced topic with lots of tricky edge cases. In particular, namespaces can be painful.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cheat Sheet
&lt;/h2&gt;

&lt;p&gt;I took the time to arrange a "cheat sheet" of my favorite helm commands and the contexts in which they are useful. It was inspired by &lt;a href="https://www.rstudio.com/resources/cheatsheets/"&gt;RStudio's array of excellent cheat sheets for the R community&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A hit-list of some of the most useful commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;helm show values chartrepo/chartname&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;helm template releasename chartrepo/chartname&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;helm upgrade --install releasename chartrepo/chartname&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;helm repo add https://repourl&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;helm repo list&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;helm search repo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;helm info&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;helm list&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the cheat-sheet itself can be downloaded &lt;a href="https://www.analogous.dev/download/cheatsheet/helm.pdf"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://analogous.dev/download/cheatsheet/helm.pdf"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YAbYaE2J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iaw5xxshhng1p88lj78o.png" alt="Screen shot and link to download the PDF Cheatsheet" width="880" height="680"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://helm.sh/"&gt;helm project&lt;/a&gt; is an open source project. There is much that could be improved, and many applications that need helm charts or need&lt;br&gt;
improved helm charts. You can make a difference! If you are interested in learning more, check out the &lt;a href="https://dev.to/?tag=Helm"&gt;helm tag&lt;/a&gt; on this blog to see other writing on&lt;br&gt;
the topic, and start poking around on &lt;a href="https://artifacthub.io/"&gt;ArtifactHub&lt;/a&gt;, where lots of charts are centralized for easier searching!&lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://unsplash.com/es/@william07?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;william william&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/NndKt2kF1L4?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditShareLink"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>helm</category>
      <category>kubernetes</category>
      <category>cheatsheet</category>
      <category>docker</category>
    </item>
    <item>
      <title>Using sssd in a Playground Without TLS</title>
      <dc:creator>Cole Arendt</dc:creator>
      <pubDate>Sat, 01 Oct 2022 23:59:50 +0000</pubDate>
      <link>https://dev.to/colearendt/using-sssd-in-a-playground-without-tls-1590</link>
      <guid>https://dev.to/colearendt/using-sssd-in-a-playground-without-tls-1590</guid>
      <description>&lt;p&gt;&lt;a href="https://sssd.io/"&gt;&lt;code&gt;sssd&lt;/code&gt;&lt;/a&gt; has established itself as the most common way to provision system accounts via LDAP or Active Directory on linux servers across all linux distributions. However, working with it can be tricky!&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR;
&lt;/h2&gt;

&lt;p&gt;We show an example of using &lt;code&gt;sssd&lt;/code&gt; to contact an LDAP server that is listening on port 389 (in plaintext / no TLS). This is &lt;em&gt;NOT&lt;/em&gt; a good idea in any production environment. However, it can be important and helpful in playgrounds, learning, or other experiments. The magic configuration is &lt;code&gt;ldap_auth_disable_tls_never_use_in_production = true&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why
&lt;/h2&gt;

&lt;p&gt;It is quite straightforward to stand up an LDAP server listening in plaintext. My favorite mechanism is using the &lt;a href="https://github.com/osixia/docker-openldap"&gt;&lt;code&gt;openldap&lt;/code&gt; container&lt;/a&gt;, &lt;a href="https://github.com/nitnelave/lldap"&gt;although there are other options&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 389:389 osixia/openldap:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, if you have a toy linux container running &lt;code&gt;sssd&lt;/code&gt;, this is unfortunately not an obvious option! Why, you ask? This is all just a dev playground!? Right. Well the &lt;code&gt;sssd&lt;/code&gt; maintainers want to be very careful about not creating security vulnerabilities or letting their users get hacked. This means you have to work hard to open yourself up to this type of vulnerability in your playground.&lt;/p&gt;

&lt;p&gt;Specifically, we will use the &lt;code&gt;ldap_auth_disable_tls_never_use_in_production&lt;/code&gt; setting.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;NOTE: Do not use this setting in any "real" environment with "real" users, passwords, sensitive data, etc.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Give it a Shot
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create Users
&lt;/h3&gt;

&lt;p&gt;First, we need to create and populate our LDAP server. Let's go ahead and do that. It is easiest if we create a file with users first. For a more advanced LDIF file, check out &lt;a href="https://github.com/colearendt/container-playground"&gt;the repository associated with this post&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;users.ldif&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: 1

## Entry 1: dc=angl,dc=dev
#dn: dc=angl,dc=dev
#dc: angl
#o: Angl Dev
#objectclass: top
#objectclass: dcObject
#objectclass: organization
#
## Entry 2: cn=admin,dc=angl,dc=dev
#dn: cn=admin,dc=angl,dc=dev
#cn: admin
#description: LDAP administrator
#objectclass: simpleSecurityObject
#objectclass: organizationalRole
#userpassword: {SSHA}+FquX8RcwTtBPo7mu2pgSvjaQYX9HpCL
#
#
# Entry 3: cn=engineering_group,dc=angl,dc=dev
dn: cn=engineering_group,dc=angl,dc=dev
cn: engineering_group
gidnumber: 500
memberuid: joe
memberuid: julie
objectclass: posixGroup
objectclass: top

# Entry 4: dc=engineering,dc=angl,dc=dev
dn: dc=engineering,dc=angl,dc=dev
dc: engineering
description: The Engineering Department
o: Engineering
objectclass: dcObject
objectclass: organization
objectclass: top


# Entry 5: cn=joe,dc=engineering,dc=angl,dc=dev
dn: cn=joe,dc=engineering,dc=angl,dc=dev
cn: joe
gidnumber: 500
givenname: Joe
homedirectory: /home/joe
loginshell: /bin/sh
mail: joe@angl.dev
objectclass: inetOrgPerson
objectclass: posixAccount
objectclass: top
sn: Golly
uid: joe
uidnumber: 1000
userpassword: {MD5}j/MkifkvM0FmlL6P3C1MIg==

# Entry 9: cn=julie,dc=engineering,dc=angl,dc=dev
dn: cn=julie,dc=engineering,dc=angl,dc=dev
cn: julie
gidnumber: 500
givenname: Julie
homedirectory: /home/julie
loginshell: /bin/sh
mail: julie@angl.dev
objectclass: inetOrgPerson
objectclass: posixAccount
objectclass: top
sn: Jolly
uid: julie
uidnumber: 1001
userpassword: {MD5}FvEvXoN54ivpleUF6/wbhA==
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will notice that the first two entries are commented out. They are included to represent a &lt;em&gt;complete&lt;/em&gt; LDIF file. However, the &lt;code&gt;osixia/docker-openldap&lt;/code&gt; container help us by provisioning these automatically.&lt;/p&gt;

&lt;p&gt;Further, you will notice that passwords are included. This makes things easier for our playground, but is &lt;em&gt;definitely&lt;/em&gt; a bad idea in real life / production applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create LDAP Server
&lt;/h3&gt;

&lt;p&gt;Now let's create the server itself!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network create playground-network
docker run &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; openldap &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt; 389:389 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--network&lt;/span&gt; playground-network &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;/users.ldif:/container/service/slapd/assets/config/bootstrap/ldif/50-bootstrap.ldif &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;LDAP_TLS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;LDAP_DOMAIN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"angl.dev"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;LDAP_ADMIN_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"admin"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  osixia/openldap:1.5.0 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--copy-service&lt;/span&gt; &lt;span class="nt"&gt;--loglevel&lt;/span&gt; debug
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And check that it is working&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; openldap ldapsearch &lt;span class="nt"&gt;-D&lt;/span&gt; &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin,dc&lt;span class="o"&gt;=&lt;/span&gt;angl,dc&lt;span class="o"&gt;=&lt;/span&gt;dev &lt;span class="nt"&gt;-b&lt;/span&gt; &lt;span class="nv"&gt;dc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;angl,dc&lt;span class="o"&gt;=&lt;/span&gt;dev &lt;span class="nt"&gt;-w&lt;/span&gt; admin cn
docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; openldap ldapsearch &lt;span class="nt"&gt;-D&lt;/span&gt; &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin,dc&lt;span class="o"&gt;=&lt;/span&gt;angl,dc&lt;span class="o"&gt;=&lt;/span&gt;dev &lt;span class="nt"&gt;-b&lt;/span&gt; &lt;span class="nv"&gt;dc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;angl,dc&lt;span class="o"&gt;=&lt;/span&gt;dev &lt;span class="nt"&gt;-w&lt;/span&gt; admin &lt;span class="nv"&gt;cn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;julie &lt;span class="se"&gt;\*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you look carefully, you will notice that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We created a persistent network for our containers to share&lt;/li&gt;
&lt;li&gt;We provisioned users from our &lt;code&gt;ldif&lt;/code&gt; file&lt;/li&gt;
&lt;li&gt;We disabled TLS on the service&lt;/li&gt;
&lt;li&gt;We bumped up the logging verbosity for debugging purposes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These are all useful tidbits to dig into if you are not familiar!&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure sssd Server
&lt;/h3&gt;

&lt;p&gt;It is possible to run &lt;code&gt;sssd&lt;/code&gt; in a fairly vanilla &lt;code&gt;ubuntu:jammy&lt;/code&gt; container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; sssd &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;--network&lt;/span&gt; playground-network ubuntu:jammy bash

apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; sssd ldap-utils vim
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you need to create your &lt;code&gt;sssd.conf&lt;/code&gt; file. Notice our magic option &lt;code&gt;ldap_auth_disable_tls_never_use_in_production=true&lt;/code&gt;. This will be the magic that makes things work for us!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt; &amp;gt; /etc/sssd/sssd.conf
[sssd]
config_file_version = 2
services = nss, pam
domains = LDAP

[nss]
filter_users = root,named,avahi,haldaemon,dbus,radiusd,news,nscd
filter_groups =

[pam]

[domain/LDAP]
id_provider = ldap
auth_provider = ldap
chpass_provider = ldap
sudo_provider = ldap
enumerate = true
# ignore_group_members = true
cache_credentials = false
ldap_schema = rfc2307
ldap_uri = ldap://openldap:389
ldap_search_base = dc=angl,dc=dev
ldap_user_search_base = dc=angl,dc=dev
ldap_user_object_class = posixAccount
ldap_user_name = uid

ldap_group_search_base = dc=angl,dc=dev
ldap_group_object_class = posixGroup
ldap_group_name = cn
ldap_id_use_start_tls = false
ldap_tls_reqcert = never
ldap_tls_cacert = /etc/ssl/certs/ca-certificates.crt
ldap_default_bind_dn = cn=admin,dc=angl,dc=dev
ldap_default_authtok = admin
access_provider = ldap
ldap_access_filter = (objectClass=posixAccount)
min_id = 1
max_id = 0
ldap_user_uuid = entryUUID
ldap_user_shell = loginShell
ldap_user_home_directory = homeDirectory
ldap_user_uid_number = uidNumber
ldap_user_gid_number = gidNumber
ldap_group_gid_number = gidNumber
ldap_group_uuid = entryUUID
ldap_group_member = memberUid
ldap_auth_disable_tls_never_use_in_production = true
use_fully_qualified_names = false
ldap_access_order = filter
debug_level=6
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;600 /etc/sssd/sssd.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's start the &lt;code&gt;sssd&lt;/code&gt; service&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sssd &lt;span class="nt"&gt;-i&lt;/span&gt;
&lt;span class="c"&gt;# should see some log messages that suggest things are happening!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Be sure it works!
&lt;/h3&gt;

&lt;p&gt;Now let's make sure that this works by starting another shell in our &lt;code&gt;jammy&lt;/code&gt; container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; sssd bash

&lt;span class="nb"&gt;id &lt;/span&gt;joe
&lt;span class="c"&gt;# uid=1000(joe) gid=500(engineering_group) groups=500(engineering_group)&lt;/span&gt;
&lt;span class="nb"&gt;id &lt;/span&gt;julie
&lt;span class="c"&gt;# uid=1001(julie) gid=500(engineering_group) groups=500(engineering_group)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Using &lt;code&gt;docker-compose&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;For playground environments like this, &lt;code&gt;docker-compose&lt;/code&gt; makes this setup much easier to architect and reuse. You can use &lt;a href="https://github.com/colearendt/container-playground"&gt;my example compose setup&lt;/a&gt; in lieu of the above if you prefer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;compose/
docker network create playground-network
&lt;span class="nv"&gt;NETWORK&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;playground-network docker-compose &lt;span class="nt"&gt;-f&lt;/span&gt; ldap.yml &lt;span class="nt"&gt;-f&lt;/span&gt; sssd.yml &lt;span class="nt"&gt;-f&lt;/span&gt; network.yml up &lt;span class="nt"&gt;-d&lt;/span&gt;
docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; compose_sssd_1 bash

sssd &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/tmp/sssd.log 2&amp;gt;&amp;amp;1 &amp;amp;
&lt;span class="nb"&gt;id &lt;/span&gt;joe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Review
&lt;/h2&gt;

&lt;p&gt;Well done! You have successfully started your own &lt;code&gt;sssd&lt;/code&gt; container. Although this is very much a toy, it is a great "jumping off point" to learn and understand how &lt;code&gt;sssd&lt;/code&gt; works in more detail!&lt;/p&gt;

&lt;p&gt;Any time you need a toy LDAP server for &lt;code&gt;sssd&lt;/code&gt;, just remember: &lt;code&gt;ldap_auth_disable_tls_never_use_in_production = true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@dylu?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Jacek Dylag&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/PMxT0XtQ--A?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditShareLink"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>authentication</category>
      <category>beginners</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
