<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rust on blog.iankulin.com</title><link>https://blog.iankulin.com/tags/rust/</link><description>Recent content in Rust on blog.iankulin.com</description><generator>Hugo</generator><language>en-AU</language><lastBuildDate>Sat, 16 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.iankulin.com/tags/rust/index.xml" rel="self" type="application/rss+xml"/><item><title>Ubuntu Ansible 'waiting for privilege escalation prompt'</title><link>https://blog.iankulin.com/ubuntu26-bump/</link><pubDate>Sat, 16 May 2026 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/ubuntu26-bump/</guid><description>&lt;p&gt;I ran into a hiccup today - provisioning a new Ubuntu VPS, the ansible playbook to apply our security hardening failed.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ~/Developer/ansible_hl % ansible-playbook ssh-harden.yml --ask-vault-pass -e @vault.yml 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Vault password: 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;PLAY &lt;span style="color:#81a1c1"&gt;[&lt;/span&gt;Copy the hardened SSHD_CONFIG file to the remote server&lt;span style="color:#81a1c1"&gt;]&lt;/span&gt; ****************************************************
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;TASK &lt;span style="color:#81a1c1"&gt;[&lt;/span&gt;Gathering Facts&lt;span style="color:#81a1c1"&gt;]&lt;/span&gt; ********************************************************************************************
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#81a1c1"&gt;[&lt;/span&gt;ERROR&lt;span style="color:#81a1c1"&gt;]&lt;/span&gt;: Task failed: Timeout &lt;span style="color:#81a1c1"&gt;(&lt;/span&gt;12s&lt;span style="color:#81a1c1"&gt;)&lt;/span&gt; waiting &lt;span style="color:#81a1c1;font-weight:bold"&gt;for&lt;/span&gt; privilege escalation prompt:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;fatal: &lt;span style="color:#81a1c1"&gt;[&lt;/span&gt;&amp;lt;redacted IP&amp;gt;&lt;span style="color:#81a1c1"&gt;]&lt;/span&gt;: UNREACHABLE! &lt;span style="color:#81a1c1"&gt;=&lt;/span&gt;&amp;gt; &lt;span style="color:#81a1c1"&gt;{&lt;/span&gt;&lt;span style="color:#a3be8c"&gt;&amp;#34;changed&amp;#34;&lt;/span&gt;: false, &lt;span style="color:#a3be8c"&gt;&amp;#34;msg&amp;#34;&lt;/span&gt;: &lt;span style="color:#a3be8c"&gt;&amp;#34;Task failed: Timeout (12s) waiting for privilege escalation prompt:&amp;#34;&lt;/span&gt;, &lt;span style="color:#a3be8c"&gt;&amp;#34;unreachable&amp;#34;&lt;/span&gt;: true&lt;span style="color:#81a1c1"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;My routine is to run Ubuntu LTS, and when I was provisioning the server, I selected Ubuntu 26.04 LTS x64 without thinking. This LTS dropped in April, and excitingly the new versions of Ubuntu have Rust coreutils including &lt;code&gt;sudo&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The cause of the issue above (where anisible waits for the sudo password request but never sees it) is that the password prompt in &lt;code&gt;sudo-rs&lt;/code&gt; is different from real sudo. Here&amp;rsquo;s the old one:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ian@iris-orca:~$ sudo lsb_release -d
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#81a1c1"&gt;[&lt;/span&gt;sudo&lt;span style="color:#81a1c1"&gt;]&lt;/span&gt; password &lt;span style="color:#81a1c1;font-weight:bold"&gt;for&lt;/span&gt; ian: 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;No LSB modules are available.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Description:	Ubuntu 24.04.4 LTS
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ian@iris-orca:~$ sudo --version
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Sudo version 1.9.15p5
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Sudoers policy plugin version 1.9.15p5
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Sudoers file grammar version &lt;span style="color:#b48ead"&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Sudoers I/O plugin version 1.9.15p5
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Sudoers audit plugin version 1.9.15p5
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ian@iris-orca:~$ 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And the new one:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#d8dee9;background-color:#2e3440;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ian@ksd-on-syd-001:~$ sudo lsb_release -d
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#81a1c1"&gt;[&lt;/span&gt;sudo: authenticate&lt;span style="color:#81a1c1"&gt;]&lt;/span&gt; Password: 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Description:	Ubuntu 26.04 LTS
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ian@ksd-on-syd-001:~$ sudo --version
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo-rs 0.2.13-0ubuntu1
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ian@ksd-on-syd-001:~$ 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So, &lt;code&gt;[sudo] password for ian: &lt;/code&gt; vs &lt;code&gt;[sudo: authenticate] Password: &lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s not a big deal, and ansible has &lt;a href="https://github.com/ansible/ansible/pull/86175"&gt;already made&lt;/a&gt; a fix for the incompatibility, it just hasn&amp;rsquo;t flowed down to me yet. Ubuntu 24 is still LTS so I&amp;rsquo;ll drop back to that.&lt;/p&gt;
&lt;p&gt;For the adventurous, another possible approach would be to create an ansible user with passwordless ssh - I&amp;rsquo;d rather wait for the ansible update before I move to a Linux version using sudo_rs.&lt;/p&gt;</description></item><item><title>Rust</title><link>https://blog.iankulin.com/rust/</link><pubDate>Fri, 12 Aug 2022 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/rust/</guid><description>&lt;img src="https://blog.iankulin.com/images/rustmemelovetriangle_297886754.jpg" width="375" alt=""&gt;
&lt;p&gt;It&amp;rsquo;s been exciting to see some of the modern language features in Swift - it&amp;rsquo;s a real joy to work in when I think back to my C++ days which was some of the last commercial programming I did.&lt;/p&gt;
&lt;p&gt;The buzz about Carbon got me wondering about other new languages and what might be going on with them. Rust seems to keep popping up in conversations so I thought I&amp;rsquo;d have a quick look.&lt;/p&gt;
&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"&gt;
 &lt;iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/br3GIIQeefY?autoplay=0&amp;amp;controls=1&amp;amp;end=0&amp;amp;loop=0&amp;amp;mute=0&amp;amp;start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"&gt;&lt;/iframe&gt;
 &lt;/div&gt;

&lt;p&gt;Also read &lt;a href="https://fasterthanli.me/articles/a-half-hour-to-learn-rust"&gt;A half-hour to learn Rust&lt;/a&gt; and &lt;a href="https://faq.sealedabstract.com/rust/"&gt;A Swift Guide to Rust&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Those optionals, type inference, type safety, and exhaustive switch/match statements sure look familiar. Ranges too, and although the infinite range looks cool I&amp;rsquo;m not sure of the use-case.&lt;/p&gt;
&lt;p&gt;Blocks evaluating to a result is cute. This is allowed:&lt;/p&gt;
&lt;p&gt;let x = {
let y = 1; // first statement
let z = 2; // second statement
y + z // this is the *tail* - what the whole block will evaluate to
};&lt;/p&gt;
&lt;p&gt;Notice the missing semicolon - that&amp;rsquo;s sugar for the &amp;lsquo;return&amp;rsquo; that would be otherwise needed. Perhaps only from habit, I do miss the semicolons when writing Swift. I&amp;rsquo;m sure I&amp;rsquo;ll get used to it, but currently I start to feel uncomfortable when spreading an expression out over multiple lines (for clarity) and just expecting LVM to figure it all out.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; Button(&amp;quot;Toggle Light&amp;quot;, action: {
 light.toggle()}
 )
 .padding()
 .font(.title)
 .foregroundColor(.white)
 .background(Color.accentColor)
 .cornerRadius(10)
 .padding()
 Spacer()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Underscore as a &amp;ldquo;throwaway&amp;rdquo; value turns up, but in the guise of default for the match statement.&lt;/p&gt;
&lt;p&gt;Variable bindings, by default (with &amp;rsquo;let&amp;rsquo;) are immutable in Rust, but can be marked as &amp;rsquo;let mut&amp;rsquo; to make them fully variable, as with Swift&amp;rsquo;s &amp;lsquo;var&amp;rsquo;.&lt;/p&gt;
&lt;p&gt;Rust has &amp;ldquo;traits&amp;rdquo;, which currently my knowledge of Swift can&amp;rsquo;t do justice to a compare and contrast, but it definitely has a superclassy feel - like protocols and extensions.&lt;/p&gt;
&lt;p&gt;They both have closures, but again, I&amp;rsquo;m getting out of my current depth on Swift to make any worthwhile comment.&lt;/p&gt;
&lt;p&gt;I do enjoy about Swift how clear it is to read, from what I&amp;rsquo;ve seen of Rust, that&amp;rsquo;s not so much the case there, I guess there&amp;rsquo;s some other trade off involved.&lt;/p&gt;</description></item></channel></rss>