<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Macadmin on wegotoeleven</title><link>http://blog.wegotoeleven.xyz/tags/macadmin/</link><description>Recent content in Macadmin on wegotoeleven</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Mon, 29 Aug 2022 00:00:00 +0000</lastBuildDate><atom:link href="http://blog.wegotoeleven.xyz/tags/macadmin/index.xml" rel="self" type="application/rss+xml"/><item><title>30 Steps to Vagrant and VMWare Fusion Awesomeness</title><link>http://blog.wegotoeleven.xyz/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/</link><pubDate>Mon, 02 Mar 2020 00:00:00 +0000</pubDate><guid>http://blog.wegotoeleven.xyz/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/</guid><description>&lt;p&gt;Vagrant is pretty cool, but of late I&amp;rsquo;ve been having real issues finding a Vagrant base box that works with VMware Fusion OOTB. My blogging workflow (used to) involve(s) using a Vagrant box with Jekyll to generate a static site on my local Mac, and then uploading to an S3 bucket. The Vagrant Jekyll boxes weren&amp;rsquo;t up to scratch, so I&amp;rsquo;ve decided to figure out how to create my own.&lt;/p&gt;</description><content:encoded><![CDATA[<p>Vagrant is pretty cool, but of late I&rsquo;ve been having real issues finding a Vagrant base box that works with VMware Fusion OOTB. My blogging workflow (used to) involve(s) using a Vagrant box with Jekyll to generate a static site on my local Mac, and then uploading to an S3 bucket. The Vagrant Jekyll boxes weren&rsquo;t up to scratch, so I&rsquo;ve decided to figure out how to create my own.</p>
<p>This guide covers how to create the box and add it to your list of boxes, for use in specifying within a Vagrantfile. It doesn&rsquo;t cover Vagrant fundementals, so I assume that you&rsquo;ll have some basic knowledge in how it works before embarking on this magical quest.</p>
<ol>
<li>
<p>Open VMware Fusion</p>
</li>
<li>
<p>Select “Install from disc or image” and click &ldquo;Continue&rdquo;
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-01.png"></p>
</li>
<li>
<p>Locate the ISO for the distribution you want to install, then select “Open”, and click &ldquo;Continue&rdquo;.
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-02.png"></p>
</li>
<li>
<p>Unselect the checkbox for “Use Easy Install”
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-03.png"></p>
</li>
<li>
<p>Choose “Customize Settings”, and enter a name for the VMware file (<code>name/OSarch</code>, i.e. <code>wegotoeleven/trusty64</code>) and select “Save&quot;
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-04.png"></p>
</li>
<li>
<p>Customise the VM’s settings</p>
<ol>
<li>Turn on Shared Folders
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-05.png"></li>
<li>Set memory to desired size, at least 1024MB
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-06.png"></li>
<li>Change the Networking to &ldquo;Share with my Mac&rdquo; (aka NAT)
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-07.png"></li>
<li>Change the disk size to 40 GB and deselect “Split into 2GB files”
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-08.png"></li>
<li>Turn off the sound card
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-09.png"></li>
<li>Expand &ldquo;Advanced USB options&rdquo; and select &ldquo;Remove USB Controller&rdquo;
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-10.png"></li>
<li>Untick &ldquo;Share Mac printers with Linux&rdquo;
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-11.png"></li>
</ol>
</li>
<li>
<p>Boot the VM, install the Guest OS and customise the following settings when prompted:
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-12.png"></p>
</li>
<li>
<p>Host Name: Same as the second part of the name of the VMware file (i.e. trusty64)
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-13.png"></p>
</li>
<li>
<p>Full Name: <code>vagrant</code>
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-14.png"></p>
</li>
<li>
<p>User: <code>vagrant</code>
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-15.png"></p>
</li>
<li>
<p>Password: <code>vagrant</code>
<img loading="lazy" src="/technical/30-steps-to-vagrant-and-vmware-fusion-awesomeness/images/2015-09-28-16.png"></p>
</li>
<li>
<p>Once setup and at the command prompt, login and change the Root Password. When asked, set to <code>vagrant</code></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ sudo passwd root
</span></span></code></pre></div></li>
<li>
<p>Update the OS because updates</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ sudo apt update <span class="o">&amp;&amp;</span> sudo apt upgrade -y
</span></span></code></pre></div></li>
<li>
<p>Update the Sudoers file with the following to allow the vagrant user sudo rights without having to authenticate with a password</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">#Defaults !visiblepw
</span></span><span class="line"><span class="cl">Defaults env_keep=&#34;SSH_AUTH_SOCK&#34;
</span></span></code></pre></div></li>
<li>
<p>Test. Is the following command outputs the current directory instead of an error, all is good</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ sudo <span class="nb">pwd</span>
</span></span></code></pre></div></li>
<li>
<p>Restart VM</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ sudo shutdown -r now
</span></span></code></pre></div></li>
<li>
<p>Make ssh folder</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ mkdir ~/.ssh
</span></span></code></pre></div></li>
<li>
<p>Set permissions</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ chmod <span class="m">700</span> ~/.ssh
</span></span></code></pre></div></li>
<li>
<p>Download Vagrant authorised keys</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O ~/.ssh/authorized_keys
</span></span></code></pre></div></li>
<li>
<p>Set permissions on authorised keys file</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ chmod <span class="m">600</span> ~/.ssh/authorized_keys <span class="o">&amp;&amp;</span> chown -R vagrant ~/.ssh
</span></span></code></pre></div></li>
<li>
<p>Install OpenSSH</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ sudo apt install openssh-server -y
</span></span></code></pre></div></li>
<li>
<p>Edit the SSH config file</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ sudo nano /etc/ssh/sshd_config
</span></span></code></pre></div></li>
<li>
<p>Restart SSH service</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ sudo service ssh restart
</span></span></code></pre></div></li>
<li>
<p>Install VMware Tools. Begin by mounting the VMware Tools by selecting Virtual Machines &gt; Install VMware Tools from the menu bar menu</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ sudo mkdir -p /mnt/cdrom
</span></span><span class="line"><span class="cl">$ sudo mount /dev/cdrom /mnt/cdrom
</span></span><span class="line"><span class="cl">$ tar xzvf /mnt/cdrom/VMwareTools-9.2.2-893683.tar.gz -C /tmp
</span></span><span class="line"><span class="cl">$ <span class="nb">cd</span> /tmp/vmware-tools-distrib/
</span></span><span class="line"><span class="cl">$ sudo ./vmware-install.pl<span class="se">\
</span></span></span></code></pre></div></li>
<li>
<p>Wipe the free space on the VM to stop fragmentation</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ sudo dd <span class="k">if</span><span class="o">=</span>/dev/zero <span class="nv">of</span><span class="o">=</span>/EMPTY <span class="nv">bs</span><span class="o">=</span>1M
</span></span><span class="line"><span class="cl">$ sudo rm -f /EMPTY
</span></span></code></pre></div></li>
<li>
<p>Shutdown the VM</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ sudo shutdown -h now
</span></span></code></pre></div></li>
<li>
<p>Navigate to the location of your vmwarevm. By default this location is <code>~/Virtual Machines/</code>.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ <span class="nb">cd</span> ~/Virtual Machines/wegotoeleven:xenial64.vmwarevm
</span></span></code></pre></div><p>Note: Any forward slashes (<code>/</code>) will be translated into colons if the name of the VMware file contains a forward slash</p>
</li>
<li>
<p>Create a file named <code>metadata.json</code> and enter the following contents:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">&#34;provider&#34;</span><span class="p">:</span> <span class="s2">&#34;vmware_fusion&#34;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></div></li>
<li>
<p>Create a file named <code>Vagrantfile</code> and enter the following contents.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-ruby" data-lang="ruby"><span class="line"><span class="cl"><span class="c1"># -*- mode: ruby -*-</span>
</span></span><span class="line"><span class="cl"><span class="c1"># vi: set ft=ruby</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="no">Vagrant</span><span class="o">.</span><span class="n">configure</span><span class="p">(</span><span class="s2">&#34;2&#34;</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">config</span><span class="o">|</span>
</span></span><span class="line"><span class="cl">  <span class="n">config</span><span class="o">.</span><span class="n">vm</span><span class="o">.</span><span class="n">provider</span> <span class="ss">:vmware_fusion</span> <span class="k">do</span> <span class="o">|</span><span class="n">v</span><span class="p">,</span> <span class="n">override</span><span class="o">|</span>
</span></span><span class="line"><span class="cl">    <span class="n">v</span><span class="o">.</span><span class="n">gui</span> <span class="o">=</span> <span class="kp">false</span>
</span></span><span class="line"><span class="cl">  <span class="k">end</span>
</span></span><span class="line"><span class="cl"><span class="k">end</span>
</span></span></code></pre></div></li>
<li>
<p>We next want to optimize the box to reduce it’s size:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">$ /Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -d Virtual\ Disk.vmdk
</span></span><span class="line"><span class="cl">$ /Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -k Virtual\ Disk.vmdk
</span></span></code></pre></div></li>
<li>
<p>Finally compress the box:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ tar cvzf package.box ./
</span></span></code></pre></div></li>
<li>
<p>Add the box to Vagrant</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ vagrant box add wegotoeleven/xenial64 package.box
</span></span></code></pre></div></li>
</ol>
<p>I couldn&rsquo;t have done this without the following blog posts:</p>
<ul>
<li><a href="https://www.skoblenick.com/vagrant/creating-a-custom-box-from-scratch">creating-a-custom-box-from-scratch</a></li>
<li><a href="https://blog.engineyard.com/2014/building-a-vagrant-box">building-a-vagrant-box</a></li>
</ul>
<p>And yeah. I know I said 30.</p>
]]></content:encoded></item><item><title>Jamf Pro's Reported IP Address fun and games</title><link>http://blog.wegotoeleven.xyz/technical/jamf-pro-reported-ip-address/</link><pubDate>Thu, 01 Jan 2015 00:00:00 +0000</pubDate><guid>http://blog.wegotoeleven.xyz/technical/jamf-pro-reported-ip-address/</guid><description>&lt;p&gt;I had a user with an issue recently where their Mac record in Jamf Pro was not being populated with a correct &amp;ldquo;Reported IP Address&amp;rdquo; value when connected to the company&amp;rsquo;s corporate WiFi. The IP address of the WiFi interface would report the correct value on the device and was singable.&lt;/p&gt;
&lt;p&gt;For context, this issue:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Persisted between inventory updates&lt;/li&gt;
&lt;li&gt;Would only ever be present when connecting to WiFi (i.e. the issue abated when disabling WiFi and connecting to Ethernet)&lt;/li&gt;
&lt;li&gt;Would not be resolved by forgetting the SSID and/or deleting and re-adding the network interface&lt;/li&gt;
&lt;li&gt;Would not be affected by renewing the DHCP lease.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Doing some digging, &lt;a href="https://learn.jamf.com/bundle/technical-articles/page/Collecting_the_IP_Address_and_Reported_IP_Address_in_Jamf_Pro.html"&gt;the documentation&lt;/a&gt; for the &amp;ldquo;Reported IP Address&amp;rdquo; field in Jamf Pro notes that:&lt;/p&gt;</description><content:encoded><![CDATA[<p>I had a user with an issue recently where their Mac record in Jamf Pro was not being populated with a correct &ldquo;Reported IP Address&rdquo; value when connected to the company&rsquo;s corporate WiFi. The IP address of the WiFi interface would report the correct value on the device and was singable.</p>
<p>For context, this issue:</p>
<ul>
<li>Persisted between inventory updates</li>
<li>Would only ever be present when connecting to WiFi (i.e. the issue abated when disabling WiFi and connecting to Ethernet)</li>
<li>Would not be resolved by forgetting the SSID and/or deleting and re-adding the network interface</li>
<li>Would not be affected by renewing the DHCP lease.</li>
</ul>
<p>Doing some digging, <a href="https://learn.jamf.com/bundle/technical-articles/page/Collecting_the_IP_Address_and_Reported_IP_Address_in_Jamf_Pro.html">the documentation</a> for the &ldquo;Reported IP Address&rdquo; field in Jamf Pro notes that:</p>
<blockquote>
<p>The reported IP address is collected by the jamf binary during a check-in and can be received by executing the following command:</p>
<p><code>ifconfig</code></p>
</blockquote>
<p>While this is technically correct, the documentation doesn&rsquo;t explicitly state where this information is collected from during an inventory; it&rsquo;s actually parsed from a file on disk, <code>/Library/Preferences/SystemConfiguration/preferences.plist</code>. Searching though this file for the incorrect IP address highlighted that the user had many, <em>many</em> interfaces (typically caused when moving between desks that have hubs or monitors with build in Ethernet interfaces), and one of these used a Static IP address assignment:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">IPV4 = {
</span></span><span class="line"><span class="cl">	Addresses = (
</span></span><span class="line"><span class="cl">		&#34;10.14.28.1&#34;
</span></span><span class="line"><span class="cl">	);
</span></span><span class="line"><span class="cl">	ConfigMethod = Manual;
</span></span><span class="line"><span class="cl">	...
</span></span><span class="line"><span class="cl">}
</span></span></code></pre></div><p>Finding and removing the static IP from the above interface immediately fixed the issue the next time that the Mac checked into Jamf Pro.</p>
<p>It does beg the question however, whether the &ldquo;Reported IP Address&rdquo; collection process in Jamf Pro could be improved to validate whether the interface is connected before logging it.</p>
]]></content:encoded></item></channel></rss>