{"id":13580026,"url":"https://github.com/Fmstrat/diy-ipmi","last_synced_at":"2025-04-06T00:30:38.882Z","repository":{"id":39710470,"uuid":"103416112","full_name":"Fmstrat/diy-ipmi","owner":"Fmstrat","description":"A DIY IPMI / IP KVM system utilizing the Raspberry Pi","archived":false,"fork":false,"pushed_at":"2018-11-06T12:24:52.000Z","size":2672,"stargazers_count":904,"open_issues_count":30,"forks_count":98,"subscribers_count":56,"default_branch":"master","last_synced_at":"2025-04-04T10:08:26.670Z","etag":null,"topics":["ipmi","raspberry-pi","raspberrypi"],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fmstrat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-13T15:19:07.000Z","updated_at":"2025-04-03T22:17:50.000Z","dependencies_parsed_at":"2022-07-13T12:10:47.794Z","dependency_job_id":null,"html_url":"https://github.com/Fmstrat/diy-ipmi","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fmstrat%2Fdiy-ipmi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fmstrat%2Fdiy-ipmi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fmstrat%2Fdiy-ipmi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fmstrat%2Fdiy-ipmi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fmstrat","download_url":"https://codeload.github.com/Fmstrat/diy-ipmi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419597,"owners_count":20936009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ipmi","raspberry-pi","raspberrypi"],"created_at":"2024-08-01T15:01:46.249Z","updated_at":"2025-04-06T00:30:38.864Z","avatar_url":"https://github.com/Fmstrat.png","language":"CSS","funding_links":[],"categories":["CSS"],"sub_categories":[],"readme":"# A DIY IPMI / IP KVM system utilizing the Raspberry Pi\nA web-accessable IPMI / IP KVM system that provides full keyboard control, monitor view, and and the ability to reboot computers with standard motherboards remotely as if you were sitting in front of them with a keyboard and monitor.\n\n![Screenshot](https://github.com/Fmstrat/diy-ipmi/raw/master/Resources/Screenshot.png)\n\n## Requirements\n- Rasberry Pi 3 Model B (https://www.adafruit.com/product/3055)\n- Rasberry Pi Zero 1.3 (https://www.adafruit.com/product/2885)\n- 2.5Amp power (https://www.amazon.com/gp/product/B01FM0XOH8)\n- GPIO pins for Pi Zero (https://www.adafruit.com/product/2822)\n- GPIO cables (https://www.amazon.com/gp/product/B01BV2A54G)\n- 2x MicroSD cards (https://www.amazon.com/dp/B06XWN9Q99)\n- Relay board (https://www.amazon.com/dp/B0057OC5WK)\n- Easycap UTV007 device (https://www.amazon.com/dp/B0126O0RDC)\n- HDMI to S-Video (not all options work, but these two have been tested) (https://www.amazon.com/dp/B012MDMWLM or https://www.amazon.com/gp/product/B01E56CV42)\n- USB TTL Serial cable (https://www.amazon.com/gp/product/B00QT7LQ88)\n\nA full wishlist totaling under $120 at the time of this writing can be found at http://a.co/36FK9T8\n\n## Before assembling\n\nOn the Pi3, flash http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-09-08/. As of this writing you may use the latest Stretch version, however this was the version used successfully.\n\nOn the Pi0, flash http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-03-03/. You must use this version for this to work. There aren't really security implications since the Pi0 can only be accessed from a serial session on the Pi3.\n\nBefore putting the SD into the Pi0, add this to the end of /boot/config.txt:\n```\ndtoverlay=dwc2\nenable_uart=1\n```\n\nBefore putting the SD into the Pi3, create a blank file called `SSH` on the boot drive to enable SSH.\n\nAlso, if you will be connecting via Wifi, create a file in boot called `wpa_supplicant.conf` that uses unix based line feeds. To ensure that is the case, use `Notepad++` or another editor that allows you to change line feed types (bottom right), or copy the `config.txt` file and rename it. Include the following:\n```\nctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev\nupdate_config=1\ncountry=US\n\nnetwork={\n    ssid=\"NETWORKNAME\"\n    psk=\"PASSWORD\"\n    key_mgmt=WPA-PSK\n}\n```\n\n\n## Setting up the hardware\nHere is a diagram of how you connect all of the pieces:\n\n![Diagram](https://github.com/Fmstrat/diy-ipmi/raw/master/Resources/Diagram-sm.png)\n\nView the [high resolution version](https://raw.githubusercontent.com/Fmstrat/diy-ipmi/master/Resources/Diagram.png)\n\nThe detailed process is to:\n- Connect the Pi3 to the relay board using this method: http://youtu.be/oaf_zQcrg7g\n- Connect the Pi0 to the Pi3 using this method: https://www.thepolyglotdeveloper.com/2017/02/connect-raspberry-pi-pi-zero-usb-ttl-serial-cable/. You do not need to supply power to the Pi0, it will get power via the GPIO pins.\n- Plug the easycap device and the USB TTL device into the USB ports on the Pi3\n- Connect the HDMI out of your computer into the HDMI to S-Video box, and connect it to the EasyCap device via an S-Video cable\n- Connect the Pi0 to the server via a microUSB to USB male cable\n\n\n## Quick Install\nThe quick method of installation is to simply run the install script on the Pi3 as the `pi` user:\n```\nwget https://raw.githubusercontent.com/Fmstrat/diy-ipmi/master/install.sh\nchmod +x install.sh\n./install.sh\n```\nEverything will be done on the Pi3 and Pi0 automatically with the video input defaulting to s-video.\n\nIf you would like to manage multiple servers with one IPMI system, please see the [Managing multiple servers](#managing-multiple-servers) section below.\n\nBe sure to check the bottom of this README for [Tips](#tips) and [Troubleshooting](#troubleshooting)!\n\n\n## The long way\nIf you would like to do things step by step to understand how things work, the following instructions can be used.\n\n#### Setting up the Pi 3\n\nFirst, let's get all the software we need:\n```\nsudo apt-get update\nsudo apt-get -y install libav-tools screen lighttpd php php-cgi git\ncd /opt\nsudo git clone https://github.com/Fmstrat/diy-ipmi\nsudo chown pi diy-ipmi -R\nchmod +x /opt/diy-ipmi/Pi3/*.py\nchmod +x /opt/diy-ipmi/Pi3/*.sh\n```\n\nTo test the ability to reboot the computer via the relay board, run:\n```\n/opt/diy-ipmi/Pi3/rebootServer.py\n```\nTest this script to see if it resets the computer. If you are interested, look in the python script to see the numbers associated with which of the 8 relays you could use for multiple computers.\n\nNext, set up the HTTP server.\n```\n\nread -s -p \"Password for web IPMI console (user 'ipmi'): \" IPMIPASS\necho \"\"\necho \"ipmi:${IPMIPASS}\" | sudo tee --append /var/www/ipmipasswd\n\nsudo lighty-enable-mod fastcgi-php\necho '' | sudo tee --append /etc/lighttpd/lighttpd.conf\nsudo adduser www-data gpio\necho 'server.modules += ( \"mod_auth\" )' | sudo tee --append /etc/lighttpd/lighttpd.conf\necho 'auth.debug = 2' | sudo tee --append /etc/lighttpd/lighttpd.conf\necho 'auth.backend = \"plain\"' | sudo tee --append /etc/lighttpd/lighttpd.conf\necho 'auth.backend.plain.userfile = \"/var/www/ipmipasswd\"' | sudo tee --append /etc/lighttpd/lighttpd.conf\necho 'auth.require = ( \"/\" =\u003e' | sudo tee --append /etc/lighttpd/lighttpd.conf\necho '        (' | sudo tee --append /etc/lighttpd/lighttpd.conf\necho '                \"method\" =\u003e \"basic\",' | sudo tee --append /etc/lighttpd/lighttpd.conf\necho '                \"realm\" =\u003e \"Password protected area\",' | sudo tee --append /etc/lighttpd/lighttpd.conf\necho '                \"require\" =\u003e \"user=ipmi\"' | sudo tee --append /etc/lighttpd/lighttpd.conf\necho '        )' | sudo tee --append /etc/lighttpd/lighttpd.conf\necho ')' | sudo tee --append /etc/lighttpd/lighttpd.conf\n\ncd /var/www/\nsudo mv /var/www/html /var/www/html.orig\nsudo ln -s /opt/diy-ipmi/Pi3/html /var/www/html\n\necho '[Server 1]' | sudo tee --append /etc/ipmi.conf\necho 'TTY=/dev/ttyUSB0' | sudo tee --append /etc/ipmi.conf\necho 'VID=/dev/video0' | sudo tee --append /etc/ipmi.conf\necho 'INP=1' | sudo tee --append /etc/ipmi.conf\necho 'PIN=2' | sudo tee --append /etc/ipmi.conf\n\nsudo service lighttpd force-reload\nsudo systemctl restart lighttpd\nsudo systemctl enable lighttpd\n```\n\nLastly, get everything running right by completing some tasks and updating `/etc/rc.local` to ensure they happen at boot:\n```\nsudo chmod a+rw /dev/video0\nsudo mkdir -p /mnt/ramdisk\nsudo mount -t tmpfs -o size=3m tmps /mnt/ramdisk\nsudo chown www-data /mnt/ramdisk\nsudo v4l2-ctl -d /dev/video0 --set-input=1\nsudo chmod a+rw /dev/ttyUSB0\n\nsudo sed -i 's/exit 0//g' /etc/rc.local\necho \"chmod a+rw /dev/video0\" | sudo tee --append /etc/rc.local\necho \"mkdir -p /mnt/ramdisk\" | sudo tee --append /etc/rc.local\necho \"mount -t tmpfs -o size=3m tmps /mnt/ramdisk\" | sudo tee --append /etc/rc.local\necho \"chown www-data /mnt/ramdisk\" | sudo tee --append /etc/rc.local\necho \"v4l2-ctl -d /dev/video0 --set-input=1\" | sudo tee --append /etc/rc.local\necho \"chmod a+rw /dev/ttyUSB0\" | sudo tee --append /etc/rc.local\necho \"exit 0\" | sudo tee --append /etc/rc.local\n```\n\n#### Setting up the Pi 0\n\nMake sure you can access the Pi0 from the Pi3 by running:\n```\nscreen /dev/ttyUSB0 115200\n```\nPress enter until you see a login prompt. Do not login. Instead, exit the session by hitting `Control-A` then typing `:quit` and pressing enter.\n\nOn the Pi3, run:\n```\n/opt/diy-ipmi/Pi3/checkPi0Login.sh\n\necho \"sudo systemctl enable serial-getty@ttyAMA0.service\" \u003e\u003e /dev/ttyUSB0\necho \"sudo cp /lib/systemd/system/serial-getty@.service /etc/systemd/system/serial-getty@ttyAMA0.service\" \u003e\u003e /dev/ttyUSB0\necho \"sudo sed -i 's/agetty --keep-baud 115200/agetty -a pi --keep-baud 115200/g' /etc/systemd/system/serial-getty@ttyAMA0.service\" \u003e\u003e /dev/ttyUSB0\necho \"sudo systemctl daemon-reload\" \u003e\u003e /dev/ttyUSB0\n\necho \"sudo systemctl disable networking\" \u003e\u003e /dev/ttyUSB0\necho \"sudo apt-get -y remove dhcpcd5 isc-dhcp-client isc-dhcp-common\" \u003e\u003e /dev/ttyUSB0\nsleep 60\n\necho \"rm -f /tmp/B64\" \u003e\u003e /dev/ttyUSB0\nfor LINE in $(base64 /opt/diy-ipmi/Pi0/enableHID.sh); do echo \"echo $LINE \u003e\u003e /tmp/B64\" \u003e\u003e /dev/ttyUSB0; done\necho \"base64 -d /tmp/B64 \u003e /home/pi/enableHID.sh\" \u003e\u003e /dev/ttyUSB0\necho \"chmod +x /home/pi/enableHID.sh\" \u003e\u003e /dev/ttyUSB0\n\necho \"rm -f /tmp/B64\" \u003e\u003e /dev/ttyUSB0\nfor LINE in $(base64 /opt/diy-ipmi/Pi0/sendkeys.c); do echo \"echo $LINE \u003e\u003e /tmp/B64\" \u003e\u003e /dev/ttyUSB0; done\necho \"base64 -d /tmp/B64 \u003e /home/pi/sendkeys.c\" \u003e\u003e /dev/ttyUSB0\necho \"gcc -o /home/pi/sendkeys /home/pi/sendkeys.c\" \u003e\u003e /dev/ttyUSB0\n\nsudo apt-get -y install libusb-dev\ncd /opt/diy-ipmi/Pi0/\ngcc -o hub-ctrl hub-ctrl.c -lusb\nfor LINE in $(base64 hub-ctrl); do echo \"echo $LINE \u003e\u003e /tmp/B64\" \u003e\u003e /dev/ttyUSB0; done\necho \"base64 -d /tmp/B64 \u003e /home/pi/hub-ctrl\" \u003e\u003e /dev/ttyUSB0\necho \"chmod +x /home/pi/hub-ctrl\" \u003e\u003e /dev/ttyUSB0\ncd -\n\necho \"sudo /home/pi/enableHID.sh\" \u003e\u003e /dev/ttyUSB0\necho \"sudo sed -i 's/exit 0//g' /etc/rc.local\" \u003e\u003e /dev/ttyUSB0\necho \"echo /home/pi/enableHID.sh | sudo tee --append /etc/rc.local\" \u003e\u003e /dev/ttyUSB0\necho \"echo exit 0 | sudo tee --append /etc/rc.local\" \u003e\u003e /dev/ttyUSB0\n```\n\n#### Access the IPMI\nYou should now be able to access the IPMI console at `http://\u003cRaspberryPi3IP\u003e/`. From here you can set up SSL and port forwarding to the device as your situation requires.\n\n\n## Managing multiple servers\nMultiple servers can be managed by using multile USB capture devices (one per server), multiple USB-to-Serial adapters each with their own Pi0 (one per server), and using one of the 8 relays on the relay board as the reset button. Once installed, edit `/etc/ipmi.conf`. The format should be:\n```\n[My first server]\nTTY=/dev/ttyUSB0\nVID=/dev/video0\nINP=1\nPIN=2\n\n[My second server]\nTTY=/dev/ttyUSB1\nVID=/dev/video1\nINP=1\nPIN=3\n```\n- When hooking up multiple TV tuners and USB-to-Serial devices to Pi0s, it is recommended to use a powered USB hub.\n- The `INP` field is `1` for s-video or `0` for composite. You can actually use one capture device for two servers by using both inputs.\n- The `PIN` value is the pin on the relay board. The valid values are `2`, `3`, `4`, `17`, `27`, `22`, `10`, `9`.\n\n\n## Tips\nIf you're using this on a Linux headless machine that's not running X11, it's easier to read the console if things are nice and big. Disabling the video driver is an easy way to accomplish this as it will just default to a generic NTSC or PAL signal. For instance, with an nVidia card, you could follow these directoins: https://askubuntu.com/questions/481414/install-nvidia-driver-instead-of-nouveau\n\nTo enable SSL, you need a combined PEM file which can be created by:\n```\ncat myserver.key mycert.crt myca.ca-bundle \u003e mypem.pem\n```\nThen add this into the `/etc/lighttpd/lighttpd.conf` file (editing as required):\n```\n$SERVER[\"socket\"] == \":443\" {\n\tssl.engine = \"enable\"\n\tssl.pemfile = \"/opt/certs/mypem.pem\"\n\tserver.name = \"host.domain.com\"\n\tserver.document-root = \"/var/www/html\"\n\tssl.use-sslv2 = \"disable\"\n\tssl.use-sslv3 = \"disable\"\n\tssl.use-compression = \"disable\"\n\tssl.honor-cipher-order = \"enable\"\n\tssl.cipher-list = \"ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-RC4-SHA:ECDHE-RSA-RC4-SHA:ECDH-ECDSA-RC4-SHA:ECDH-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA\"\n\tserver.errorlog = \"/var/log/lighttpd/serror.log\"\n\taccesslog.filename = \"/var/log/lighttpd/saccess.log\"\n}\n```\n\n## Troubleshooting\n\nIf you're not getting video, here are some troubleshooting methods:\n\nFirst make sure the `INP` field in `/etc/ipmi.conf` is set to the right input. Input 0 is usually Composite, and Input 1 is usually S-Video.\n\nConnect a source and test to see if it's working.\n```\napt-get install mencoder\nmencoder tv:// -tv driver=v4l2:norm=NTSC:device=/dev/video0:input=1:fps=5 -nosound -ovc copy -o test.avi\nv4l2-ctl -d /dev/video0 --set-input=1\navconv -f video4linux2 -i /dev/video0 -vframes 1 -s 720x480 test.jpg\n```\nControl-C that, and sftp the files to a host for viewing and playback:\n```\nsftp test.avi root@hostname:/folder/test.avi\nsftp test.avi root@hostname:/folder/test.jpg\n```\n\nYou can test keyboard control from the Pi0 with commands like:\n```\n/home/pi/sendkeys /dev/hidg0 keyboard\n```\nYou will need to type things like \"a\" and press ENTER to send the \"a.\" Other ways to send keys include things like:\n```\necho 'a' | /home/pi/sendkeys /dev/hidg0 keyboard\necho 'return' | /home/pi/sendkeys /dev/hidg0 keyboard\necho 'shift a' | /home/pi/sendkeys /dev/hidg0 keyboard\necho 'left-meta space' | /home/pi/sendkeys /dev/hidg0 keyboard\n```\n\nTo reset the keyboard controller run this on the Pi3:\n```\n/opt/diy-ipmi/Pi3/resetPi0HID.sh\n```\n\nIf you get wierd USB errors, make sure your power brick is strong enough and that you're not trying to power the HDMI to S-Video converter via the Pi3.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFmstrat%2Fdiy-ipmi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFmstrat%2Fdiy-ipmi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFmstrat%2Fdiy-ipmi/lists"}