Loading...
Searching...
No Matches
Shell lock

Simple module to provide a password protection for the shell. More...

Detailed Description

Simple module to provide a password protection for the shell.

Warning
This feature is experimental!
This module is an experimental feature and only shows as a proof of concept how the shell could be protected with a password. Do not expect relevant security from it for production, since Man-in-the-Middle attacks are possible depending on the used connection method!

Files

file  shell_lock.h
 Shell interface definition.
 

Macros

#define CONFIG_SHELL_LOCK_ATTEMPTS_BEFORE_TIME_LOCK   3
 Lock the login process after given attempts of failed logins for a few seconds.
 
#define CONFIG_SHELL_LOCK_AUTO_LOCK_TIMEOUT_MS   (5 * 60 * 1000)
 Lock the shell after this time span without user input Defaults to 5 minutes but can be overwritten in the applications Makefile.
 

Functions

void shell_lock_checkpoint (char *line_buf, int buf_size)
 Entry point for the lock mechanism.
 
bool shell_lock_is_locked (void)
 Returns true, if the shell is in the locked state.
 
void shell_lock_do_lock (void)
 Lock the shell.
 

Macro Definition Documentation

◆ CONFIG_SHELL_LOCK_ATTEMPTS_BEFORE_TIME_LOCK

#define CONFIG_SHELL_LOCK_ATTEMPTS_BEFORE_TIME_LOCK   3

Lock the login process after given attempts of failed logins for a few seconds.

Definition at line 43 of file shell_lock.h.

◆ CONFIG_SHELL_LOCK_AUTO_LOCK_TIMEOUT_MS

#define CONFIG_SHELL_LOCK_AUTO_LOCK_TIMEOUT_MS   (5 * 60 * 1000)

Lock the shell after this time span without user input Defaults to 5 minutes but can be overwritten in the applications Makefile.

Definition at line 51 of file shell_lock.h.

Function Documentation

◆ shell_lock_checkpoint()

void shell_lock_checkpoint ( char *  line_buf,
int  buf_size 
)

Entry point for the lock mechanism.

If locked, the user will be asked for a password. This function won't return until the correct password has been entered.

Parameters
[in]line_bufBuffer for reading in the password from stdin
[in]buf_sizeBuffer size

◆ shell_lock_is_locked()

bool shell_lock_is_locked ( void  )

Returns true, if the shell is in the locked state.

Returns
Whether the shell is locked or not.