summaryrefslogtreecommitdiff
path: root/stand/lua/password.lua
AgeCommit message (Collapse)Author
2023-08-16Remove $FreeBSD$: two-line lua tagWarner Losh
Remove /^--\n--\s*\$FreeBSD\$.*$\n/
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2023-04-15loader: lua: disable autoboot timer after password entryCyrus Rahman
In the lua loader, if one sets a password in loader.conf, the autoboot_delay timer will start before the menu is displayed. One can interrupt the autoboot and bring up the menu by entering a keyboard character before the timer expires. If this is done a prompt for the password is displayed. Entering the password will bring up the menu, but the timer will again start and another keyboard character must be entered or autoboot will abort the menu and boot the system. PR: 265472 Reviewed by: kevans MFC after: 3 days
2019-09-26Further normalize copyright noticesKyle Evans
- s/C/c/ where I've been inconsistent about it - +SPDX tags - Remove "All rights reserved" where possible Requested by: rgrimes (all rights reserved) Notes: svn path=/head/; revision=352757
2019-03-26lualoader: Clear the screen before prompting for passwordKyle Evans
Assuming that the autoboot sequence was interrupted, we've done enough cursor manipulation that the prompt for the password will be sufficiently obscured a couple of lines up. Clear the screen and reset the cursor position here, too. MFC after: 1 week Notes: svn path=/head/; revision=345517
2019-02-18lualoader: only clear the screen before first password promptKyle Evans
This was previously an unconditional screen clear, regardless of whether or not we would be prompting for any passwords. This is pointless, given that the screen clear is only there to put our screen into a consistent state before we draw the prompts and do cursor manipulation. This is also the only screen clear besides that to draw the menu. One can now see early pre-loader and loader output with the menu disabled, which may be useful for diagnostics. Reported by: ian MFC after: 3 days Notes: svn path=/head/; revision=344243
2018-09-22Improve loader passwords:Edward Tomasz Napierala
1. Be clear about which password is being requested 2. Remove extraneous whitespace between the prompt and the cursor 3. Move the twiddle to where the prompt is, instead of two characters to the right 4. Fix erasing the 'incorrect password' message when retrying; previously it was erased partially 5. Remove the unneeded exclamation mark Reviewed by: kevans Approved by: re (gjb) MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17236 Notes: svn path=/head/; revision=338886
2018-03-02lualoader: Use global printc instead of loader.printcKyle Evans
r330282 registered loader.printc as printc, so use it instead. This makes sense for a couple reasons, the major point being that it reads a little bit easier and pairs nicely with the global 'print'. Similar cases can not really be made for other loader.* functions as most of them are either highly specific to our use-case or usually available in other modules, such as `os`. printc does not have a standard implementation in the Lua world(*), so we have a little more leeway with it, and it's kind of a special case of the globally available 'print'. (*) I've been in the Lua world for all of two weeks, so this could be wrong. Notes: svn path=/head/; revision=330283
2018-03-02lualoader: Use #str instead of tracking length with 'n'Kyle Evans
We really gain almost nothing by tracking length separately, especially when it's as easy as "#str", so reduce complexity. Notes: svn path=/head/; revision=330262
2018-02-28lualoader: Further screen cleanupKyle Evans
- Add screen.default_x and screen.default_y to determine where screen.defcursor resets the cursor to. - Use screen.setcursor in screen.defcursor instead of rewriting the escape sequence. - Use screen.default_y when resetting the cursor after writing the new twiddle character, add a comment verbally describing the position just in case. Notes: svn path=/head/; revision=330099
2018-02-28lualoader: Re-do twiddleKyle Evans
It worked on my test setup, but is clearly non-functional on others. Further examination of check-password.4th showed that it actually reset the cursor to 0,25 every time and overwrote the previous password prompt. Do that, and also clear the "Incorrect Password" text if the correct password gets entered. Notes: svn path=/head/; revision=330098
2018-02-27lualoader: Remove remnants of testing...Kyle Evans
twiddle_pos didn't need to be a module-scope local, since it's going to get reset with every read anyways- it was left-over from other things. screen.movecursor with a y=-1 setting was from a test of movecursor, resulting in the twiddle characters being drawn going up the console and looking quite funky. Notes: svn path=/head/; revision=330083
2018-02-27lualoader: Add a twiddle at password promptKyle Evans
This gives some form of feedback while typing, and matches-(ish*) Forth behavior. The cursor generally rests two column after the password prompt, then the twiddle is drawn three columns later and the cursor reset to resting position after being drawn. I've removed the note about re-evaluating it for security considerations and instead set it up as a module-local variable that we can set later depending on environment or something. It's set to false with no chance of changing at the moment. *As close as I can tell from reading check-password.4th, because I don't have an easy test (or deployed) setup for forth loader to check how close it is. Please do mention if it's not close enough. Notes: svn path=/head/; revision=330082
2018-02-24lualoader: Clean up naming conventions a little bitKyle Evans
We mostly use camel case for function names, but some local functions got mixed in using internal underscores. Doubles down on camel case. Notes: svn path=/head/; revision=329927
2018-02-23Add SPDX tags to lua filesKyle Evans
Notes: svn path=/head/; revision=329851
2018-02-22lualoader: Address some 'luacheck' concernsKyle Evans
luacheck pointed out an assortment of issues, ranging from non-standard globals being created as well as unused parameters, variables, and redundant assignments. Using '_' as a placeholder for values unused (whether it be parameters unused or return values unused, assuming multiple return values) feels clean and gets the point across, so I've adopted it. It also helps flag candidates for cleanup later in some of the lambdas I've created, giving me an easy way to re-evaluate later if we're still not using some of these features. Notes: svn path=/head/; revision=329809
2018-02-21lualoader: Drop password length restrictionsKyle Evans
This seems to have been arbitrary; bootlock_password and password don't seem to have any documented length restrictions, and loader(8) probably shouldn't care about whatever GELI passphrase length restrictions might exist. Reported by: Kalle Carlbark <kalle.carlbark+freebsd@kcbark.net> Notes: svn path=/head/; revision=329748
2018-02-21lualoader: Drop excessive parenthesizingKyle Evans
This was also a convenience convention (for me) that is not very lua-tic. Drop it. I've maintained some parentheses where I'd prefer them, for example, 'if x or y or (z and w) then', but these situations are far and few between. Notes: svn path=/head/; revision=329685
2018-02-21lualoader: Drop terminating semicolonsKyle Evans
This was previously chosen out of convenience, as we had a mixed style and needed to be consistent. I started learning Lua on Friday, so I switched everything over. It is not a very lua-nic convention, though, so drop it. Excessive parenthesizing around conditionals is next on the chopping block. Notes: svn path=/head/; revision=329684
2018-02-20stand/lua: Consistently organize modulesKyle Evans
We follow pretty closely the following structure of a module: 1. Copyright notice 2. Module requires 3. Module local declarations 4. Module local definitions 5. Module exports 6. return Re-organize the one-offs (config/drawer) and denote the start of module exports with a comment. Notes: svn path=/head/; revision=329641
2018-02-19stand/lua: Add copyright notice in placesKyle Evans
I've made some not-insignificant changes to config, menu, and password bits of our lua scripts. Add a copyright notice to them to reflect. Notes: svn path=/head/; revision=329596
2018-02-19stand/lua: Re-order locals after copyright notice; require comes firstKyle Evans
Notes: svn path=/head/; revision=329595
2018-02-19stand/lua: Clear the screen before prompting for passwordsKyle Evans
In the worst case scenario, we have no passwords to prompt for and we end up just clearing the screen twice before we draw the menu or proceed with boot. In the best case scenario, we don't try drawing password prompts amidst a bunch of kernel/module loading. Notes: svn path=/head/; revision=329549
2018-02-17stand/lua: Debugging string snuck in...Kyle Evans
Notes: svn path=/head/; revision=329436
2018-02-17stand/lua: Style passKyle Evans
These are the style points that I'd like to try and maintain in our lua scripts: - Parentheses around conditionals - Trailing semicolons, except on block terminators - s:method(...) instead of string.method(s, ...) where applicable There's likely more, but that'll get hammered out as we continue. Notes: svn path=/head/; revision=329435
2018-02-17stand/lua: Check for nil (GELI prompt)Kyle Evans
Notes: svn path=/head/; revision=329434
2018-02-17stand/lua: Add optional GELI passphrase promptKyle Evans
Prompt for GELI passphrase when geom_eli_passphrase_prompt has been set to "YES" in loader.conf(5). This entailed breaking out the password prompt into its own function that can be reused between the password compare bits and this prompt that simply takes the entered password and passes it along in the environment as kern.geom.eli.passphrase. I've also added a TODO to re-evaluate later if we want the "password masking" -- it is currently not functional, so one still can't observe the length of the password typed at the prompt. Notes: svn path=/head/; revision=329433
2018-02-16stand/lua: Correct usage and acceptance of BACKSPACE/DELETE keysKyle Evans
Notes: svn path=/head/; revision=329386
2018-02-16stand/lua: Reduce magic numbersKyle Evans
Enter/backspace values are hardcoded in both the menu and password scripts. Separate these out to core for reuse between the two. Notes: svn path=/head/; revision=329349
2018-02-12Add the lua scripts from the lua-bootloader SoCWarner Losh
These are the .lua files from from Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur and Wojciech A. Koszek also contributed. Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader Sponsored by: Google Summer of Code Improve the SoC lua menu code to bring it in line with forth menu functionality Submitted by: Zakary Nafziger Sponsored by: FreeBSD Foundation Use loader.setenv and loader.unsetenv instead of loader.perform Convert from include("/boot/foo.lua") to foo = require("foo"); to bring in line with latest lua module conventions. Enforce a uniform style for the new .lua files: o hard tab indenation for 8 spaces o don't have if foo then bar; else bas; end on one line MFC After: 1 month Relnotes: yes Differential Review: https://reviews.freebsd.org/D14295 Notes: svn path=/head/; revision=329167