Creates a linux group of users synced to your Google Workspace users and automatically imports their public SSH keys.

IAM User Sync

Creates a linux group of users synced to your Google Workspace users and automatically imports their public SSH keys.

GSuite / Google Workspaces is the only provider currently available, but will soon work with AWS IAM as well.


Google Workspaces Setup

Log into your Google Workspaces admin account and navigate to your users: https://admin.google.com/ac/users

Click the More Options Dropdown and select Manage custom attributes

Alt Text

At the top right, click Add Custom Attribute

Take note of what you choose for the Category field as we will use it later. I use SSHKEY in this example. The type is set to Text and the visibility is up to your use case. # of values is set to Single Value.

Alt Text

For each user, navigate to their profile and click the User information / User Details dropdown.

Under the default Employee information section, there will now be a SSHKEY section. Paste the user's public ssh key in this field and save.


Google Cloud Platform Setup

In order to programatically access your domain users, you must set up a Google Cloud Platform project and then assign appropriate permissions.

To do this, navigate to: https://cloud.google.com and sign in. Click Console at the top right or go straight to: https://console.cloud.google.com where it will prompt you to create your first project. Name it appropriately or use the default values.

On the left hand side, drop down the list of services and select IAM & Admin. Then select Service Accounts on the left, then Create Service Account at the top.

Name it how you like, and the following 2 fields for granting access can be skipped. Click Create and Continue then click Done.

Alt Text

Select your new service account from the list and select the Keys tab at the top. Click Add Key with the key type set to JSON. Save the downloaded file as you'll need to upload this to each server along with the application.

Go back to the Details tab and select Show Advanced Settings. Note the Client-ID under the Domain-wide delegation section, as you'll use this in the next step.

Navigate back to https://admin.google.com and go to Security then dropdown Access and Data Control and select API Controls. Or navigate directly to https://admin.google.com/ac/owl

At the bottom, select Manage Domain Wide Delegation, then Add new at the top.

From the Google Cloud Platform service account, copy the Client-ID and paste it here. For the OAUTH scope, use https://www.googleapis.com/auth/admin.directory.user then click Authorize.

IMPORTANT! You must note the Google Workspace account you are currently signed into when Authorizing the Domain Wide Delegation as this user's email must be used in the config.


Ubuntu Setup (Config & Credentials)

From the previous steps, you'll need the custom attribute category you assigned earlier. In our example it was SSHKEY. You'll also need the credentials json file that you generated as well as the administrator's email address that was used to enable the Domain-wide delegation for OAuth scopes of access.

Configuration options include:

group The name of the linux user group to be maintained.
keephomedir The option to delete or keep a user's home folder when their SSH key or user is no longer detected.
logfile The path to the applicaton's output log.
credentials The path to the credentials json file.
customattributekey The custom attribute category name.
gsuiteadmin The email address of the admin that enabled domain-wide delegation for OAuth.
oauthdomain The Google Workspace domain to check for users. Can be commented out if the domain is the same as the gsuiteadmin.

Example config.yml:

# ========
# GENERAL CONFIG
# ========
# Linux Group name to be maintained
group: "iamusersync"

# If set to false, when a user is removed from the system, their home folder will also be deleted
keephomedir: false

# Full path to log file
logfile: "/var/log/iamusersync.log"


# ========
# GSUITE
# ========
provider: "GSUITE"

# Full path to credentials file
credentials: "./credentials.json"

# Custom attribute name to query per user
customattributekey: "SSHKEY"

# Admin email used to delegate domain wide OAuth scope auhtority
gsuiteadmin: "[email protected]"

# if domain to query differs from gsuite admin's domain
#oauthdomain: "tuso.tech"

Ubuntu Setup (Cron) & Example Usage

When running the application, you must use the --config argument to define the path to the config file, otherwise you must supply each of the config variables on the command line. If you define a config file and additional arguments, those supplied on the command line will overwrite what is set in the config.

 

I recommend using a cronjob to run the application at an interval appropriate to your needs.

*/15 * * * * /usr/local/bin/iamusersync --config /usr/local/etc/iamusersync/config.yml

Note: You can put the application, config, and log anywhere you like.

The default log file path is set to /var/log/iamusersync.log

 

Discord Screenshot Resizer.

Similar Resources

one simple git ssh server (just for learning git over ssh )

wriet one simple git ssh server use golang write one simple git ssh server how to running starting service docker-compose up -d add authorized_keys i

Mar 5, 2022

Data Connector is a Google Sheets Add-on that lets you import (and export) data to/from Google Sheets

Data Connector Data Connector is a Google Sheets Add-on that lets you import (and export) data to/from Google Sheets. Our roadmap: Connect to JSON/XML

Jul 30, 2022

Group peer to peer video calls for everyone written in Go and TypeScript

Peer Calls v4 WebRTC peer to peer calls for everyone. See it live in action at peercalls.com. The server has been completely rewriten in Go and all th

Dec 30, 2022

Go pkg for returning your public facing IP address.

#publicip This package returns the public facing IP address of the calling client (a la https://icanhazip.com, but from Go!) Author James Polera james

Nov 21, 2022

Automatic AWS Security Group ingress through DDNS

Auto DDNS Security Lambda Update AWS Security Group rules to an IP resolved from a DNS hostname. Useful to dynamically allow ingress from a DDNS hostn

Oct 19, 2021

Interface PancingIN v1.0 (group project DBMS)

PancingIN Prasyarat Telah memasang Go (direkomendasikan versi terbaru) Mengetahui cara menggunakan terminal / command line Telah melakukan clone/downl

Oct 30, 2021

A document scanner that creates a graph of the analogy between documents.

Social Analogizer The idea is that this program scans documents for keyword that correspond to other documents. Starting point is that a user has a pr

Dec 20, 2021

Chat app that allows you to group multiple channels into one view.

hashchat Backend service Getting Started Essential steps to get your backend service deployed A helloworld example has been shipped with the template

Dec 13, 2021

Fastest python library for making asynchronous group requests.

FGrequests: Fastest Asynchronous Group Requests Installation Install using pip: pip install fgrequests Documentation Pretty easy to use. import fgrequ

Nov 22, 2022
Comments
  • Fix Excess Complexities

    Fix Excess Complexities

    Breakdown ProcessInput into more functions for less complexity. Breakdown main into more functions: DeleteMissingLocalUsers and AddMissingIAMUsers for less complexity. Add missing Logger struct documentation. Converted tabs to spaces for all files. Fixed gsuite.go indentation issues. Converted all lines to fit within column width 80. Formatted using gofmt.

A simple robot to ban users who send as channel in group chats.

GoLang Telegram Bot GoLang Telegram Bot, written in GoLang via gotgbot library. You can even use this repository as a template to make your own GoLang

Dec 14, 2021
DORY is a tool who enables people to recover their access to an Active Directory service, by changing, resetting or unlocking their account.

DORY - Server Expose a simple API to manipulate AD. Password reinitialization Password changer Account Unlocking You must have LDAPS (port 636) active

Oct 3, 2022
🤘 The native golang ssh client to execute your commands over ssh connection. 🚀🚀
🤘 The native golang ssh client to execute your commands over ssh connection. 🚀🚀

Golang SSH Client. Fast and easy golang ssh client module. Goph is a lightweight Go SSH client focusing on simplicity! Installation ❘ Features ❘ Usage

Dec 24, 2022
Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes.

DNS-Updater Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes. Motivation Havin

Mar 10, 2022
Proxy your Go Module`s Import Path from your own domain to a public host (e.g. github.com).

Go Modules Remote Import Path Proxy Proxy your Go Module`s Import Path from your own domain to a public host (e.g. github.com). For example Uber (buil

Nov 2, 2021
Automatically spawn a reverse shell fully interactive for Linux or Windows victim
Automatically spawn a reverse shell fully interactive for Linux or Windows victim

Girsh (Golang Interactive Reverse SHell) Who didn't get bored of manually typing the few lines to upgrade a reverse shell to a full interactive revers

Dec 14, 2022
IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port
IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port

IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port

Nov 10, 2021
Extended ssh-agent which supports git commit signing over ssh

ssh-agentx ssh-agentx Rationale Requirements Configuration ssh-agentx Configuration ssh-gpg-signer Linux Windows Signing commits after configuration T

Jun 29, 2022
Golang `net/rpc` over SSH using installed SSH program

Golang net/rpc over SSH using installed SSH program This package implements a helper functions to launch an RPC client and server. It uses the install

Nov 16, 2022
Gsshrun - Running commands via ssh on the server/hosting (if ssh support) specified in the connection file

Gsshrun - Running commands via ssh on the server/hosting (if ssh support) specified in the connection file

Sep 8, 2022