Lightweight server access management system
Watchdog is a personalised server access management tool (and a slack bot) which keeps a track of all the administrative rights attempts (like sudo and su) on server (via SSH) and allows/disallows log-in attempts based on public key of user and logs all activity in form of slack message. It provides easy granting/revoking access to servers to team members through pull requests on a keyhouse repository.
Check out this blog post to know how watchdog works and design methodologies behind it: https://blog.sdslabs.co/2020/04/watchdog
- Request SSH access to a server just by creating a PR to the Keyhouse repository.
- Stateless and serverless. Watchdog runs on a single binary.
- Optional server activity logs to your favourite workspace like Slack or Discord.
- Easy Installation and Configuration
- Get notified when someone escalates privileges or performs administrative tasks using
sudo
orsu
The following softwares are required for running Watchdog:-
- PAM
- OpenSSH server
-
Create a Keyhouse Repository using the template repository here.
-
Clone the watchdog repository
git clone https://github.com/sdslabs/watchdog.git
-
Change into the repository directory and build the latest binaries using Cargo
cargo build --release
-
Copy
sample.config.toml
toconfig.toml
and make changes to the config this way:# Hostname of the machine running watchdog. Note that this should be # same as the file you create in the `hosts` directory in keyhouse. hostname = 'virtual-machine' # Keyhouse repository configuration [keyhouse] # URL of the Keyhouse repository, it should be of the format # `https://api.github.com/repos/<ORGANIZATION>/<KEYHOUSE-REPOSITORY>/contents` base_url = 'https://api.github.com/repos/sdslabs/keyhouse-template/contents' # This should be a personal access token made by a member of organization on his/her # behalf who can read the Keyhouse repository. Go to this # https://github.com/settings/tokens/new?description=Keyhouse%20Token&scopes=repo # to make a new token with correct scopes. token = 'secret_token' # Webhook APIs corresponding to various notifiers [notifiers] # Make an incoming hook to your Slack workspace from this # app(https://slack.com/apps/A0F7XDUAZ-incoming-webhooks) # and paste the hook URL here. You can customize the icon and name as you like. slack = 'https://hooks.slack.com/services/ABCDEFGHI/ABCDEFGHI/abcdefghijklmnopqrstuvwx'
-
Once you are done configuring, run this command with root(sudo) privileges
cd install && sudo ./install.sh
-
Add
/opt/watchdog/bin
to your PATH variable.
$ watchdog --help
Watchdog 0.1.0
SDSLabs <contact@sdslabs.co>
Simple server access management system on a binary
USAGE:
watchdog [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
auth Authorizes users based on from keyhouse repository. This command is passed through
`AuthorizedKeysCommand` in sshd_config.
config Get or set Watchdog configuration
help Prints this message or the help of the given subcommand(s)
logs Get the global watchdog logs
ssh Handles the PAM SSH calls by pam_exec for Watchdog
su Handles the PAM su calls by pam_exec for Watchdog
sudo Handles the PAM sudo calls by pam_exec for Watchdog
Though most of the commands are for internal use of PAM, you can edit configuration of Watchdog any time
$ watchdog config --help
NOTE: config can be fetched/edited only with root
(sudo
) access.
To view logs
$ watchdog logs --help
You need to have Rust installed along with the mentioned dependencies
Open your favourite terminal and perform the following tasks:-
- Clone this repository.
$ git clone https://github.com/sdslabs/watchdog
-
Make the required changes inside the source code directory (src/)
-
Run
cargo test
to test your changes. -
Rebuild the binary using
cargo build
command.
If you have a query regarding the product or just want to say hello then feel free to visit chat.sdslabs.co or drop a mail at contact@sdslabs.co.in