Code Monkey home page Code Monkey logo

nobodd's Introduction

nobodd

nobodd is a confusingly named, but simple TFTP server intended for net-booting Raspberry Pis directly from OS images without having to loop-back mount those images. Even customization of an image for booting on a particular board is handled without loop devices or mounts (making it possible to operate completely unprivileged), via a read/write FAT implementation within the nobodd-prep tool.

Usage

If you have an appropriately customized OS image already placed in a file (ubuntu.img), and the serial number of the Pi in question (1234ABCD) then serving it as simple as:

$ sudo nobodd-tftpd --board 1234ABCD,ubuntu.img

This defaults to reading the first partition from the file, and pretends (to TFTP clients) that the contents of the first partition appears under the 1234ABCD/ directory. Hence a TFTP request for 1234ABCD/cmdline.txt will serve the cmdline.txt file from the first partition contained in ubuntu.img.

The service either needs to run from root (because the default TFTP port is the privileged port 69), or can be run as a systemd or inetd socket-activated service, in which case the service manager will provide the initial socket and the service can run without any special privileges.

The mapping of Pi serial numbers to OS image files can also be placed in a configuration file under /etc/nobodd/conf.d. A tool, nobodd-prep, is provided to both customize images for boot and generate basic configuration files for nobodd-tftpd and nbd-server.

Useful Links

nobodd's People

Contributors

waveform80 avatar

Watchers

 avatar  avatar

nobodd's Issues

Improve reload

Refine the SIGHUP handling so that the socket isn't closed and re-opened if unnecessary. Concept: move body of the main loop into its own routine, add another loop there with a ReloadConfig exception handler that checks old_config.(listen, port) == new_config.(listen, port) and updates the server.boards dict if true.

Reload breaks with inherited sockets

Reloading the service fails when the socket is inherited from a service manager. BootServer.server_close closes the socket implicitly. If #7 is fixed this shouldn't occur (because the socket wouldn't be re-created if the socket details hadn't changed), so any fix for this should probably be reverted when #7 is implemented.

Handle FAT loops

Enumeration of the file's chain in FatFile constructor should detect loops (use set and check length against length of map)

Add dirty & damaged props

FatFileSystem should have read/write properties for dirty and damaged (and dirty should be set+cleared by FAT ops)

Inherit TFTP socket

The fact port 69 is privileged is the last thing implying nobodd-tftpd needs root privileges. We could implement dropping privileges, but it would be far simpler to just inherit it from systemd/inetd.

Add tz=UTC parameter to FatFileSystem

Add a tz parameter to FatFileSystem to ensure all decoded datetimes are non-naive (ahead of the deprecation of naive datetimes in future Python). Default to UTC, but document that this should ideally be the local TZ (can we default to local sanely?).

Split up prep

Having used prep for a bit, I've come to the conclusion I've committed the cardinal UNIX sin of doing too much in one tool. It needs splitting up:

  • --size can be ditched; fallocate does that just fine anyway
  • --copy and --remove can go into something like nobodd-cp and nobodd-rm. Perhaps add an ls and cat clone while at it
  • cmdline manipulation should be made more generic; some sort of nobodd-cmdline tool that can "set" var=value (how to delete values?) in the cmdline.txt
  • what about config generation? nobodd-cfg? Hmm... need to think about that one

Determine write behaviour on ENOSPC

We can either raise ENOSPC or return a partial write. Probably worth experimenting with other drivers and seeing what the common behaviour (if any) is.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.