Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply menu password entry to SMB + hotspot #1570

Merged
merged 8 commits into from
Jul 20, 2022
Merged

apply menu password entry to SMB + hotspot #1570

merged 8 commits into from
Jul 20, 2022

Conversation

dndrks
Copy link
Member

@dndrks dndrks commented Apr 28, 2022

addresses #1531

summary

this PR proliferates the menu password entry (under SYSTEM > PASSWORD) to the SMB + hotspot passwords as well.

implementation

  • for SMB, I used printf for the smbpasswd -a command because it requires double-verification of the new password
  • for hotspot, a hidden .system.hotspot_password file is created in the data folder, which holds the password. this file is checked by wifi.lua whenever the hotspot is activated.
    • if the file exists, norns passes the password contained
    • if the file doesn't exist, norns uses the default "nnnnnnnn"
    • since maiden doesn't show hidden files in the file selector, this seemed like a good solution (it is viewable in maiden by accessing <norns_address>/maiden/#edit/dust/data/.system.hotspot_password)

testing

this tested well on my standard norns (CM3+) and macOS Monterey 12.0.1:

  • connected via Cyberduck + changing the password: new password was prompted and accepted
  • connected via SMB + changing the password: new password was prompted and accepted
  • connected via hotspot + changing the password: after disabling and re-enabling hotspot on norns (since the password is only proliferated when hotspot is activated), network connectivity was lost and new password was prompted + accepted

@dndrks dndrks requested a review from tehn April 28, 2022 16:05
@tehn
Copy link
Member

tehn commented Apr 28, 2022

smb password set, awesome!

hotspot--- concerned that this technique puts the system password in plaintext on a file in dust. maybe @ngwese or @catfact have alternative ideas?

@ngwese
Copy link
Member

ngwese commented Apr 29, 2022

i agree it is maybe not ideal that the password is within view of maiden. early on i remember having wifi code which created the hotspot connection configuration once instead of each time the hotspot connection is enabled. i've long forgotten the reasons why we have it that way instead of creating it when for example the password is being changed and simply activating later.

i couldn't come up with any alternative ideas which were more secure. i guess at a minimum sticking the password under /home/we/.config/... would be slightly better. fwiw network manager stores wifi passwords in clear text within per connection config files in /etc/NetworkManager/<name>.nmconnection but at least the file is only readable by root. again that isn't much of a hurdle since the we user has password-less sudo.

alternatives could be to generate a new random password each time hotspot is enabled and print it to the screen. i contemplated printing a QR code to the screen but while that would be slick for a mobile devices it would not work well for a computer.

@dndrks
Copy link
Member Author

dndrks commented Apr 29, 2022

thanks for the additional insights + brainstorming <3

alternatives could be to generate a new random password each time hotspot is enabled and print it to the screen.

this is a cool idea! this morning, i was thinking a fair middle-ground between this and storing in a too-accessible location might be requiring the user to generate the password each time they enable hotspot. which is initially attractive to me because i use hotspot a fair amount during dev on my mac and feel ornery about clearing my previously-saved network or waiting for it do the minute-long cycle of trying to connect with the previous credential before it just gives up. but that's honestly less overall effort than using the encoders to enter a password on norns.

rad, i'm happy to take a pass at this, unless there's any counter arguments to this approach (@tehn) ?

@ngwese
Copy link
Member

ngwese commented Apr 29, 2022

i agree that generating a random password each time is going to be annoying for anyone who uses hotspot with regularity. if we could do setting password on first activation or simply recreate the hotspot connection profile when changing the password i think that would minimize friction.

the one thing which occurs to me is that the nmcli profile creation might fail if the nub isn’t plugged in.

@tehn
Copy link
Member

tehn commented Apr 29, 2022 via email

@ngwese
Copy link
Member

ngwese commented Apr 29, 2022

i’m not sure if the internet sharing functionality in macos would allow the wifi to act as both an AP (for norns) and a client to an existing wifi network. i have used a wired ethernet from norns directly connected to a laptop and the laptop connected to the outside world via wifi. that worked fine.

i have no idea if the same could be accomplished on linux or windows with the same level of ease.

taking a step back if the motivation for the hotspot password is to protect norns in a shared environment more so than it is today the existing default password might be fine as long as maiden eventually gets password protection. (which i intend to look at after the norns converged branch is fully stable)

@tehn
Copy link
Member

tehn commented May 3, 2022

ah, i never expected that internet sharing would work with hotspot in any OS--- as the transceiver would need to be active on two channels--- i'm uncertain modern wifi cards are even capable of doing this?

more my point: it seems we have hotspot mode to address the situation where a known wifi network isn't available, and we don't want to explain in the docs how to have your computer (in macos, windows, and linux) create a hotspot (hosted by your computer) for norns to connect to. so we complexify norns in order to lessen the assumed knowledge by the user of their OS. in the end, all we're trying to do is get a network connection between these two devices. is this a fair assessment?

back to the actual point:

i think what dan's PR is trying to do is simplify the password situation, so there aren't multiple passwords. more of a usability issue than a security issue. (of course, if any of us saw a "norns" network in a coffee shop, tada)

@ngwese
Copy link
Member

ngwese commented May 3, 2022

apologies if my responses above muddied the waters. i think it is fine for all the passwords to be the same and i agree that the end goal is to establish a connection between norns and computer with the minimum of friction.

sticking the password in clear text in a file is certainly a improvement over a fixed non configurable password. keeping the password in a file away from parts served by maiden at least keeps it from being accessed directly via URL.

@dndrks
Copy link
Member Author

dndrks commented Jun 14, 2022

sorry for the massive delay! i forgot that we landed on greg's super helpful summary:

sticking the password in clear text in a file is certainly a improvement over a fixed non configurable password. keeping the password in a file away from parts served by maiden at least keeps it from being accessed directly via URL.

with this in mind, i pushed the following improvements:

  • after new password is set via SYSTEM > PASSWORD, hotspot password is saved to a hidden and maiden-inaccessible home/we/norns/.system.hotspot_password file
  • if maiden is open during password reset, user will see a prompt to toggle wifi off/on for the change to take effect

i think this covers folks pretty well, but happy to keep pokin' if there are further concerns (@ngwese + @tehn ). all's been tested, working well through a few password changes connecting with a macOS Monterey device + Pi3B shield

@tehn tehn merged commit 5b59630 into main Jul 20, 2022
@tehn tehn deleted the password-helper branch July 20, 2022 17:49
@dndrks dndrks mentioned this pull request Sep 6, 2022
dndrks added a commit that referenced this pull request Dec 12, 2022
WPA-PSK requires a sequence between 8 and 63 ASCII characters, so if a user uses this prompt to change their password to something shorter, then they won't be able to access hotspot (due to the conveniences added by #1570).

to help guardrail, this commit adds:
- an on-screen `textentry` check which shows a countdown to 8 characters and a warning if the password goes beyond 63
- a character count check to `m.passdone`, which will only change all passwords if the string length is >= 8 and < 64, otherwise it prints warnings to maiden that the password has not been changed
tehn pushed a commit that referenced this pull request Dec 12, 2022
WPA-PSK requires a sequence between 8 and 63 ASCII characters, so if a user uses this prompt to change their password to something shorter, then they won't be able to access hotspot (due to the conveniences added by #1570).

to help guardrail, this commit adds:
- an on-screen `textentry` check which shows a countdown to 8 characters and a warning if the password goes beyond 63
- a character count check to `m.passdone`, which will only change all passwords if the string length is >= 8 and < 64, otherwise it prints warnings to maiden that the password has not been changed
tehn added a commit that referenced this pull request Sep 27, 2023
* add PSET number to PSET actions + add delete action (#1544)

* add PSET number to callbacks + add delete callback

* fix passing pset_number in delete action

* Revert "fix passing pset_number in delete action"

This reverts commit 7f98bb2.

* fix pset_number in read action

* clean up formatting

* remove unnecessary nil checks

* update paramset docs

* fix parameter name passing to params:delete

* add pset_number to docs

* releases.txt

* remove nonexistent post_filter_fc_mod command from softcut param factory

* Update pmap.lua

* typo fix (#1560)

* fix registration for screen_display_image_region

* Update readme.md

* add note to readme regarding release flag

* use abl_link C API for link clock

* init session state

* add param separators to lookup table (#1539)

* add param separators to lookup table for hide/show

* add unnamed failsafe

* add visibility lookup for strings

* fix name forcing

* cleanup DSP 'lab work' folder (#1580)

* add script-definable action for when clock tempo changes (#1575)

* add clock.temo_changed callback

* clean up naming

* reset handler when clocks are cleaned up

* fold in artem's feedback

* remove 'source' pass, remove redundant nils

* params: align 'add_separator' and 'add_group' flow with other paramtypes (#1584)

* protect against casual param naming

* protect groups, too

* add error message

* change separator and group addition

* specify overwrite conditions

* overwrite flag allows for continuity for param count

* allow hidden param to be registered

* add parameter-based lfo scripting library (#1585)

* initial upload + unload lfo's after use

* default = 'param action' and track fn mapping

* add function type lookup table

* add ldoc notes

* bars -> clocked

* no spaces in param IDs

* remove 'frm', not used

* rename library to 'param_lfo'

* rename to 'param-lfo'

* p_lfo -> plfo

just cosmetic, but looks way better

* apply menu password entry to SMB + hotspot (#1570)

* unify smb + hotspot password change

* Update link

* Revert "Update link"

This reverts commit 55fff78.

* Revert "Merge branch 'main' into password-helper"

This reverts commit 66fe798, reversing
changes made to 651d7c0.

* Revert "Revert "Merge branch 'main' into password-helper""

This reverts commit b797f04.

* maiden inaccessible

* robust message for hotspot password change

* fix to add midi data when device is removed (issue #1557)  (#1562)

* typo fix

* fix to add midi data when device is removed (issue #1557)

code fixed and doc info updated for issue #1557: #1557

* Place downbeats correctly.

Without this change, a swing of 66 will shift some events early and some events late from where they would otherwise be. With this change, a swing of 66 leaves some beats alone, and shifts other beats late from where they would otherwise be. 

Example to evaluate change, run as a norns script:

```
engine.name = "PolyPerc"
local lattice = require("lattice")

function init()
    l = lattice:new()
    p1 = l:new_pattern{
        enabled = true,
        division = 1/4,
        action = function(t)
            print("q", t)
            engine.hz(440) 
        end,
    }
    p2 = l:new_pattern{
        enabled = true,
        division = 1/8,
        swing = 66,
        action = function(t)
            print("e", t)
            engine.hz(660)
        end,
    }
    l:start()
end
```

In this example, the expected behavior is that two events (440 and 660) fall on the "down" beat, and then one (660) falls on the "up" beat, but with a "triplet feel". Without the change we get the "eighth notes" falling before and after the quarter note, but not on it.

* Revert "add parameter-based lfo scripting library (#1585)" (#1588)

This reverts commit 221531a.

* Revert "fix to add midi data when device is removed (issue #1557)  (#1562)" (#1589)

This reverts commit a808394.

* add 'lfo' (#1591)

* add lib/lfospec

a general-purpose scripting library for establishing LFOs, with optional parameter UI control

* add lfospec attributions

* protect against nil IDs

* add note about clocks + start/stop with parameter menu

* update params per entry

* Use lattice for LFOs, so they share clocks, and allow setting ppqn

* attribution and unused var cleanup

* change name and fold in feedback

* register 'norns.lfo' table, manage from script.lua

* Update script.lua

* check for nil norns.lfo

* remove note about clocks

since using lattice, there's no worry about counting clocks

* add API text to LFO:add

okay, this is the last touch! sorry for all the final countdown updates 😬

Co-authored-by: Naomi Seyfer <naomi@seyfer.org>

* execute global Midi.remove callback (#1590)

this runs the global, customizable midi device removal callback when a device is unplugged (if the device is registered by the norns midi system), in addition to and without affecting the per-device removal callback (if defined.)

alternative to PR #1562, addressing issue #1557

* 220802

* releases.txt

* hotfix: lfo `:add` (#1593)

* hotfix: lfo `:add`

gah! the `:add` method wasn't properly invoking the `.new` function

* Update lfo.lua

* rest of the lfo hotfix (#1594)

* hotfix: lfo `:add`

gah! the `:add` method wasn't properly invoking the `.new` function

* Update lfo.lua

* Update lfo.lua

* releases.txt

* gamepad support (#1439)

* basic gamepad support w/ whitelist

* basic support for gamepad in global menu

* fix missing clear callback

* handling of analog joysticks & numeric dpads

* optim: faster lookup of event code 2 axis

* (cont.)

* fix bad name for axis properties

* bug fixes, catchall axis callback vs dpad/apad

* rename `apad` into `astick` (analog stick)

* mark dpad as naalog for bufalo model, fix typo

* do not debug log

* do not add separators to PSET file (#1598)

* fixed screen curve param descriptions (#1603)

* Update paramset.lua (#1605)

* expand acceptable accum CC values (#1606)

a tiny change that allows controllers to send any CC value above 64 for "up" and any below for "down". previously it had to just be 65 and 63 which isn't supported by all controllers.

* add TAPE previewing to fileselect (#1607)

* add previewing to fileselect

* working

* stop previewing on key and always on left scroll

* Tweaks to the keyboard (#1611)

* handle osc messages for the keyboard

* change parameters with +/- keys

* allow holding key to scroll menu

* toggle menu with F5 key

* goto menu if F1-4 are pressed

* add version error (#1613)

* add previewing to fileselect

* working

* stop previewing on key and always on left scroll

* add version error message

* working

* address issue #1612 (#1617)

adds a call to the script-defined `clock.tempo_change_handler` function whenever the `clock_tempo` parameter is changed in the parameters UI from an external source

* work on lattice v2 (#1616)

* work on v2

* preserve 'new_pattern' for backwards-compatibility

* quarter note is good actually lol

* incorporate tyler's comments

* docblock, comments, and semantic changes

Co-authored-by: Tyler Etters <tyler@etters.co>

* fix `_menu.keychar` not getting called (#1619)

* prevent global menu shortcut messing up w/ sub-menu's (#1620)

* fix undefined `gamepad` when `script.clear` gets called (#1621)

* fix: document sprocket ordering (#1625)

* update lfo lib to use lattice sprockets (#1626)

* add password length failsafes for WPA-PSK (#1627)

WPA-PSK requires a sequence between 8 and 63 ASCII characters, so if a user uses this prompt to change their password to something shorter, then they won't be able to access hotspot (due to the conveniences added by #1570).

to help guardrail, this commit adds:
- an on-screen `textentry` check which shows a countdown to 8 characters and a warning if the password goes beyond 63
- a character count check to `m.passdone`, which will only change all passwords if the string length is >= 8 and < 64, otherwise it prints warnings to maiden that the password has not been changed

* 221214

* releases.txt

* update.sh fix

* update docs

* releases.txt

* `new_pattern` was missing return keyword (#1629)

* lfo fixes + improvements (#1630)

fixed locally global variables for `scaled_min` / `scaled_max`, `mid`, and `rand_value`, which interfered with square and random waves when multiple LFOs were running with different min/max values.

added `mid: rising` and `mid: falling` as options for the `reset_target`, which allows more control over how the reset affects the starting value

* add osc.cleanup() to script.lua (#1643)

* allow sending midi clock to all devices simultaneously (#1642)

* Add files via upload

* toggles for targeting device clock out

builds out @tehn's feedback from #1642 :
- any currently-ported midi device will populate in the 'midi clock out' section of 'PARAMS > CLOCK'
- each visible entry has a toggle to receive norns clock
- toggles get saved/restored as part of `system.state` during clean reboots

follow the approach brian outlined actually saves us from doing any if's during each clock tick!

* longer short name

cleaned up formatting to match the SYSTEM > DEVICES > MIDI syntax, which allows for up to 20 characters to display comfortably before aliasing

Co-authored-by: dan derks <derks.dan@gmail.com>

* fix lattice transport value getting increased in steps of 5 (#1638)

* fix lattice ppqn resolution divded by 5

* order sprockets once per pulse

* Make maiden-repl compile on macOS 13.1 Ventura (#1645)

* Change wrap to use math instead of iteration, and happen in constant time (#1577)

* clean up device callbacks (#1646)

* remove unnecessary _menu.rebuild_params() (#1647)

this gets called elsewhere throughout the stack (including MIDI device add/remove), which makes this unnecessary -- it also seems to cause race-condition conflicts as the rebuild attempts to index parameters which don't yet exist

* Update device_midi.c

blind fix attempt for dropped sysex bytes

* fix typo (want stop byte not start byte)

* Add UK keyboard option. (#1651)

* Remove error from unknown key press. (#1654)

* fix argument indices for buffer_clear_region_channel (#1656)

this is a blind fix attempt for issue #1652

* lua NRT processing function (#1634)

* not working

* still not working

* first draft

* fix typo

* refactor: attempt to pass buffer data rather than function

* catch silly typo

* process_chunk should match OscInterface.cpp

* working! refactor to allow longer sections to be processed

* fix errors

* catch typos

* refactor to use shared memory

* attempt to not cause stack overflow, fix wscript so norns ./wafs correctly

* catch typo, add debug prints

* attempt to prevent poke failing to open shared memory

* strange not-working place

* catch small typo, add debug print

* attempt to prevent error on second call to process

* working

* refactor to use clocks to chunk up softcut_process

* fix weaver bugs, change lua API

* fix: catch typo

* Update docs for screen.fill() and screen.stroke(). (#1660)

* new crow4 features on norns (#1662)

* run ldoc

* regenerate docs

* better separator labeling in core params (#1665)

* better separator labeling

* Update audio.lua

* reduce 'send_midi_clock' var scope (#1666)

during release testing, i realized that after my ~40th script load, `clock.sync` calls were off by a tenth of a beat, compounding as i continued to load scripts.

when i verified #b932b0d sparked the issue's emergence, i realized that the `send_midi_clock` table was being added to each time `clock.add_params()` was called, but never emptied out. so, eventually, the clock was doing 24ppqn calls on a table with *tons* of entries.

i guess nice to accidentally stress-test that a lot of devices could receive MIDI clock before timing issues emerged? anyway, fixed now!

* Implement character/key conversion (#1659)

* Implement character/key conversion.

* Remove char_to_code().

* [mergeable] rework `gamepad` to handle more edge-cases (#1624)

* rework gamepad to handle more edge-cases

* woops

* SDL-format GUID generation for HID devices

* (cont., missed this one binding)

* use this new GUID as id in known controller models table

* add guid in controller conf, some 8bitdo masquerade as xbox 360

* log guid

* actually use guid in `gamepad.process` callback

* analog btn support, fix std order X axis, no meta btn state

* fix value of sign in gamepad.axis() when analog button

* remove dead code

* re-introduce denoize for analog buttons, comments

* call gamepad.analog after computing state

* on sensors, negative half is generally 1+ bigger than positive one

* tweak submenu integration

* disable verbose mode

* prevent trigger script cb if in menu, add _menu.analog

* prefix all new `menu` callbacks w/ `gamepad_`

* rounding the half-reso may be counter-intuitive, document instead

* sometimes lower half bigger, sometimes upper one...

* fix actual resolution for this controller

* be resilient against "lean" config files (w/ empty maps ommited)

* add system/settings menu, move items, add battery_warning (#1668)

* add system/settings menu, move items, add battery_warning

* yikes booleans

* fixes

* export png (#1669)

* changelog

* norns.expand_filesystem() (#1670)

* Update norns.lua

* Update norns.lua

* releases.txt

* allow user to add gamepad profiles without tempering w/ core (#1671)

* allow user to add gamepad models without tempering w/ core

* more explicit var names

* Revert "lua NRT processing function (#1634)" (#1673)

This reverts commit 0c06b09.

* changelog

* releases.txt

* Update settings.lua (#1675)

* revert export_png and rename export_screenshot (#1676)

* changelog, version, releases.txt

* releases.txt

* fix: softcut.voice_sync order documentation

softcut's `voice_sync` command has its arguments reversed in the API docs

* add fade_time correction, as well!

* fix fade_time parameter names

* add filters to fileselect (#1678)

* add filters to fileselect

* Update fileselect.lua

* remove whitespace

* fix midi clock double-tap (#1680)

* changelog, version

* update.sh ancient typo

* Update releases.txt

* fix #1681 (#1682)

ah! i had totally spaced on the auto-shortening of long filenames by appending '...', which confused the "is this a file or is this a folder?" mechanism! this is now fixed + and i will ask for community testing!

* 230614

* changelog

* releases.txt beta

* releases.txt stable

* Return correct 7th chords from musicutil.generate_chord_scale_degree  (#1688)

* Support half-diminished chords and correct scale degrees

* Add remaining missing 7th chords to roman notation: dominant, minor major, augmented major

* Use M decorator for Augmented Major 7, expand docs

* More docstring tweaks

* Update scale chord tables for Augmented Major 7 (27)

* Add new glyphs with FontForge instead of PixelForge

* Add alt_names Min7b5 and Maj7#5 for consistency w/teletype

* Ensure that disk field can represent size of larger sd cards (#1690)

Co-authored-by: Chris Aquino <aquino.chris@pm.me>

* lfo library: v2 (#1692)

* 'saw' -> 'tri', add 'up' and 'down', fix init

* build params from lfo spec

* add phase

* tune 'RESTART' (#1695)

* midi mapping touchups (#1696)

* fix user gamepad profile lookup + new model (#1697)

* fix: user-defined gamepad profile lookup

* new gamepad model: Retrolink B00GWKL3Y4

* more info

* disable hciuart in update (#1700)

* make variable y in util.wrap local (#1704)

* fix: debounce tape preview in fileselect (closes #1628) (#1703)

---------

Co-authored-by: dan derks <derks.dan@gmail.com>
Co-authored-by: brian crabtree <tehn@nnnnnnnn.co>
Co-authored-by: zbs <86270534+zjb-s@users.noreply.github.com>
Co-authored-by: Jonathan Snyder <52048666+jaseknighter@users.noreply.github.com>
Co-authored-by: Greg Wuller <greg@afofo.com>
Co-authored-by: Tyler Etters <tyleretters@users.noreply.github.com>
Co-authored-by: Artem Popov <artfwo@gmail.com>
Co-authored-by: Naomi Seyfer <naomi@seyfer.org>
Co-authored-by: Jordan Besly <11557146+p3r7@users.noreply.github.com>
Co-authored-by: Tom Waters <github@random-works.co.uk>
Co-authored-by: Rylee Alanza Lyman <46907231+ryleelyman@users.noreply.github.com>
Co-authored-by: Zack <zack.scholl@gmail.com>
Co-authored-by: Tyler Etters <tyler@etters.co>
Co-authored-by: kasperbauer <kasperbauer@users.noreply.github.com>
Co-authored-by: Anders Östlin <anders.ostlin@gmail.com>
Co-authored-by: Nik Silver <nik@niksilver.com>
Co-authored-by: trent <trent.gill@gmail.com>
Co-authored-by: brian crabtree <tehn@monome.org>
Co-authored-by: Michael Dewberry <michael.dewberry@gmail.com>
Co-authored-by: Chris Aquino <chris@thunderbird.net>
Co-authored-by: Chris Aquino <aquino.chris@pm.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants