A simple authorized_keys management system for Linux, written in Lapis!
-
Install OpenResty
- Follow the installation instructions on the OpenResty website.
-
Install Lapis
-
Use LuaRocks to install Lapis and bcrypt:
luarocks install lapis
luarocks install bcrypt
-
-
Install MySQL
- Follow your operating system's standard installation procedure to install MySQL.
-
Create Database
- Log into MySQL:
mysql -u root -p
- Create a new database for the application and make it active:
CREATE DATABASE locksmith; USE locksmith;
- Create table user_keys:
CREATE TABLE user_keys ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255), pubkey TEXT, INDEX(username) );
- Create table api_creds:
CREATE TABLE api_creds ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) UNIQUE NOT NULL, token TEXT, INDEX(username) );
- Create table auth_users:
CREATE TABLE auth_users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) UNIQUE NOT NULL, password_hash VARCHAR(255) NOT NULL, INDEX(username) );
- Log into MySQL:
- Edit
config.lua
for MySQL- Modify the
config.lua
file in your Lapis project to configure MySQL settings:local config = require("lapis.config") config("development", { mysql = { host = "127.0.0.1", user = "root", password = "yourpassword", database = "locksmith" } })
- Modify the