<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Tech @ languidnights - server</title><link href="https://blog.languidnights.com/tech/" rel="alternate"></link><link href="https://blog.languidnights.com/tech/feeds/server.atom.xml" rel="self"></link><id>https://blog.languidnights.com/tech/</id><updated>2024-08-30T00:00:00-04:00</updated><entry><title>Tmux + SSH</title><link href="https://blog.languidnights.com/tech/tmux-ssh.html" rel="alternate"></link><published>2024-08-30T00:00:00-04:00</published><updated>2024-08-30T00:00:00-04:00</updated><author><name>Christopher R. Nelson</name></author><id>tag:blog.languidnights.com,2024-08-30:/tech/tmux-ssh.html</id><summary type="html">&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title"&gt;&lt;a class="reference internal" href="#top"&gt;Contents&lt;/a&gt;&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#problem-statement" id="toc-entry-1"&gt;Problem Statement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#v-and-the-terrible-horrible-no-good-very-bad-solution" id="toc-entry-2"&gt;V and the Terrible, Horrible, No Good, Very Bad Solution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#so-s-good-solution" id="toc-entry-3"&gt;SO's good solution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#why-write-this-post" id="toc-entry-4"&gt;Why write this post?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="problem-statement"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Problem Statement&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I like ssh (I have servers I do not physically sit at, and I pay for their
usages, so I'd rather not uselessly invoke a rdp/vnc server …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title"&gt;&lt;a class="reference internal" href="#top"&gt;Contents&lt;/a&gt;&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#problem-statement" id="toc-entry-1"&gt;Problem Statement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#v-and-the-terrible-horrible-no-good-very-bad-solution" id="toc-entry-2"&gt;V and the Terrible, Horrible, No Good, Very Bad Solution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#so-s-good-solution" id="toc-entry-3"&gt;SO's good solution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#why-write-this-post" id="toc-entry-4"&gt;Why write this post?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="problem-statement"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Problem Statement&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I like ssh (I have servers I do not physically sit at, and I pay for their
usages, so I'd rather not uselessly invoke a rdp/vnc server). I like tmux,
because terminal multiplexing is right and proper. I pretty much always do
&lt;tt class="docutils literal"&gt;tmux attach &lt;span class="pre"&gt;-t&lt;/span&gt; admin || tmux new &lt;span class="pre"&gt;-t&lt;/span&gt; admin&lt;/tt&gt; upon logging in. Automation is
good, &lt;a class="reference external" href="https://xkcd.com/1205/"&gt;generally&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="v-and-the-terrible-horrible-no-good-very-bad-solution"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;V and the Terrible, Horrible, No Good, Very Bad Solution&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You /can/ do the following in your .bashrc. You shouldn't, for a varienty of
reasons, but you can...&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;tmux&lt;span class="w"&gt; &lt;/span&gt;attach&lt;span class="w"&gt; &lt;/span&gt;-t&lt;span class="w"&gt; &lt;/span&gt;admin&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;||&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;tmux&lt;span class="w"&gt; &lt;/span&gt;new&lt;span class="w"&gt; &lt;/span&gt;-t&lt;span class="w"&gt; &lt;/span&gt;admin
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What? You don't ever use scp? or git? or pelican's &lt;cite&gt;make ssh_upload&lt;/cite&gt;? I like
all three, so this is a dirty nasty hack for me.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="so-s-good-solution"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;SO's good solution&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="https://stackoverflow.com"&gt;StackOverflow&lt;/a&gt; not Significant Other (though as a hobbyist dev/sysadmin, may
as well be the same) had the &lt;a class="reference external" href="https://stackoverflow.com/a/27614878"&gt;correct answer&lt;/a&gt;. Use 'new' ssh and tmux! Inside
&amp;quot;$HOME&amp;quot;/.ssh/config:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="na"&gt;Host &amp;lt;host&amp;gt;+tmux&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="na"&gt;Hostname &amp;lt;host&amp;gt;.&amp;lt;tld&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="na"&gt;User &amp;lt;user&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="na"&gt;RequestTTY yes&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="na"&gt;RemoteCommand tmux new -A -s admin&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Tells ssh to execute tmux new with the '-A' flag, with tells it to attempt to
attach to the admin session, then create it if the session doesn't exist.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="why-write-this-post"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;Why write this post?&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I predict this site will disappear before SO, but my memory is fickle and bad,
and this site is kinda like a notebook of important info for me.&lt;/p&gt;
&lt;/div&gt;
</content><category term="server"></category></entry><entry><title>cgit+gitolite+nginx</title><link href="https://blog.languidnights.com/tech/cgitgitolitenginx.html" rel="alternate"></link><published>2024-01-21T00:00:00-05:00</published><updated>2024-01-21T00:00:00-05:00</updated><author><name>Christopher R. Nelson</name></author><id>tag:blog.languidnights.com,2024-01-21:/tech/cgitgitolitenginx.html</id><summary type="html">&lt;div class="section" id="our-goal"&gt;
&lt;h2&gt;Our Goal&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="section" id="the-easy-part"&gt;
&lt;h2&gt;The Easy Part&lt;/h2&gt;
&lt;p&gt;Nginx is fun, and I've used it before with fastcgi. Let's do the easy
parts. I've already set gitolite3's UMASK to be a bit less righteous for
interoperability with git-daemon+xinited, so we'll move on to the new
configuration.&lt;/p&gt;
&lt;pre class="code bash literal-block"&gt;
apt-get&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;fcgiwrap&lt;span class="w"&gt;
&lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;enable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;fcgiwrap …&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;div class="section" id="our-goal"&gt;
&lt;h2&gt;Our Goal&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="section" id="the-easy-part"&gt;
&lt;h2&gt;The Easy Part&lt;/h2&gt;
&lt;p&gt;Nginx is fun, and I've used it before with fastcgi. Let's do the easy
parts. I've already set gitolite3's UMASK to be a bit less righteous for
interoperability with git-daemon+xinited, so we'll move on to the new
configuration.&lt;/p&gt;
&lt;pre class="code bash literal-block"&gt;
apt-get&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;fcgiwrap&lt;span class="w"&gt;
&lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;enable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;fcgiwrap&lt;span class="w"&gt;
&lt;/span&gt;chmod&lt;span class="w"&gt; &lt;/span&gt;-R&lt;span class="w"&gt; &lt;/span&gt;go-rwx&lt;span class="w"&gt; &lt;/span&gt;/var/lib/gitolite3&lt;span class="w"&gt;
&lt;/span&gt;chmod&lt;span class="w"&gt; &lt;/span&gt;-R&lt;span class="w"&gt; &lt;/span&gt;g+rx&lt;span class="w"&gt; &lt;/span&gt;/var/lib/gitolite3&lt;span class="w"&gt;
&lt;/span&gt;adduser&lt;span class="w"&gt; &lt;/span&gt;www-data&lt;span class="w"&gt; &lt;/span&gt;gitolite3
&lt;/pre&gt;
&lt;pre class="code nginx literal-block"&gt;
&lt;span class="k"&gt;server&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="kn"&gt;server_name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;projects.languidnights.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="kn"&gt;listen&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;443&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="kn"&gt;list&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;[::]:443&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;

       &lt;/span&gt;&lt;span class="kn"&gt;gzip&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="no"&gt;off&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;

       &lt;/span&gt;&lt;span class="kn"&gt;location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;/cgit/&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
           &lt;/span&gt;&lt;span class="kn"&gt;root&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;/usr/lib/cgit/&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
           &lt;/span&gt;&lt;span class="kn"&gt;include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;fastcgi_params&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
           &lt;/span&gt;&lt;span class="kn"&gt;fastcgi_param&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;SCRIPT_FILENAME&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;/usr/lib/cgit/cgit.cgi&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
           &lt;/span&gt;&lt;span class="kn"&gt;fastcgi_pass&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="s"&gt;unix:/run/fcgiwrap.socket&lt;/span&gt;&lt;span class="w"&gt;
           &lt;/span&gt;&lt;span class="s"&gt;fastcgi_param&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;QUERY_STRING&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$args&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
           &lt;/span&gt;&lt;span class="kn"&gt;fastcgi_param&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;HTTP_HOST&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$server_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

       &lt;/span&gt;&lt;span class="kn"&gt;location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;/cgit-css/&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
           &lt;/span&gt;&lt;span class="kn"&gt;root&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;/usr/share/cgit/&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
       &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="problem-numero-uno"&gt;
&lt;h2&gt;Problem Numero Uno&lt;/h2&gt;
&lt;p&gt;What do you mean I can't see the stylesheets and images? Oh, you want it
to be an alias, not a directory. I got it&lt;/p&gt;
&lt;p&gt;/etc/nginx/sites-enabled/projects&lt;/p&gt;
&lt;pre class="code diff literal-block"&gt;
&lt;span class="gd"&gt;--- a        2024-01-21 05:54:37.553311062 +0000&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gi"&gt;+++ b        2024-01-21 05:54:54.113321210 +0000&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gu"&gt;&amp;#64;&amp;#64; -48,6 +48,6 &amp;#64;&amp;#64;&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;      }&lt;span class="w"&gt;

 &lt;/span&gt;      location /cgit-css/ {&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gd"&gt;-            root /usr/share/cgit/;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gi"&gt;+            alias /usr/share/cgit/;&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;      }&lt;span class="w"&gt;
&lt;/span&gt;}
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="let-s-configure-cgit"&gt;
&lt;h2&gt;Let's configure cgit&lt;/h2&gt;
&lt;p&gt;It's got a pretty good man page &lt;code&gt;man 5 cgitrc&lt;/code&gt; and I did this in
the before times with gitolite2, so let's go.&lt;/p&gt;
&lt;pre class="code cfg literal-block"&gt;
&lt;span class="na"&gt;css&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/cgit-css/cgit.css&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="na"&gt;logo&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/cgit-css/cgit.png&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="na"&gt;favicon&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/cgit-css/favicon.ico&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="na"&gt;root-title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;LanguidNights' Git Repositories&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="na"&gt;root-desc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;various and sundry&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="na"&gt;enable-index-links&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="na"&gt;enable-git-config&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="na"&gt;remove-suffix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="na"&gt;project-list&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/var/lib/gitolite3/projects.list&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="na"&gt;scan-path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/var/lib/gitolite3/repositories&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="so-far"&gt;
&lt;h2&gt;So Far&lt;/h2&gt;
&lt;p&gt;It works beautifully. That is, if you happen to be sitting on the server
and part of the www-data group.&lt;/p&gt;
&lt;pre class="code bash literal-block"&gt;
sudo&lt;span class="w"&gt; &lt;/span&gt;-u&lt;span class="w"&gt; &lt;/span&gt;www-data&lt;span class="w"&gt; &lt;/span&gt;/usr/lib/cgit/cgit.cgi
&lt;/pre&gt;
&lt;p&gt;If, like me, you want your &lt;em&gt;website&lt;/em&gt; for your git repos to be viewable
on the &lt;em&gt;web&lt;/em&gt;, still no joy. It just says 'no repositories found'. I know
that's a lie, cgit! Give me your secrets, I'm going mad and it's past
midnight! Nothing in my error logs, nothings in my access logs, nothing
in my syslog. What is going on?&lt;/p&gt;
&lt;pre class="code bash literal-block"&gt;
ls&lt;span class="w"&gt; &lt;/span&gt;-l&lt;span class="w"&gt; &lt;/span&gt;/var/lib/gitolite3&lt;span class="w"&gt;
&lt;/span&gt;cat&lt;span class="w"&gt; &lt;/span&gt;/var/lib/gitolite3/projects.list&lt;span class="w"&gt;
&lt;/span&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;restart&lt;span class="w"&gt; &lt;/span&gt;fcgiwrap.socket&lt;span class="w"&gt; &lt;/span&gt;fcgiwrap.service&lt;span class="w"&gt; &lt;/span&gt;nginx.service
&lt;/pre&gt;
&lt;p&gt;And no joy! You're lucky I'm bald, or I'd have thrown handfuls of my own
hair at you!&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="the-final-pieces"&gt;
&lt;h2&gt;The Final Pieces&lt;/h2&gt;
&lt;p&gt;Courtesy of &lt;a class="reference external" href="https://bbs.archlinux.org/viewtopic.php?id=194743"&gt;The Arch Linux BBS&lt;/a&gt; I finally got the last piece, which I
missed in all the relevant documentation. It consisted of two parts&lt;/p&gt;
&lt;p&gt;/etc/cgitrc&lt;/p&gt;
&lt;pre class="code diff literal-block"&gt;
&lt;span class="gd"&gt;--- a        2024-01-21 05:42:37.240863180 +0000&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gi"&gt;+++ b        2024-01-21 05:42:28.244857393 +0000&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gu"&gt;&amp;#64;&amp;#64; -6,6 +6,7 &amp;#64;&amp;#64;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;logo=/cgit-css/cgit.png&lt;span class="w"&gt;
&lt;/span&gt;favicon=/cgit-css/favicon.ico&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="gi"&gt;+virtual-root=/cgit/&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;root-title=LanguidNight's Git Repositories&lt;span class="w"&gt;
&lt;/span&gt;root-desc=various and sundry&lt;span class="w"&gt;
&lt;/span&gt;enable-index-links=1
&lt;/pre&gt;
&lt;p&gt;/etc/nginx/sites-enabled/projects&lt;/p&gt;
&lt;pre class="code diff literal-block"&gt;
&lt;span class="gd"&gt;--- a        2024-01-21 05:32:23.356460060 +0000&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gi"&gt;+++ b        2024-01-21 05:32:12.704453273 +0000&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gu"&gt;&amp;#64;&amp;#64; -43,6 +43,8 &amp;#64;&amp;#64;&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;      fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;&lt;span class="w"&gt;
 &lt;/span&gt;      fastcgi_pass  unix:/run/fcgiwrap.socket;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="gi"&gt;+    fastcgi_split_path_info         ^(/cgit/?)(.+)$;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gi"&gt;+    fastcgi_param   PATH_INFO       $fastcgi_path_info;&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;      fastcgi_param QUERY_STRING    $args;&lt;span class="w"&gt;
 &lt;/span&gt;      fastcgi_param HTTP_HOST       $server_name;&lt;span class="w"&gt;
&lt;/span&gt;}
&lt;/pre&gt;
&lt;p&gt;And, we have joy. My life is now better than it was a 3:00pm at least,
and I can finally go to bed. Well, just as soon as I write this up for
posterity.&lt;/p&gt;
&lt;/div&gt;
</content><category term="server"></category></entry><entry><title>Mail Server Setup</title><link href="https://blog.languidnights.com/tech/mail-server-setup.html" rel="alternate"></link><published>2022-03-18T00:00:00-04:00</published><updated>2022-11-03T00:00:00-04:00</updated><author><name>Christopher R. Nelson</name></author><id>tag:blog.languidnights.com,2022-03-18:/tech/mail-server-setup.html</id><summary type="html">&lt;p&gt;I've taken great pains to get my mail server set up both the way I want
it and correctly. I'm now sharing that knowledge with the internet as a
whole, as well as myself when I need to figure out &lt;a class="reference external" href="https://www.nimh.nih.gov/health/topics/bipolar-disorder"&gt;wtf&lt;/a&gt; I did.&lt;/p&gt;
&lt;div class="contents topic" id="table-of-contents"&gt;
&lt;p class="topic-title"&gt;&lt;a class="reference internal" href="#top"&gt;Table of Contents&lt;/a&gt;&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#note" id="toc-entry-1"&gt;NOTE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#setting-up-virtual-mail-users-and-authentication-through-dovecot" id="toc-entry-2"&gt;Setting up virtual …&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;I've taken great pains to get my mail server set up both the way I want
it and correctly. I'm now sharing that knowledge with the internet as a
whole, as well as myself when I need to figure out &lt;a class="reference external" href="https://www.nimh.nih.gov/health/topics/bipolar-disorder"&gt;wtf&lt;/a&gt; I did.&lt;/p&gt;
&lt;div class="contents topic" id="table-of-contents"&gt;
&lt;p class="topic-title"&gt;&lt;a class="reference internal" href="#top"&gt;Table of Contents&lt;/a&gt;&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#note" id="toc-entry-1"&gt;NOTE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#setting-up-virtual-mail-users-and-authentication-through-dovecot" id="toc-entry-2"&gt;Setting up virtual mail users and authentication through Dovecot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#setting-up-postfix-to-authenticate-through-dovecot" id="toc-entry-3"&gt;Setting up Postfix to authenticate through Dovecot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#amavis-spamassassin-and-clamav" id="toc-entry-4"&gt;Amavis: Spamassassin and ClamAV&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#thanks" id="toc-entry-5"&gt;Thanks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="note"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#table-of-contents"&gt;NOTE&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This article should be considered archived as of 2023-02-09. I have
abandoned the maintenance of my own email solution for &lt;a class="reference external" href="https://proton.me"&gt;ProtonMail&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="setting-up-virtual-mail-users-and-authentication-through-dovecot"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#table-of-contents"&gt;Setting up virtual mail users and authentication through Dovecot&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;My goal here was to use LDAP for authentication and creation of
mailboxes for &amp;quot;virtual users&amp;quot; (ie, they don't exist in /etc/password and
have home directory). I set it up this way so that I could set up
mailboxes for application accounts and get their mail delivered to a
predictable place and be able to access it through IMAP without having
to have it clutter my actual mailbox.&lt;/p&gt;
&lt;p&gt;The bulk of the 'fun stuff' is in /etc/dovecot/dovecot-ldap.conf.ext -
it's well commented, so I'm just going to list the settings I changed.
For purposes of cleanliness, I'm going to use 'example.com' and 'not the
real password' where appropriate :-) I'm using a fairly standard simple
bind.&lt;/p&gt;
&lt;pre class="literal-block"&gt;
hosts = localhost
dn = cn=admin,dc=example,dc=com
dnpass = not the real password
auth_bind_userdn = uid=%u,ou=People,dc=example,dc=com
&lt;/pre&gt;
&lt;p&gt;Here's I'm checking the users and passwords against the mail attribute
on the LDAP account. I'm then &lt;em&gt;ignoring&lt;/em&gt; interesting parts of the
results to store all mail under a 'vmail' user with uid and gid of 5000
and a subdirectory named after the real users. Dovecot finds this
location both when delivering and serving, so no further setup here
needed.&lt;/p&gt;
&lt;pre class="literal-block"&gt;
base = dc=example,dc=com
user_attrs = 5000=uid,5000=gid,home=/var/vmail/%u
user_filter = (&amp;amp;objectClass=posixAccount)(mail=%n&amp;#64;example.com)
pass_attrs = uid=user,userPassword=password,homeDirectory=/var/vmail/%u
pass_filter = (&amp;amp;objectClass=posixAccount)(mail=%n&amp;#64;example.com)
&lt;/pre&gt;
&lt;p&gt;After this, I just have to wire it up in conf.d/auth-ldap.conf.ext to
use ldap for password lookups and semi-hardcoded user lookups---don't
validate the user and assume they get mail to /var/vmail/{username}&lt;/p&gt;
&lt;pre class="literal-block"&gt;
passdb {
      driver = ldap
      args = /etc/dovecot/dovecot-ldap.conf.ext
}
userdb {
      driver = static
      args = uid=vmail gid=vmail home=/var/vmail/%u
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="setting-up-postfix-to-authenticate-through-dovecot"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#table-of-contents"&gt;Setting up Postfix to authenticate through Dovecot&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Because I spent so much time getting authentication working for Dovecot,
let's just re-use it for postfix because the same users are trying to
send mail as are receiving it.&lt;/p&gt;
&lt;p&gt;In /etc/dovecot/conf.d/10-master.conf&lt;/p&gt;
&lt;pre class="literal-block"&gt;
# Setup the socket for postfix to authentical against
service auth {
      unix-listener /var/spool/postfix/private/auth {
              mode = 0666
      }
}
&lt;/pre&gt;
&lt;p&gt;In /etc/postfix/main.cf for authentication&lt;/p&gt;
&lt;pre class="literal-block"&gt;
# SASL authentication
smtpd_sasl_type = dovecot
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_sasl_path = private/auth
&lt;/pre&gt;
&lt;p&gt;In /etc/postfix/main.cf for mail delivery&lt;/p&gt;
&lt;pre class="literal-block"&gt;
# Postfix MDA
mailbox_transport = dovecot
mailbox_commant = /usr/lib/dovecot/dovecot-lda -a &amp;quot;$RECIPIENT&amp;quot;
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
&lt;/pre&gt;
&lt;p&gt;In /etc/postfix/master.cf before the non-posix services&lt;/p&gt;
&lt;pre class="literal-block"&gt;
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/dovecot-lda -f ${sender} -d ${user} -a ${recipient}
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="amavis-spamassassin-and-clamav"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#table-of-contents"&gt;Amavis: Spamassassin and ClamAV&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Install but &lt;em&gt;do not&lt;/em&gt; enable spamassassin. Amavis will take care of
launching a scanner as it scans emails. When I &lt;em&gt;enabled&lt;/em&gt; the
spamassassin daemon, I ended up with all cpu cores fully utilized.&lt;/p&gt;
&lt;p&gt;Install and &lt;em&gt;do&lt;/em&gt; enable clamav-daemon. Amavis can use the daemon for a
bit of a computational advantage.&lt;/p&gt;
&lt;p&gt;Install Amavis and configure it to use spamassassin and clamav. As I'm
using Debian, I updated the 15-content_filter_mode to uncomment the
virus_checks and spam_checks lines&lt;/p&gt;
&lt;pre class="literal-block"&gt;
use strict;

# You can modify this file to re-enable SPAM checking through spamassassin
# and to re-enable antivirus checking.

# Default antivirus checking mode
# Please note, that anti-virus checking is DISABLED by
# default.
# If you wish to enable it, please uncomment the following line:

&amp;#64;bypass_virus_checks_maps = (
  %bypass_virus_checks, &amp;#64;bypass_virus_checks_acl,
  $bypass_virus_checks_re);

# Default SPAM checking mode
# Please note, that anti-spam checking is DISABLED by
# default.
# If You wish to enable it, please uncomment the following lines:
&amp;#64;bypass_spam_checks_maps = (
  %bypass_spam_checks, &amp;#64;bypass_spam_checks_acl,
  $bypass_spam_checks_re);

1;  # ensure a defined return
&lt;/pre&gt;
&lt;p&gt;At the end of the postfix &lt;cite&gt;master.cf&lt;/cite&gt; file, I added the following lines
to shunt the email to Amavis.&lt;/p&gt;
&lt;pre class="literal-block"&gt;
smtp-amavis  unix       -      -       -       -       2       smtp
  -o smtp_data_done_timeout=1200
  -o smtp_send_xforward_command=yes
  -o disable_dns_lookups=yes
  -o max_use=20

127.0.0.1:10025 inet    n      -       -       -       -       smtpd
     -o content_filter=
     -o smtpd_delay_reject=no
     -o smtpd_client_restrictions=permit_mynetworks,reject
     -o smtpd_helo_restrictions=
     -o smtpd_sender_restrictions=
     -o smtpd_recipient_restrictions=permit_mynetworks,reject
     -o smtpd_data_restrictions=reject_unauth_pipelining
     -o smtpd_end_of_data_restrictions=
     -o smtpd_restriction_classes=
     -o mynetworks=127.0.0.0/8
     -o smtpd_error_sleep_time=0
     -o smtpd_soft_error_limit=1001
     -o smtpd_hard_error_limit=1000
     -o smtpd_client_connection_count_limit=0
     -o smtpd_client_connection_rate_limit=0
     -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters
     -o local_header_rewrite_clients=
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="thanks"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#table-of-contents"&gt;Thanks&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;These fine projects have been used as my tools of choice in serving
mail.&lt;/p&gt;
&lt;a class="reference external image-reference" href="https://dovecot.org"&gt;
&lt;img alt="Dovecot logo" src="https://dovecot.org/dovecot.png" style="width: 10%;" /&gt;
&lt;/a&gt;
&lt;a class="reference external image-reference" href="http://www.postfix.org"&gt;
&lt;img alt="Postfix logo" src="images/mysza.gif" style="width: 10%;" /&gt;
&lt;/a&gt;
&lt;a class="reference external image-reference" href="https://www.clamav.net"&gt;
&lt;img alt="clamav logo" src="https://www.clamav.net/assets/clamav-trademark.png" style="width: 10%;" /&gt;
&lt;/a&gt;
&lt;a class="reference external image-reference" href="https://spamassassin.apache.org"&gt;
&lt;img alt="spamassassin logo" src="images/spamassassin.png" style="width: 10%;" /&gt;
&lt;/a&gt;
&lt;/div&gt;
</content><category term="server"></category></entry><entry><title>(open)LDAP lessons</title><link href="https://blog.languidnights.com/tech/openldap-lessons.html" rel="alternate"></link><published>2022-03-18T00:00:00-04:00</published><updated>2022-11-03T00:00:00-04:00</updated><author><name>Christopher R. Nelson</name></author><id>tag:blog.languidnights.com,2022-03-18:/tech/openldap-lessons.html</id><summary type="html">&lt;a class="reference external image-reference" href="https://openldap.org"&gt;
&lt;img alt="openLDAP logo" src="https://openldap.org/images/headers/LDAPworm.gif" style="width: 20%;" /&gt;
&lt;/a&gt;
&lt;p&gt;I've set up LDAP a couple times in a personal capacity, and I'm sharing
this if anyone's interested, or if I need to come back to it.&lt;/p&gt;
&lt;div class="contents topic" id="table-of-contents"&gt;
&lt;p class="topic-title"&gt;&lt;a class="reference internal" href="#top"&gt;Table of Contents&lt;/a&gt;&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#adding-a-search-index-field" id="toc-entry-1"&gt;Adding a search index field&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#add-a-user" id="toc-entry-2"&gt;Add A User&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#thanks-to" id="toc-entry-3"&gt;Thanks to&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="adding-a-search-index-field"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#table-of-contents"&gt;Adding a search index field&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I've had slapd running for …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;a class="reference external image-reference" href="https://openldap.org"&gt;
&lt;img alt="openLDAP logo" src="https://openldap.org/images/headers/LDAPworm.gif" style="width: 20%;" /&gt;
&lt;/a&gt;
&lt;p&gt;I've set up LDAP a couple times in a personal capacity, and I'm sharing
this if anyone's interested, or if I need to come back to it.&lt;/p&gt;
&lt;div class="contents topic" id="table-of-contents"&gt;
&lt;p class="topic-title"&gt;&lt;a class="reference internal" href="#top"&gt;Table of Contents&lt;/a&gt;&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#adding-a-search-index-field" id="toc-entry-1"&gt;Adding a search index field&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#add-a-user" id="toc-entry-2"&gt;Add A User&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#thanks-to" id="toc-entry-3"&gt;Thanks to&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="adding-a-search-index-field"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#table-of-contents"&gt;Adding a search index field&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I've had slapd running for a long time without any &lt;em&gt;functional&lt;/em&gt; errors,
but the daemon would often tell me that the mail field wasn't indexed
and it could be. Now, I'm not the sort of target that would be worth
denial-of-service attacks against my LDAP database, but it's still
worthwhile to clean it up (if for no other reason that to tidy syslog!).&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;slapd&lt;span class="o"&gt;[&lt;/span&gt;pid&lt;span class="o"&gt;]&lt;/span&gt;:&lt;span class="w"&gt; &lt;/span&gt;&amp;lt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;mdb_equality_candidates:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;mail&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;not&lt;span class="w"&gt; &lt;/span&gt;indexed
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To fix this, I set about scouring the internet. Most of the results I
found were how to fix the issue in the 1995-era technical reference or
discussions about modifying &amp;quot;slapd.conf&amp;quot; and running slaptest. I didn't
use a semi-modern version of openldap just to resurrect the old config
format, use it, then throw it back away! There had to be a better
option. And there is! I found hints on &lt;a class="reference external" href="https://wiki.debian.org/LDAP/OpenLDAPSetup"&gt;Debian's wiki&lt;/a&gt; which led me to
my ultimate solution to this annoyance. Debian used a heredoc but I'm
nowhere near confident in either my typing nor my copy-pasting to use
one, so I created a file with the interesting index.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;dn:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;olcDatabase&lt;/span&gt;&lt;span class="o"&gt;={&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;mdb,cn&lt;span class="o"&gt;=&lt;/span&gt;config
changetype:&lt;span class="w"&gt; &lt;/span&gt;modify
add:&lt;span class="w"&gt; &lt;/span&gt;olcDbIndex
olcDbIndex:&lt;span class="w"&gt; &lt;/span&gt;mail&lt;span class="w"&gt; &lt;/span&gt;pres,sub,eq
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then, I used ldapmodify to update add the index to the LDAP directory.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo&lt;span class="w"&gt; &lt;/span&gt;ldapmodify&lt;span class="w"&gt; &lt;/span&gt;-Y&lt;span class="w"&gt; &lt;/span&gt;EXTERNAL&lt;span class="w"&gt; &lt;/span&gt;-H&lt;span class="w"&gt; &lt;/span&gt;ldapi:///&lt;span class="w"&gt; &lt;/span&gt;-f&lt;span class="w"&gt; &lt;/span&gt;add_index.ldif
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;All good now, nice clean logfiles and an LDAP doesn't have to struggle
so much!&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="add-a-user"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#table-of-contents"&gt;Add A User&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Create an adduser.ldif file with the following info (for my mail and
user setup, yours may vary). Substite the values in &lt;tt class="docutils literal"&gt;${ .. }&lt;/tt&gt; with
pertinent details of your site. Then execute the ldapmodify command.
This will ask for your password on the command line.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ldapmodify&lt;span class="w"&gt; &lt;/span&gt;-x&lt;span class="w"&gt; &lt;/span&gt;-D&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;admin&lt;/span&gt;&lt;span class="p"&gt; LDAP path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-W&lt;span class="w"&gt; &lt;/span&gt;-H&lt;span class="w"&gt; &lt;/span&gt;ldapi:///&lt;span class="w"&gt; &lt;/span&gt;-f&lt;span class="w"&gt; &lt;/span&gt;adduser.ldif
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Example adduser.ldif&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;dn:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;uid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;username&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;,ou&lt;span class="o"&gt;=&lt;/span&gt;People,dc&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;domain&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;,dc&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;tld&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
changetype:&lt;span class="w"&gt; &lt;/span&gt;add
objectClass:&lt;span class="w"&gt; &lt;/span&gt;inetOrgPerson
objectClass:&lt;span class="w"&gt; &lt;/span&gt;person
objectClass:&lt;span class="w"&gt; &lt;/span&gt;posixAccount
ou:&lt;span class="w"&gt; &lt;/span&gt;People
uid:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;username&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
cn:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="p"&gt; given name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
sn:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="p"&gt; family name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
givenName:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="p"&gt; given name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
displayName:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="p"&gt; display name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
initials:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="p"&gt; initials&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
uidNumber:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="p"&gt; numeric uid&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
gidNumber:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="p"&gt; numeric gid&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
homeDirectory:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;full&lt;/span&gt;&lt;span class="p"&gt; path to user home directory&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
loginShell:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;full&lt;/span&gt;&lt;span class="p"&gt; path to user login shell&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
mail:&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="p"&gt; email address&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="thanks-to"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#table-of-contents"&gt;Thanks to&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I'd like to thanks &lt;a class="reference external" href="https://openldap.org"&gt;openLDAP&lt;/a&gt; for the relatively simple directory
servers/clients and &lt;a class="reference external" href="https://wiki.debian.org/LDAP/OpenLDAPSetup"&gt;Debian's wiki&lt;/a&gt; for the information I needed to
make sense of the configuration.&lt;/p&gt;
&lt;/div&gt;
</content><category term="server"></category></entry><entry><title>ReST in Jekyll</title><link href="https://blog.languidnights.com/tech/rest-in-jekyll.html" rel="alternate"></link><published>2022-03-18T00:00:00-04:00</published><updated>2023-02-09T00:00:00-05:00</updated><author><name>Christopher R. Nelson</name></author><id>tag:blog.languidnights.com,2022-03-18:/tech/rest-in-jekyll.html</id><summary type="html">&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title"&gt;&lt;a class="reference internal" href="#top"&gt;Contents&lt;/a&gt;&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#note" id="toc-entry-1"&gt;NOTE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-story-of-markup" id="toc-entry-2"&gt;A Story of Markup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-story-of-dependencies" id="toc-entry-3"&gt;A Story of Dependencies&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-story-of-gems" id="toc-entry-4"&gt;A Story of Gems&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-story-of-reference" id="toc-entry-5"&gt;A Story of Reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-story-of-the-future" id="toc-entry-6"&gt;A Story of the Future&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#tl-dr" id="toc-entry-7"&gt;TL;DR&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="note"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;NOTE&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This article should be considered archived. No further updates are
expected. For ReST-flavoured blogging, please see &lt;a class="reference external" href="https://docs.getpelican.com/en/latest/index.html"&gt;Pelican&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="a-story-of-markup"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;A Story of Markup&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="https://jekyllrb.com/"&gt;Jekyll&lt;/a&gt;, by default …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;div class="contents topic" id="contents"&gt;
&lt;p class="topic-title"&gt;&lt;a class="reference internal" href="#top"&gt;Contents&lt;/a&gt;&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;a class="reference internal" href="#note" id="toc-entry-1"&gt;NOTE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-story-of-markup" id="toc-entry-2"&gt;A Story of Markup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-story-of-dependencies" id="toc-entry-3"&gt;A Story of Dependencies&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-story-of-gems" id="toc-entry-4"&gt;A Story of Gems&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-story-of-reference" id="toc-entry-5"&gt;A Story of Reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#a-story-of-the-future" id="toc-entry-6"&gt;A Story of the Future&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="reference internal" href="#tl-dr" id="toc-entry-7"&gt;TL;DR&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="note"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;NOTE&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This article should be considered archived. No further updates are
expected. For ReST-flavoured blogging, please see &lt;a class="reference external" href="https://docs.getpelican.com/en/latest/index.html"&gt;Pelican&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="a-story-of-markup"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;A Story of Markup&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a class="reference external" href="https://jekyllrb.com/"&gt;Jekyll&lt;/a&gt;, by default, does not support writing your static page/blog in
Restructured Text, or &lt;a class="reference external" href="https://docutils.sourceforge.io/rst.html"&gt;ReST&lt;/a&gt;. I came at my personal projects from the
Python world, where ReST is commonly used. I, therefore, am much more
comfortable in the ReST world than am I in the &lt;a class="reference external" href="https://daringfireball.net/projects/markdown/"&gt;Markdown&lt;/a&gt; or
&lt;a class="reference external" href="https://textile-lang.com/"&gt;Textile&lt;/a&gt;. Naturally, I went looking for a Jekyll RST plugin. There was
only one I could find, and it was sufficiently old as to no longer work
with modern docutils setups, so, rather than tie myself down to an
ancient docutils, I decided to modernize it.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="a-story-of-dependencies"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;A Story of Dependencies&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The github repository I found listed as dependencies Pygmentize and
Docutils. It turns out, however, that the important parts of both
projects were included in the repository itself. Seeing this as a waste,
I first remove Pygmentize, discovering to my joy that the docutils
converter I was using would do that for me! I then set about removing
the glue that tied that Pygmentize to the rst2html in the repository.
Simple, and it &lt;strong&gt;Just Worked™&lt;/strong&gt;. Now that I was here, with a
bog-standard rst2html, I tested things. Nope, UTF-8 conversions weren't
handled automatically in this wrapper class. No problem, let's just
bring in the modern one. Wait, what? If I'm directly including the
modern one, and also listing it as a dependency, it would be much
cleaner to just use the version brought in, no? So it went away, leaving
just the ruby=&amp;gt;python bridge. Much cleaner, if a bit of a trivial
product now.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="a-story-of-gems"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;A Story of Gems&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Ouch! There was a ticket on the original project I forked asking for it
to be made available as a gem. I'm a sucker for interesting projects, so
I set about to make it so. Create a branch, switch to it, and get on
with the gem creation! Except, no. There's multiple different
educational resources each containing the correct instructions for the
version of &lt;tt class="docutils literal"&gt;gem&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;bundle&lt;/tt&gt; that were current when they went live.
None of these versions were anything resembling current, so I'd have to
go deeper. I'd have to go to the &lt;a class="reference external" href="https://bundler.io/guides/creating_gem.html"&gt;source of truth&lt;/a&gt; about these topics,
the official documents at the &lt;a class="reference external" href="https://bundler.io/"&gt;Bundler&lt;/a&gt; itself. This got me
bootstrapped with, ironically enough, a bootstrap routine. A few more
tweaks of configuration, and I could build a gem. It was just a shame
that it did nothing at all...&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="a-story-of-reference"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;A Story of Reference&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;By gum, somebody had to have done this before me! I checked out the
&lt;a class="reference external" href="https://jekyllrb.com/"&gt;Jekyll&lt;/a&gt; site again, and sure enough they released one of their
official parser/converters at the &lt;a class="reference external" href="https://github.com/jekyll/jekyll-textile-converter"&gt;Textile github repository&lt;/a&gt;! Thanks
and praise be to the gods of documentation! Anyway, I adapted their
configuration to match the code I already had, using the Ruby
underscores &lt;a class="reference external" href="https://guides.rubygems.org/name-your-gem/"&gt;naming convention&lt;/a&gt; (though this is purely a aesthetic
change, as I consider this its own thing and they consider theirs an
extension). I also had some Jekyll plumbing to adapt. Luckily their code
is &lt;cite&gt;MIT license`&lt;/cite&gt; and so is mine. A few code changes and framework
force-fitting and I'm off to the races!&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="a-story-of-the-future"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;A Story of the Future&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Where do we go from here, my dear readers? That's a good question. The
inclusion of the plugin is now dead-simple, so we could just let it be.
We also could include it in an official &lt;a class="reference external" href="https://rubygems.org/"&gt;Gems repositories&lt;/a&gt;, or one of
the &lt;a class="reference external" href="https://github.com/planetjekyll/awesome-jekyll-plugins"&gt;Jekyll plugin&lt;/a&gt; repositories. These decisions await a more
permanent answer in &lt;em&gt;the future™&lt;/em&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="tl-dr"&gt;
&lt;h2&gt;&lt;a class="toc-backref" href="#contents"&gt;TL;DR&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Go to &lt;a class="reference external" href="https://github.com/languidnights/jekyll-rst-ng"&gt;this repository&lt;/a&gt; and get blogging in rst files.&lt;/p&gt;
&lt;/div&gt;
</content><category term="server"></category></entry></feed>