Skip to content

alias-asso/polybase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polybase

Wait what the hell?

This is a simple inventory manager currently primarily used for keeping track of paper handouts managed by ALIAS

User-facing usage

  • point your Gemini browser to <hostname>
  • if web proxying is set up (such as with kineto), just point your browser there

Staff-facing usage

Point your Gemini browser (with the appropriate client certificate present) to <hostname>, there should be 3 modes:

  • Bulk Decrement/Increment: click on an item to immediately decrement/increment it by 1
  • Change Individually: click on an item to go to its own page where you can decrement/increment it, explicitly set its value to an arbitrary amount, and toggle whether it is hidden or not

How?

This program is a single CGI script meant for the gmid Gemini server, but it should work for any Gemini server with client certificate (Fast)CGI support, save for some adapting of the environment variable names it receives (in particular GEMINI_SEARCH_STRING, a URL-decoded version of QUERY_STRING if it doesn't have any unencoded =). It is configured by setting variables in $POLYBASE_CONF, by default (/usr/local)/etc/polybase.conf.

Keep in mind that this script isn't very extensible on purpose: I want to avoid feature creep and this script is at the high end of acceptable complexity for shell, so if your requirements are significantly more complicated than what this script offers and can't be accomplished by external helper programs/wrappers, it isn't what you're looking for.

Setup

/etc/
  `- gmid.conf
/var/
  `- gemini/
    `- bin/
      `- cut
      `- tr
      `- sh
      `- sqlite3
    `- polybase.db
    `- polybase.lmao.cringe/
      `- polybase

First, make a SQLite database with the provided schema (sqlite3 <path to polybase.db> < <path to schema.sql>). Don't forget to change ownership to the Gemini server user, typically _gmid with gmid (chown _gmid:_gmid <path to polybase.db>), and make the database file group-writable (chmod g+w <path to polybase.db>).

Next, add users: to obtain the SHA256 fingerprint of the client certificates you want to use, something like openssl x509 -in <cert.crt or cert.pem> -noout -sha256 -fingerprint | cut -d "=" -f 2 | tr "[A-Z]" "[a-z]" | tr -d ":" might be useful, or copy it from your Gemini browser (Lagrange has support for this for example) if it was generated there. Use polybasectl (and make sure the path to polybase.db is correct) to manage users and add courses (consult polybasectl -h), for users the fingerprint should be typed as 1 string without any colons and all lowercase; make sure the the script is executable, start gmid, and it should work.

gmid works in a chroot (by default /var/gemini), so $POLYBASE_CONF, sh, cut, tr, and sqlite3 must be hardlinked (consult ln(1)) or copied at the root of the chroot, in the same directory structure as it would be outside of it. ldd is your friend here, make sure to link/copy over all dependent libraries in a similar manner depending on what the binaries (and dependent libraries) themselves may depend on (for instance, on OpenBSD, sh has no dependencies, but many others at different binary directory paths do). That being done, simply make an entrypoint to this script in gmid.conf, refer to gmid.conf(5) for a complete reference. Example:

user "_gmid"
chroot "/var/gemini"

polybase = "polybase.lmao.cringe"

server $polybase {
	cert "/etc/ssl/gemini/" $polybase ".pem"
	key "/etc/ssl/gemini/private/" $polybase ".key"
	root "/" $polybase
	entrypoint "/polybase"
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages