96 Commits
Author SHA1 Message Date
Michael Stapelberg 985d2475dc POC: zstd support
see https://github.com/gokrazy/internal/commit/7a71061374b0cf30fb53e9c8e7edcab14d240452
2020-06-26 11:57:04 +02:00
Michael Stapelberg fc121e1383 export Model() 2020-06-26 11:56:51 +02:00
Michael Stapelberg f16a76357f update: use crc32 for checksumming when the client requests it
This is significantly faster than sha256 on the Raspberry Pi 4:
update speeds increase from ≈12 MB/s to ≈55 MB/s.
2020-06-26 11:03:54 +02:00
Michael Stapelberg 28292f8e00 quickstart: update for new packer output 2020-06-21 08:29:28 +02:00
Michael Stapelberg 272a5324e3 status: fix template by plumbing through EEPROM variable 2020-06-21 07:43:59 +02:00
Michael Stapelberg 546057ad9b ntp: log a message after setting the clock
related to https://github.com/gokrazy/tools/issues/15
2020-06-21 07:42:00 +02:00
Michael Stapelberg b48c3767fa README: fix update instructions 2020-06-20 13:27:56 +02:00
Michael Stapelberg f1231063e5 README: update instructions from quickstart guide 2020-06-20 13:25:58 +02:00
Michael Stapelberg 5dbb772825 website: make quickstart module init a little easier to follow
related to https://github.com/gokrazy/tools/issues/15
2020-06-20 13:22:12 +02:00
Michael Stapelberg 2cbd3c9442 website: fix prototyping link
fixes #62
2020-06-19 21:47:24 +02:00
Michael Stapelberg 310a7447e0 website: add rpi4b to supported platforms
related to https://github.com/gokrazy/gokrazy/issues/48
2020-06-19 09:02:09 +02:00
Michael Stapelberg c0759a418c website: pi 3 → pi 3 or 4 2020-06-19 08:58:39 +02:00
Michael Stapelberg be1a525364 README: Pi 3 → Pi 3 or 4
related to https://github.com/gokrazy/gokrazy/issues/48
2020-06-19 08:56:14 +02:00
Michael Stapelberg 00caabe479 issue template: add gokrazy/rpi4b
related to https://github.com/gokrazy/gokrazy/issues/48
2020-06-19 08:55:13 +02:00
Michael Stapelberg 0fa71a6018 display the EEPROM SHA256 hashes (shortened)
related to https://github.com/gokrazy/gokrazy/issues/48
2020-06-19 08:50:32 +02:00
Michael Stapelberg c306d3cd69 move template parsing out of func init
If we manage to build with a malformed template now,
the watchdog will work.

fixes #60
2020-06-17 09:13:44 +02:00
Michael Stapelberg 1ec8cbf7d9 add userguide for GPIO
related to https://github.com/google/periph/issues/432
fixes https://github.com/gokrazy/gokrazy/issues/33
2020-06-15 09:57:06 +02:00
Michael Stapelberg 59d57578b9 add userguide entries for unencrypted wifi and tls
related to https://github.com/gokrazy/gokrazy/issues/51
2020-06-01 11:23:34 +02:00
Michael Stapelberg f967cb6bb3 delete extra docs/ directory (oops) 2020-06-01 11:23:09 +02:00
Michael Stapelberg ad94ee5d4d rename GitHub action workflow to diskimage 2020-05-31 23:23:41 +02:00
Michael Stapelberg 848ce3c054 pull in latest gokrazy/internal 2020-05-31 23:23:22 +02:00
Michael Stapelberg a457d8e04a start a userguide, with an entry about remote syslog
related to https://github.com/gokrazy/gokrazy/issues/51
2020-05-31 21:17:01 +02:00
Michael Stapelberg 9a6d5dfd7b import website into main repository
related to https://github.com/gokrazy/gokrazy/issues/51
2020-05-31 20:29:57 +02:00
Michael Stapelberg 87609f10c7 switch from travis to GitHub actions 2020-05-30 20:33:51 +02:00
Michael Stapelberg 8c74716f04 pull in recent enough gokrazy/internal 2020-05-30 19:05:15 +02:00
Michael Stapelberg 2398e37f70 status: use partuuid-based path in mkfs instruction
fixes https://github.com/gokrazy/gokrazy/issues/12
2020-05-30 18:47:48 +02:00
Michael Stapelberg b93a58e5c8 status: print module info details
fixes https://github.com/gokrazy/gokrazy/issues/59
2020-05-30 18:17:38 +02:00
Michael Stapelberg 32f88999da set HOME=/perm/$basename when starting services
Previously, HOME was inherited from the environment of the init process, which
has HOME=/ set. Of course, / is not writable on gokrazy, so this change makes
things less strict and should therefore not break any deployments.
2020-05-27 18:50:52 +02:00
Michael Stapelberg 9e57e3cf2e dhcp: make network interface name configurable
related to https://github.com/gokrazy/gokrazy/issues/57
2020-05-27 08:24:50 +02:00
Michael Stapelberg c2116a79ed README: FAT16B → SquashFS
related to #10
closes #56
2020-05-25 18:56:08 +02:00
Michael Stapelberg 7e02056689 status: include service status and GOARCH in HTTP headers
This will come in handy in https://github.com/gokrazy/breakglass
2020-05-25 09:29:58 +02:00
Michael Stapelberg 727ba0f371 serial console: also try /tmp/serial-busybox/ash
This path is provided by the github.com/gokrazy/serial-busybox package.

related to https://github.com/gokrazy/gokrazy/issues/54
2020-05-21 23:12:15 +02:00
Michael Stapelberg f3445e01a9 fix switchRootPartition on non-PARTUUID installations
The first update always worked, but a subsequent update would not.

To manually switch an installation to PARTUUID, mount its boot partition and
replace the root= kernel parameter in cmdline.txt, like so:

/tmp/breakglass669384965 # mkdir boot
/tmp/breakglass669384965 # mount /dev/mmcblk0p1 boot
/tmp/breakglass669384965 # cat boot/cmdline.txt
console=ttyAMA0,115200 root=/dev/mmcblk0p2 init=/gokrazy/init elevator=deadline rootwait
/tmp/breakglass669384965 # sed -i 's,root=/dev/mmcblk0p,root=PARTUUID=471cad93-0,g' boot/cmdline.txt
/tmp/breakglass669384965 # cat boot/cmdline.txt
console=ttyAMA0,115200 root=PARTUUID=471cad93-02 init=/gokrazy/init elevator=deadline rootwait
/tmp/breakglass669384965 # umount boot
/tmp/breakglass669384965 # reboot

The PARTUUID= for your installation is printed by gokr-packer:
[…]
2020/05/01 10:05:34 write.go:366: writing MBR (LBAs: vmlinuz=51789, cmdline.txt=119561, PARTUUID=471cad93)
[…]
2020-05-01 10:06:17 +02:00
Michael Stapelberg 3a6c5f85d2 header: include model name on supported platforms 2020-04-08 15:24:36 +02:00
Michael Stapelberg 6bbd4a085c pull in new-enough version of gokrazy/internal 2020-04-07 10:00:01 +02:00
Michael Stapelberg 3c0f8141ee travis: switch to Go 1.14 2020-04-07 09:54:31 +02:00
Michael Stapelberg 057fc9dcb0 add /update/features handler for feature negotiation
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 09:52:12 +02:00
Michael Stapelberg ffc8928d2e update to new rootdev API
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 09:00:10 +02:00
Michael Stapelberg 6beb2e16aa implement remote syslog as a platform feature
To configure, run the following command in an interactive shell (e.g. via
breakglass, or when mounting the permanent partition of the SD card on the
host):

  mkdir /perm/remote_syslog
  echo 10.0.0.76:514 > /perm/remote_syslog/target

I recommend using a (static) IP address for increased reliability, so that
remote syslog works even when DNS does not.

fixes #50
2019-12-10 22:15:42 +01:00
Michael Stapelberg 25d06ba514 gofmt GENERATED_bundled.go 2019-11-09 09:59:25 +01:00
Michael Stapelberg 09fbdb123e bundle bootstrap, bootstrap-table and jquery assets
This way, the UI works even when the user is offline, which is handy for
router7.
2019-11-09 09:37:23 +01:00
Michael Stapelberg 520b8ca41d dhcp: use SetReadDeadline, not SetDeadline
related to https://github.com/mdlayher/raw/issues/42
2019-03-21 09:16:44 +01:00
Michael Stapelberg d5bd78d555 travis: test with go1.12
github.com/mdlayher/raw requires go1.12.
2019-03-04 17:47:55 +01:00
Michael Stapelberg 107f6fe098 start /perm/sh if it exists upon any byte on the serial console
This allows debugging when the network is down.
2019-02-19 07:46:07 +01:00
Michael Stapelberg 4af394b99e README: use sdx to prevent mistakes 2019-02-07 14:39:40 +01:00
Michael Stapelberg 7fe27df5ed listeners: support github.com/gokrazy/gdns, export IsInPrivateNet 2019-01-16 21:01:01 +01:00
Michael Stapelberg 856c5b62d4 dhcp: request domain name, too 2019-01-01 17:17:02 +01:00
Michael Stapelberg 25dc781a8e Set Access-Control-Allow-Origin header to load external CSS
With Chrome 70, I didn’t get the bootstrap CSS files anymore.
2018-12-26 16:15:14 +01:00
Michael Stapelberg 2216841c80 travis: update to more recent Go version 2018-11-21 08:49:51 +01:00
Michael Stapelberg 3af32e1d14 dhcp: resolve a few TODOs in comments 2018-11-21 08:46:16 +01:00
Michael Stapelberg 14287515bc dhcp: switch to github.com/rtr7/dhcp4
All existing DHCPv4 packages I looked at were unappealing for one reason or
another, so we’re now using a little helper to glue github.com/google/gopacket
and github.com/mdlayher/raw together, which suffices for our use-case and gives
us more control.
2018-11-21 08:43:49 +01:00
Michael Stapelberg a6ce446055 format GENERATED_bundled.go with newer gofmt 2018-11-01 18:44:10 +01:00
Michael Stapelberg 63803ab95e update listeners when netlink reports an address change
related to issue #21
2018-11-01 18:41:57 +01:00
Michael Stapelberg 5fb3d517ed listeners: improve logging 2018-11-01 18:41:55 +01:00
Michael Stapelberg 99287f68e3 update rootRe for running in user-mode linux 2018-11-01 17:54:23 +01:00
Michael Stapelberg 389a515555 README: update to reflect quickstart
https://gokrazy.org/quickstart.html
2018-11-01 17:07:53 +01:00
Michael Stapelberg 1c16b3b4eb serve favicon.ico 2018-07-15 18:32:46 +02:00
Michael Stapelberg 504f06b15f issue template: add missing * 2018-07-15 17:24:03 +02:00
Michael Stapelberg 6ac0eb2ced add issue template asking for the hardware target 2018-07-15 17:23:07 +02:00
Michael Stapelberg fc8dd9e2f2 reboot: use cmdline from boot/cmdline.txt
For bootonly updates, switching to the inactive root partition is incorrect.
2018-07-15 10:40:19 +02:00
Michael Stapelberg 9770d4408f move root device finding function to internal/rootdev 2018-07-14 23:37:12 +02:00
Michael Stapelberg d8206c507c /update/mbr: strip p suffix from mmcblk0p 2018-07-13 23:53:46 +02:00
Michael Stapelberg 835dae6a18 add randomd (carries entropy across restarts) 2018-07-13 23:44:47 +02:00
Michael Stapelberg 24c8ad07b5 streamRequestTo: call f.Sync()
When calling reboot shortly after /update/*, the kernel should flush its cache,
but if you’re not calling reboot, it would be good to persist the data on disk
nevertheless.
2018-07-13 23:16:26 +02:00
Michael Stapelberg 0f8d40d7f6 add /update/mbr 2018-07-12 09:27:32 +02:00
Michael Stapelberg c74265523b implement XSRF/CSRF protection for /stop and /restart
While stopping/restarting processes seems like a nuisance at best, it’s good
style to prevent these attacks.

This commit the Double-Submit Cookie protection, which seems appropriate for our
architecture and demands. See also:
https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet#Double_Submit_Cookie
2018-06-25 18:38:08 +02:00
Michael Stapelberg 7dc7a36757 supervise: refactor to use one HTTP handler 2018-06-25 18:27:23 +02:00
Michael Stapelberg 9a14ab0d8d dhcp: add note to prevent future mistakes 2018-06-22 09:02:53 +02:00
Michael Stapelberg 4a126f13af init+dhcp changes for Squashfs root file systems
We can do away with a bunch of hacks now, but we’ll keep them around for a
little while to make updates easier (i.e. to boot with old and new gokr-packer
versions, just in case people don’t update both at the same time).
2018-06-21 23:21:51 +02:00
Michael Stapelberg d1d355d840 listeners: treat interfacees named uplink* as public 2018-06-18 09:52:48 +02:00
Michael Stapelberg 59b99bc704 remove hard-coded mmcblk0 from all places 2018-06-17 09:31:14 +02:00
Michael Stapelberg 4f0e427025 reboot: use kexec where possible
This doesn’t work on the Raspberry Pi yet (due to missing kexec_file_load), but
I tested it in qemu.
2018-06-17 09:29:29 +02:00
Michael Stapelberg 91da7026f8 reboot: send SIGTERM to processes, wait for 1s
This way, programs can flush state to permanent storage if they need to.
2018-06-17 08:53:19 +02:00
Michael Stapelberg 6c059494af ntp: set real-time clock (hwclock) if present 2018-06-13 23:51:31 +02:00
Michael Stapelberg 238bbfa55e init: update listeners when pressing <ENTER> on the serial console
This is useful when the network doesn’t come up correctly: you can connect a
network cable between your computer and the gokrazy machine, press <ENTER> on
the serial console and connect to gokrazy via its IPv6 link-local address (to
find the address, use ping6 ff02::1%eth0).
2018-06-12 22:22:47 +02:00
Michael Stapelberg 34f12d9ada update: find root device instead of hard-coding /dev/mmcblk0p*
This should allow using gokrazy from a USB drive.
2018-06-12 22:19:13 +02:00
Michael Stapelberg 9063e4526a add hostname to title
This makes it easier to deal with multiple tabs on multiple devices :)
2018-05-17 09:11:44 +02:00
Michael Stapelberg 6063608b2b update: introduce a /bootonly handler for bakery
Regular updates hit /boot, /root, then /switch.

bakery only updates /boot, so we need to take care of persisting the active root
partition across /boot updates.
2018-05-17 09:08:25 +02:00
Michael Stapelberg 5760e0f265 use GOKRAZY_UPDATE envvar to avoid exposing passwords in argv
fixes #38
2018-03-29 11:59:54 +02:00
Michael Stapelberg a470a80ae1 README: expand on the “changing init behavior” example
fixes #39
2018-03-29 11:50:30 +02:00
Michael Stapelberg b5d7cb2fcf add PublicInterfaceAddrs and display them on the status page 2018-03-20 19:34:36 +01:00
Michael Stapelberg 2e60d5b8c8 ping hardware watchdog every 1s
In case gokrazy gets stuck for whichever reason, the hardware watchdog will
reset the Raspberry Pi 3.
2017-10-21 20:05:26 +02:00
Michael Stapelberg 32e8b6dd34 dhcp: persist domain name to resolv.conf if specified 2017-09-19 14:48:36 +02:00
Michael Stapelberg 6127f9566e dhcp: set client id (option 61), some routers need it
E.g. /etc/kresd/dhcp_host_domain_ng.sh on a turris omnia incorrectly deletes
DHCP hostname mappings when more than one client does not send a client id.
2017-09-05 09:52:53 +02:00
Michael Stapelberg 3ed1e381b5 ntp: drop privileges to nobody/nogroup, retain CAP_SYS_TIME 2017-09-03 22:21:00 +02:00
Michael Stapelberg 83adedae5d ntp: use gokrazy vendor zone
fixes #34
2017-08-25 09:24:15 +02:00
Michael Stapelberg eb8f1753b3 ntp: react to breaking API change
See https://github.com/beevik/ntp/pull/14
2017-08-23 09:51:01 +02:00
Michael Stapelberg b96471c05d update FAT16B writer import path 2017-07-14 03:19:15 +02:00
Michael Stapelberg 13173460da dhcp: set hostname for renewal packets as well
Otherwise, router restarts might result in the hostname getting
lost (observed using dnsmasq on OpenWrt).
2017-07-01 11:29:10 +02:00
Michael Stapelberg 3999a60a05 WaitForClock: give up after 1 year, not 1 minute
related to issue #21
2017-03-25 20:47:47 +01:00
Michael Stapelberg 83181ca00c add empty package
related to #14
2017-03-05 20:27:48 +01:00
Michael Stapelberg c7ae5cac83 README: add go report card badge 2017-03-04 18:48:20 +01:00
Michael Stapelberg 60d4164cfe README: add travis build status 2017-03-04 18:47:07 +01:00
Michael Stapelberg b3c9568a9d Link to golang.org for installing go1.8 2017-03-04 18:46:24 +01:00
Michael Stapelberg 09883a3b00 add travis config 2017-03-04 18:45:08 +01:00
Michael Stapelberg 38af7fd18d Initial commit 2017-03-04 11:22:48 +01:00