aboutsummaryrefslogtreecommitdiff
path: root/stand/lua/password.lua
Commit message (Collapse)AuthorAgeFilesLines
* Remove $FreeBSD$: two-line lua tagWarner Losh2023-08-161-2/+0
| | | | Remove /^--\n--\s*\$FreeBSD\$.*$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | 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
* loader: lua: disable autoboot timer after password entryCyrus Rahman2023-04-161-0/+1
| | | | | | | | | | | | | | | | 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
* Further normalize copyright noticesKyle Evans2019-09-261-1/+1
| | | | | | | | | | | - 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
* lualoader: Clear the screen before prompting for passwordKyle Evans2019-03-261-3/+12
| | | | | | | | | | | | 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
* lualoader: only clear the screen before first password promptKyle Evans2019-02-181-2/+7
| | | | | | | | | | | | | | | | | 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
* Improve loader passwords:Edward Tomasz Napierala2018-09-221-10/+9
| | | | | | | | | | | | | | | | | 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
* lualoader: Use global printc instead of loader.printcKyle Evans2018-03-021-9/+9
| | | | | | | | | | | | | | | | | 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
* lualoader: Use #str instead of tracking length with 'n'Kyle Evans2018-03-021-5/+2
| | | | | | | | 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
* lualoader: Further screen cleanupKyle Evans2018-02-281-1/+2
| | | | | | | | | | | | | - 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
* lualoader: Re-do twiddleKyle Evans2018-02-281-6/+20
| | | | | | | | | | | | 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
* lualoader: Remove remnants of testing...Kyle Evans2018-02-271-3/+2
| | | | | | | | | | | | 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
* lualoader: Add a twiddle at password promptKyle Evans2018-02-271-4/+23
| | | | | | | | | | | | | | | | | | | 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
* lualoader: Clean up naming conventions a little bitKyle Evans2018-02-241-3/+3
| | | | | | | | 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
* Add SPDX tags to lua filesKyle Evans2018-02-231-0/+2
| | | | Notes: svn path=/head/; revision=329851
* lualoader: Address some 'luacheck' concernsKyle Evans2018-02-221-1/+1
| | | | | | | | | | | | | | | 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
* lualoader: Drop password length restrictionsKyle Evans2018-02-211-2/+2
| | | | | | | | | | | 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
* lualoader: Drop excessive parenthesizingKyle Evans2018-02-211-9/+9
| | | | | | | | | | | 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
* lualoader: Drop terminating semicolonsKyle Evans2018-02-211-34/+34
| | | | | | | | | | | 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
* stand/lua: Consistently organize modulesKyle Evans2018-02-201-0/+1
| | | | | | | | | | | | | | | | | 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
* stand/lua: Add copyright notice in placesKyle Evans2018-02-191-0/+1
| | | | | | | | 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
* stand/lua: Re-order locals after copyright notice; require comes firstKyle Evans2018-02-191-2/+2
| | | | Notes: svn path=/head/; revision=329595
* stand/lua: Clear the screen before prompting for passwordsKyle Evans2018-02-191-0/+1
| | | | | | | | | | | 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
* stand/lua: Debugging string snuck in...Kyle Evans2018-02-171-1/+1
| | | | Notes: svn path=/head/; revision=329436
* stand/lua: Style passKyle Evans2018-02-171-11/+11
| | | | | | | | | | | | | 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
* stand/lua: Check for nil (GELI prompt)Kyle Evans2018-02-171-2/+2
| | | | Notes: svn path=/head/; revision=329434
* stand/lua: Add optional GELI passphrase promptKyle Evans2018-02-171-7/+21
| | | | | | | | | | | | | | | | | 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
* stand/lua: Correct usage and acceptance of BACKSPACE/DELETE keysKyle Evans2018-02-161-1/+1
| | | | Notes: svn path=/head/; revision=329386
* stand/lua: Reduce magic numbersKyle Evans2018-02-161-2/+2
| | | | | | | | 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
* Add the lua scripts from the lua-bootloader SoCWarner Losh2018-02-121-0/+85
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