Skip to content

zjuxlab/gitakc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitAKC(Git AuthorizedKeysCommand)

This is a small program to use user's GitHub keys for ssh authorization. Note that you need to create a corresponding linux account for each key in userMap. gitakc is just an AuthorizedKeysCommand tool, and is not responsible for registering new accounts.

Installation

  1. Install Scala and make sure the correct PATH env variable is set:
$ scala -version
Scala code runner version 2.12.17 -- Copyright 2002-2022, LAMP/EPFL and Lightbend, Inc.
  1. Install dependencies:
$ sudo apt update
$ sudo apt install libidn11
$ sudo sh -c "curl -L https://github.com/com-lihaoyi/mill/releases/download/0.10.8/0.10.8 > /usr/local/bin/mill && chmod +x /usr/local/bin/mill"
$ mill -v

Mill installation command is grabbed from its official docs.

  1. Clone this repo & build
$ git clone
$ cd gitakc
$ mill -i "gitakc.native[2.13.8].nativeLink"
$ cp out/gitakc/native/2.13.8/nativeLink.dest/out /usr/local/bin/gitakc

Configuration

  1. Modify your /etc/ssh/sshd_config like this:
AuthorizedKeysCommand /usr/local/bin/gitakc
  1. Create /etc/gitakc.json:
{
  "ttl": "600",
  "userMap": {
    "ralph": ["RalXYZ"]
  },
  "cacheFolder": "/tmp/gitakc"
}

ttl refers to the cache time of downloaded ssh keys, and userMap is a map from GitLab username to linux system username. cacheFolder is the folder to store cached files.

  1. Restart sshd:
$ systemctl restart sshd

Usage

This shall be invoked by sshd automatically.

$ sudo /usr/local/bin/gitakc gitlab_username

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 100.0%