MP* Fall 2022

Michael Simpson

1

Who am I?

2

My Server

3

Art Discord Bot

1

My name is Michael Simpson

I'm a Computer Science major
with minors in Digital Art and Psychology

I like art, I like computers, I like computer generated art.

2

  1. Requirements
    1. Extra computer
      • I used an old macbook
    2. USB
    3. Ethernet cable and port
    4. External keyboard
    5. Admin access to your router
    6. Base knowledge of file systems, partitioning, operating systems, command line, and networking
  2. Steps
    1. Preparation
      • Download OpenBSD iso/disk image
        • Load that onto your USB (various tools do this in an easy, drag-and-drop format)
      • Take note of your internal and external IP addresses for this computer, as you'll need them for testing and connecting
      • Assuming you're dual booting, create a separate partition (any FAT format works) of at least 8gb
    2. Installation
      • Plug in your USB, reboot your computer, and boot from your USB
        • this can be done with BIOS, a boot loader, or various other methods that are pc dependent. For example on my mac I had to hold down the option key at boot and I could choose what to boot from
      • Enter 'I' for install, then follow the steps given by the installation process
        • A good amount of these options can change per person, the main questions are:
          • What should your hostname be
          • Do you want to create a user (highly recommend)
          • Create passwords
          • Which network interface do you want to configure
            • This is why ethernet was necessary for me, the firmware needed for my macs wireless interface wasn't available
          • Do you want sshd to start on boot
            • This is the daemon that looks for ssh connections
            • If you're making a server, definitely choose yes
          • Do you want to be able to log in as root through ssh
            • Almost always choose no for this, you can always login as a user and then 'sudo' things
          • Do you want to install their windowing system
            • Since I'm making a server that will be solely interacted with through a CLI, I chose no
          • Do you want to use their serial console instead of their base console
            • I'd recomend no, unless you know what it is and need it
          • Where should the OpenBSD partitions sit on disk
            • They have whole disk options, or an interactive fdisk session where you can choose exactly where
            • Be careful on this step, it's easy to overwrite existing operating systems, or other important partitions (efi/boot partition)
              • Messing this up can brick your computer
              • It's fixable, but a pain, so make sure you konw down to the block where you want your os to sit
            • if you created a partition beforehand and select that one, it will change it's format to be OpenBSD compatible, then offer a proposed set of partitions within that partition for where data should be stored
              • Up to you on this one, I went with the auto generated partitions, just make sure it doesn't overlap with anything already on disk that you'd like to keep.
          • Where can the 'sets' be loaded from
            • OpenBSD installs sets before the first boot that have the basic libraries, kernel, etc that it needs to run
            • If you're using a USB, it'll be located there
            • I recommend installing all of them
        • Once it's finished you can reboot!
          • make sure to run the commands below after reboot. They will update your kernel, and certain packages already installed
            • fw_update
            • syspatch
            • pkg_add -Uu
            • sysmerge -d
    3. Server Setup
      1. SSH configuration
        • Edit ~/.ssh/sshd_config on server
          • This will give you an overview of what will be allowed and how connections are handled
          • Make sure root login is turned off here!!
      2. Port forwarding
        • Depending on the router you have, there are different steps you need to follow in order to port forward
          • Mine was a web GUI, so the process was relatively simple
        • Something I'd recommend is to make the required incoming port something besides port 22 (the default for ssh)
        • I chose 12000, but you can choose (almost) whatever you'd like
      3. SSH keys
        • USE SSH KEYS!!!
          • They're much more secure than password authentication, and pretty simple to setup
        • Setup
          • On your client, create a key pair
            • 'ssh-keygen -t rsa -b 4096'
              • I recommend creating a passphrase for added security, but that's up to you
            • Your ssh keys should be stored in
              • ~/.ssh/id_rsa
              • ~/.ssh/id_rsa.pub
          • Either through a usb, or an ssh session, get your .pub key on your host machine under ~/.ssh/authorized_keys
      4. Testing
        • Test locally first to make sure it works as expected
          • 'ssh username@localIP'
            • Where username is either 'root' or a specific user you made earlier
            • Your local IP can be found with 'ifconfig'
          • Verify you're connected by running 'netstat | less', there should be a connection at the top
        • Test out of network connection
          • Same steps as above, but this time with your non-local/router's IP
          • If you specified a port in the port forwarding section, add a '-p' flag to the ssh command

3

    1. How to access it
      • The COSI discord!
      • Channel: 'ai-art'
      • commands:
        • "/sd 'prompt'"
          • Where 'prompt' is a prompt you'd like an image of!
        • "/sd help"
          • Prints useful commands to append to your prompt
        • "/sd status"
          • Prints the current prompt being processed
    2. Brief overview
      • multithreaded python program
        • Thread 1:
          • Runs the discord bot
          • Checks messages in specific channel for "/sd" keyword, sends prompt to 2nd thread
        • Thread 2:
          • Runs the stable diffusion script
          • Sends output paths to the discord bot once it finishes
      • it is incredibly injectable!
        • Partly a feature
          • The stable diffusion script allows for a ton of arguments to be passed to it to change the format, amount of images, and quality
        • But also, be nice to it and don't hack your own hardware (it's running in cosi)