Matt Borja

Raspberry Pi Walkthrough

Objectives

  • Optimized for 700 Mhz (Raspberry Pi 2)
  • Optimized for SD card longevity

Use cases

  • Lightweight web server
  • Hardware Firewall / VPN client
  • Simulating network environments for CCENT/CCNA ICND1-2
  • Pentesting practice targets
  • Isolated true random number collector
  • Hardware security module

Setup

Common post-installation tasks

  1. Setup SSH key and disabled password authentication
  2. Update package information (apt-get update) and install ufw
  3. Configure firewall and enable (i.e. ufw allow ssh; ufw enable)
  4. Setup a RAM drive at /var/tmp and replace /tmp with symlink

Tips

  • Use CDNs or Service Workers to reduce disk I/O in web applications
  • Use tmpfs to redirect logging and temporary directories to RAM
  • Use rsync script to incrementally copy files to document root

If you're using a crossover cable (you can also use a straight-through cable to connect to a host's ethernet port if it supports Auto-MDIX) and are now just looking for your Pi's link-local address, you can use a network protocol analyzer or traffic inspection tool (i.e tcpdump) and look for DNS traffic.

Note: This works best your other network adapters temporarily disabled to filter normal LAN/Internet traffic.

Example:

$ sudo tcpdump
...
18:33:21.857183 IP 169.254.59.204.mdns > 224.0.0.251.mdns: 0*- [0q] 4/0/0
  (Cache flush) PTR raspberrypi.local., 
  (Cache flush) A 169.254.59.204, 
  (Cache flush) PTR raspberrypi.local., 
  (Cache flush) AAAA 0000::0000:0000:0000:0000 (...)

The link-local address of this Pi is 169.254.59.204.

$ ssh [email protected]
[email protected]'s password:

Linux raspberrypi 4.19.58+ #1245 Fri Jul 12 17:20:08 BST 2019 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

[email protected]:~ $