<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.2.2">Jekyll</generator><link href="https://pingtrip.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://pingtrip.com/" rel="alternate" type="text/html" /><updated>2022-10-24T09:28:42-04:00</updated><id>https://pingtrip.com/feed.xml</id><title type="html">./PingTrip.com</title><subtitle></subtitle><entry><title type="html">Headless Hashcat Server</title><link href="https://pingtrip.com/posts/headless-hashcat-server" rel="alternate" type="text/html" title="Headless Hashcat Server" /><published>2018-08-07T00:00:00-04:00</published><updated>2022-09-27T09:26:04-04:00</updated><id>https://pingtrip.com/posts/headless-hashcat-server</id><content type="html" xml:base="https://pingtrip.com/posts/headless-hashcat-server"><![CDATA[<p>While cracking passwords as a hobby for over a decade I've been continually upgrading a rig dedicated to the task. In its current configuration <em>Cpt-Crunch</em> (no affiliation to the cereal) is a 4-GPU "headless" server which I access via SSH to run various cracking activities. This is my step-by-step guide for installing the OS, configuring the GPU's, installing and testing Hashcat and John the Ripper.</p>

<h3>Hardware</h3>

<table>
  <tbody>
    <tr>
      <td><strong>Motherboard:</strong></td>
      <td>Supermicro SYS-7048GR-TR</td>
    </tr>
    <tr>
      <td><strong>Memory</strong></td>
      <td>64GB</td>
    </tr>
    <tr>
      <td><strong>Storage</strong></td>
      <td>110GB SSD (OS)<br />4TB disk(/data)</td>
    </tr>
    <tr>
      <td><strong>GPUs:</strong></td>
      <td>(2) GTX 1080 FE<br />(2) GTX 1070 FE</td>
    </tr>
  </tbody>
</table>

<h3>Install the OS</h3>

<p class="notice--info"><strong>UPDATED 2020-08-29:</strong> This guide now uses Ubuntu 20.04.1-server-amd64 as the base OS.</p>

<p class="notice--warning"><strong>NOTE:</strong> I ran into an issue booting the <code class="language-plaintext highlighter-rouge">ubuntu-18.04.3-live-server-amd64.iso</code> image as a vitual CD from my Zalman VE300. My workaround was to create a bootable USB:<br /> 
<code class="language-plaintext highlighter-rouge">sudo dd bs=4M if=ubuntu-18.04.3-live-server-amd64.iso of=/dev/sdd status=progress oflag=sync</code></p>

<p>Perform a standard installation and choose to install the OpenSSH server when prompted. No additional packages are needed at this time. Once the install has completed SSH into the server and update the OS to the latest packages:</p>

<p class="notice--warning"><strong>NOTE:</strong> The boot sequence may freeze at: <em>[ OK ] Reached target Cloud-init target</em> but the SSH service is available</p>

<p>Disable Cloud-Init to address the booting issue</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo touch</span> /etc/cloud/cloud-init.disabled
</code></pre></div></div>

<p>Remove the Unattended Upgrade tools (I learned the hard way when a kernel update hosed the NVIDIA drivers)</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>apt remove unattended-upgrades
</code></pre></div></div>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>apt update
<span class="nv">$ </span><span class="nb">sudo </span>apt upgrade
<span class="nv">$ </span><span class="nb">sudo </span>apt dist-upgrade
</code></pre></div></div>

<p>Next, install the required packages:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>apt <span class="nb">install </span>xserver-xorg-core xdm xserver-xorg-dev libgtk-3-0 libxnvctrl-dev p7zip-full pkg-config make gcc libglvnd-dev at-spi2-core nvidia-cuda-toolkit <span class="nt">--no-install-recommends</span>
</code></pre></div></div>

<p>Disable the Nouveau drivers:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">printf</span> <span class="s1">'blacklist nouveau\noptions nouveau modeset=0\n'</span> | <span class="nb">sudo tee</span> /etc/modprobe.d/blacklist-nouveau.conf
<span class="nv">$ </span><span class="nb">sudo </span>update-initramfs <span class="nt">-u</span>
</code></pre></div></div>

<p>Perform a reboot to pick-up the current set of changes:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>reboot
</code></pre></div></div>

<h3>Install NVidia GPU Drivers</h3>

<p>Stop the X display manager:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>systemctl stop xdm
</code></pre></div></div>

<p>Check for the latest driver at http://www.nvidia.com/Download/Find.aspx, the link below was valid as of Aug 19, 2020.</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>wget http://us.download.nvidia.com/XFree86/Linux-x86_64/450.66/NVIDIA-Linux-x86_64-450.66.run
<span class="nv">$ </span><span class="nb">sudo </span>sh NVIDIA-Linux-x86_64-450.66.run
</code></pre></div></div>

<ul>
  <li>Select NO when asked to install 32-bit compatibility libraries</li>
  <li>Select NO when asked to run nvidia-xconfig</li>
  <li>Select OK to complete</li>
</ul>

<p>Generate an Xorg config that enables GPU fan control:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>nvidia-xconfig <span class="nt">-s</span> <span class="nt">-a</span> <span class="nt">--force-generate</span> <span class="nt">--allow-empty-initial-configuration</span> <span class="se">\</span>
<span class="nt">--cool-bits</span><span class="o">=</span>4 <span class="nt">--registry-dwords</span><span class="o">=</span><span class="s2">"PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefaultAC=0x1"</span> <span class="nt">--no-sli</span> <span class="se">\</span>
<span class="nt">--connected-monitor</span><span class="o">=</span><span class="s2">"DFP-0"</span> <span class="nt">-o</span> /etc/X11/xorg.conf
</code></pre></div></div>

<p>Add Xorg configuration options to disable the NVidia driver watchdog.</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>sh <span class="nt">-c</span> <span class="s2">"sed -i '/^[[:blank:]]*Driver[[:blank:]]*</span><span class="se">\"</span><span class="s2">nvidia/a</span><span class="se">\ \ \ \ </span><span class="s2">Option         </span><span class="se">\"</span><span class="s2">Interactive</span><span class="se">\"</span><span class="s2"> </span><span class="se">\"</span><span class="s2">False</span><span class="se">\"</span><span class="s2">' /etc/X11/xorg.conf"</span>
</code></pre></div></div>

<p>Add settings required to control the GPU fans from terminal sessions (e.g SSH)</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>sh <span class="nt">-c</span> <span class="s2">"cat &gt;&gt; /etc/X11/xdm/Xsetup &lt;&lt; EOF
export PATH=/bin:/usr/bin:/sbin
export HOME=/root
export DISPLAY=:0
xset -dpms
xset s off
xhost +
EOF"</span>
</code></pre></div></div>

<p>Set the DISPLAY environment variable during login:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">echo</span> <span class="s2">"export DISPLAY=:0"</span> <span class="o">&gt;&gt;</span> ~/.bashrc
</code></pre></div></div>

<p>Now one last reboot to apply all the changes:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>reboot
</code></pre></div></div>

<p>When the reboot completes SSH back in and verify everything works:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>nvidia-smi <span class="nt">--query-gpu</span><span class="o">=</span>gpu_name <span class="nt">--format</span><span class="o">=</span>csv,noheader

GeForce GTX 1080
GeForce GTX 1070
GeForce GTX 1080
GeForce GTX 1070

<span class="nv">$ </span>nvidia-settings <span class="nt">-tq</span> GPUCurrentFanSpeed

27
27
28
27
</code></pre></div></div>

<p class="notice--warning"><strong>NOTE:</strong> The <code class="language-plaintext highlighter-rouge">gpu-temp-retain</code> option was removed from hashcat in v4.1.0 so the NVIDIA tools are used to manually set fan speeds.</p>

<p>To verify GPU fan control via NVIDIA drivers:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>nvidia-settings <span class="nt">-a</span> <span class="nv">GPUFanControlState</span><span class="o">=</span>1

  Attribute <span class="s1">'GPUFanControlState'</span> <span class="o">(</span>cpt-crunch:0[gpu:0]<span class="o">)</span> assigned value 1.
  Attribute <span class="s1">'GPUFanControlState'</span> <span class="o">(</span>cpt-crunch:0[gpu:1]<span class="o">)</span> assigned value 1.
  Attribute <span class="s1">'GPUFanControlState'</span> <span class="o">(</span>cpt-crunch:0[gpu:2]<span class="o">)</span> assigned value 1.
  Attribute <span class="s1">'GPUFanControlState'</span> <span class="o">(</span>cpt-crunch:0[gpu:3]<span class="o">)</span> assigned value 1.
  
<span class="nv">$ </span>nvidia-settings <span class="nt">-a</span> <span class="nv">GPUTargetFanSpeed</span><span class="o">=</span>75

  Attribute <span class="s1">'GPUTargetFanSpeed'</span> <span class="o">(</span>cpt-crunch:0[fan:0]<span class="o">)</span> assigned value 75.
  Attribute <span class="s1">'GPUTargetFanSpeed'</span> <span class="o">(</span>cpt-crunch:0[fan:1]<span class="o">)</span> assigned value 75.
  Attribute <span class="s1">'GPUTargetFanSpeed'</span> <span class="o">(</span>cpt-crunch:0[fan:2]<span class="o">)</span> assigned value 75.
  Attribute <span class="s1">'GPUTargetFanSpeed'</span> <span class="o">(</span>cpt-crunch:0[fan:3]<span class="o">)</span> assigned value 75.
  
<span class="nv">$ </span>nvidia-settings <span class="nt">-tq</span> GPUCurrentFanSpeed

75
75
75
75
</code></pre></div></div>

<h3>Install Hashcat</h3>
<p>Check for the latest version at https://hashcat.net/hashcat/, the link below was valid as of Aug 19, 2020.</p>

<p>Download and unpack:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>wget https://hashcat.net/files/hashcat-6.1.1.7z
<span class="nv">$ </span>7z x hashcat-6.1.1.7z
</code></pre></div></div>

<p>Verify that Hashcat recognizes the video cards:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>./hashcat-6.1.1/hashcat.bin <span class="nt">-I</span> <span class="nt">--quiet</span>

CUDA Info:
<span class="o">==========</span>

CUDA.Version.: 11.0

Backend Device ID <span class="c">#1 (Alias: #5)</span>
  Name...........: GeForce GTX 1080
  Processor<span class="o">(</span>s<span class="o">)</span>...: 20
  Clock..........: 1733
  Memory.Total...: 8119 MB
  Memory.Free....: 8001 MB

&lt;SNIP&gt;

OpenCL Info:
<span class="o">============</span>

OpenCL Platform ID <span class="c">#1</span>
  Vendor..: NVIDIA Corporation
  Name....: NVIDIA CUDA
  Version.: OpenCL 1.2 CUDA 11.0.228

  Backend Device ID <span class="c">#5 (Alias: #1)</span>
    Type...........: GPU
    Vendor.ID......: 32
    Vendor.........: NVIDIA Corporation
    Name...........: GeForce GTX 1080
    Version........: OpenCL 1.2 CUDA
    Processor<span class="o">(</span>s<span class="o">)</span>...: 20
    Clock..........: 1733
    Memory.Total...: 8119 MB <span class="o">(</span>limited to 2029 MB allocatable <span class="k">in </span>one block<span class="o">)</span>
    Memory.Free....: 7936 MB
    OpenCL.Version.: OpenCL C 1.2
    Driver.Version.: 450.66
</code></pre></div></div>

<p>Run a simple benchmark to verify Hashcat is operational:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>./hashcat-6.1.1/hashcat.bin <span class="nt">-m1000</span> <span class="nt">-b</span> <span class="nt">--quiet</span>
</code></pre></div></div>
<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Hashmode: 1000 - NTLM

Speed.#1.........: 46449.6 MH/s (28.78ms) @ Accel:64 Loops:1024 Thr:1024 Vec:8
Speed.#2.........: 46580.0 MH/s (28.72ms) @ Accel:64 Loops:1024 Thr:1024 Vec:8
Speed.#3.........: 34670.1 MH/s (28.95ms) @ Accel:64 Loops:1024 Thr:1024 Vec:8
Speed.#4.........: 34691.1 MH/s (28.93ms) @ Accel:64 Loops:1024 Thr:1024 Vec:8
Speed.#*.........:   162.4 GH/s

Started: Wed Aug 19 21:23:54 2020
Stopped: Wed Aug 19 21:24:02 2020
</code></pre></div></div>

<h3>(Optional) Install John the Ripper (with OpenCL support)</h3>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>apt <span class="nb">install </span>libssl-dev ocl-icd-opencl-dev opencl-headers pocl-opencl-icd
<span class="nv">$ </span>git clone <span class="nt">-b</span> bleeding-jumbo <span class="nt">--single-branch</span> https://github.com/magnumripper/JohnTheRipper.git
<span class="nv">$ </span><span class="nb">cd </span>JohnTheRipper/src
<span class="nv">$ </span>./configure
<span class="nv">$ </span>make <span class="nt">-s</span> clean <span class="o">&amp;&amp;</span> make <span class="nt">-sj4</span>
<span class="nv">$ </span><span class="nb">sudo cp</span> <span class="nt">-r</span> ../run /opt/john
</code></pre></div></div>

<p>List the devices that John has detected:</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>../run/john <span class="nt">--list</span><span class="o">=</span>opencl-devices | <span class="nb">grep</span> <span class="s2">") name:"</span>
</code></pre></div></div>
<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    Device #0 (1) name:     GeForce GTX 1080
    Device #1 (2) name:     GeForce GTX 1080
    Device #2 (3) name:     GeForce GTX 1070
    Device #3 (4) name:     GeForce GTX 1070
</code></pre></div></div>]]></content><author><name>Dave Crawford</name></author><summary type="html"><![CDATA[While cracking passwords as a hobby for over a decade I've been continually upgrading a rig dedicated to the task. In its current configuration Cpt-Crunch (no affiliation to the cereal) is a 4-GPU "headless" server which I access via SSH to run various cracking activities. This is my step-by-step guide for installing the OS, configuring the GPU's, installing and testing Hashcat and John the Ripper.]]></summary></entry></feed>