During development, i revised Keyvan's architecture and changed my approach. This readme explains the current implementation. To see the planned Keyvan, please read this file
Keyvan (aka k1) is a kernel level access control mechanism implemented using eBPF.
It provides silent authentication checks and access control verdicts for resources
(files, execs, and later network actions). The goal is to allow a machine to appear
unlocked to an unauthorized user while restricting their access in order to confuse them.
- Quick demo
- Quick start
- Notes
- Features (current)
- Development roadmap
- Adding an authentication mechanism
Example: root is restricted until the secret is executed:
ThisHost# ls
zsh: operation not permitted: ls
ThisHost# ./some_secret_password
zsh: no such file or directory: ./some_secret_password
ThisHost# ls
Clones Desktop Documents Downloads Templates Tools Videos# build from source
cmake -S . -B build
cd build
make
# run Keyvan
sudo ./output/k1cli -u 1000 -a K1_AUTH_TYPE_EXECVE -p some_secret_password
The main purpose of k1cli is to communicate with a deamon that is responsible for managing the bpf programs. Until that deamon is implemented, k1cli will serve as a utility to enable using Keyvan.
- Authentication checkers: eBPF programs that implement authentication logic.
K1_AUTH_TYPE_EXECVE: authenticates a user when the secret (password) is executed (e.g../my_secret).K1_AUTH_TYPE_USB: authenticates a user when a usb device is connected that has the same serial number as the one registered as credential.
- Verdicts: eBPF(currently LSM based) checks that check the
is_authenticatedflag and deny access if the flag is not set.K1_VERDICT_HOOK_LSM_BPRM_CREDS_FOR_EXEC: LSM hook that is triggered when executing a file.
- Execve authentication checker
- File execution verdict
- File write checker
- IOCTL-based checkers
- Network access verdict (rule based)
- Persist authentication data across reboots
- Proper naming convention in the source code
- Consider requiring re-authentication for each sesssion (like sudo)?
- More flexible approach to store authentication information in maps
- Implement a userspace daemon to load/write maps so Keyvan can persist across reboots
- Determine white list programs to prevent locking the user out
- Implement logging
- Implement SHA512 or port from OpenSSL(bpf and userspace side)
- Hash the credentials before writing maps on the disc
- Web hosted documentation
- Unit testing
- Add the authentication checker bpf program under
bpf/auth_check - Add the authentication type in
include/auth_cred.hinK1_AUTH_TYPEenum - Add the credential struct in
include/auth_cred.h - Add the credential struct in
k1_auth_credunion ininclude/auth_cred.h - Add
init_auth_cred_<auth_mechanism_name>()to parse the credentials and populate the appropriate map - Add
init_auth_cred_<auth_mechanism_name>()toinit_maps_based_on_args() - Update
enum_to_string_k1_auth_typeinsidecommon/common.c - Add
<authentication_mechanism_name>_helpon top ofk1cli/opt.c
- authentication checker program
must call
k1_change_user_auth_state()when intending to change a record's authentication status