22
33The README provided is an extensive guide on how to use the ` jit-customer-scripts ` project. \
44The Makefile described is composed of commands that ease the installation, configuration, and running of the scripts
5- within the project. \
6- Here's a breakdown of the provided README and Makefile:
5+ within the project.
6+
7+ ## Prerequisites
78
8- ## README Overview
9+ - Python 3.x
10+ - Git
11+ - make
912
10- - ** Introduction** : The README begins with a brief description of the project and its purpose, which is to aid customers
11- in creating teams and updating assets based on a given JSON file.
12- - ** Project Structure** : An organized visual representation of the project's file structure is provided.
13- - ** Prerequisites** : Lists necessary software that should be installed before starting, along with instructions for
14- CentOS and Ubuntu to prepare the environment.
15- - ** Generating API Keys** : Guidance on how to generate the necessary Github Personal Access Token and Jit API Key.
16- - ** Installation** : Steps on cloning the repository and setting up the project.
17- - ** Configuration** : Instructions on how to configure the necessary environment variables for the script.
18- - ** Usage** :
19- - ** Creating Teams from Github Topics** : Details on how to use the script to create teams and update assets from
20- GitHub topics.
21- - ** Using External JSON File** : Allows users to directly provide a JSON file containing team details.
22- - ** Excluding Topics** : Instructions on excluding specific topics when creating teams.
23- - ** Setting Up Self-Hosted Runners** : Guidance on setting up GitHub self-hosted runners on both CentOS and Ubuntu.
24- - ** Help** : Instruction on getting help with the Makefile commands.
25- - ** Development** : A small note about overriding the Jit API endpoint.
13+ To make sure you have all you can run this command:
2614
27- ## Makefile Overview
15+ ### Centos distro
2816
29- The Makefile consists of several targets to facilitate the installation, configuration, and running of scripts. Here's a
30- breakdown:
17+ ``` shell
18+ sudo yum install -y git make && git clone https://github.com/jitsecurity/jit-customer-scripts.git && cd jit-customer-scripts
19+ ```
3120
32- ### sync-teams
21+ ### Ubuntu distro
3322
34- This target has three sub-targets:
23+ ``` shell
24+ sudo apt install -y git make && git clone https://github.com/jitsecurity/jit-customer-scripts.git && cd jit-customer-scripts
25+ ```
3526
36- - ` install ` : Ensures Python 3 is installed, sets up a virtual environment, and installs the required dependencies.
37- - ` configure ` : Prompts the user to input configuration details like GitHub organization name, API client ID, client
38- secret, and GitHub token. The responses are written to a ` .env ` file.
39- - ` run ` : Activates the virtual environment and runs two Python scripts in succession to generate teams.
27+ ### Mac
4028
41- ### self-hosted-runner
29+ ``` shell
30+ brew install git make && git clone https://github.com/jitsecurity/jit-customer-scripts.git && cd jit-customer-scripts
31+ ```
4232
43- This target and its sub-targets facilitate setting up a GitHub self-hosted runner :
33+ Here's a breakdown of the provided README and Makefile :
4434
45- - ` check-root ` : Ensures the script isn't run as root.
46- - ` setup-runner ` : Checks the platform (CentOS or Ubuntu) and runs the appropriate setup script.
47- - ` install-agent ` : Installs the GitHub runner agent.
35+ ## Supported Scripts
4836
49- ### Help
37+ The Makefile consists of several commands to facilitate the installation, configuration, and running of scripts. Here's
38+ a link to the docs for each one:
5039
51- - ` help ` : Displays available targets and their brief descriptions.
40+ * [ syncing jit teams] ( src/scripts/sync_teams/sync-teams.md )
41+ * [ self-hosted-runners] ( src/scripts/self-hosted-runners/README.md )
5242
5343## Hierarchical Structure of the Commands:
5444
@@ -71,7 +61,8 @@ jit-customer-scripts/
7161│ └── scripts/
7262│ └── create_teams.py
7363| └── self-hosted-runners
74- │ └── setup-self-hosted-runner-centos.sh
64+ │ └── setup-rootless-docker-centos.sh
65+ │ └── setup-rootless-docker-ubuntu.sh
7566│ └── ...
7667├── src/
7768│ └── utils/
@@ -90,26 +81,6 @@ jit-customer-scripts/
9081- ` Makefile ` : Provides commands to help with project setup and execution.
9182- ` README.md ` : This file.
9283
93- ## Prerequisites
94-
95- - Python 3.x
96- - Git
97- - make
98-
99- To make sure you have all you can run this command:
100-
101- #### Centos
102-
103- ``` shell
104- sudo yum install -y git make && git clone https://github.com/jitsecurity/jit-customer-scripts.git && cd jit-customer-scripts
105- ```
106-
107- #### Ubuntu
108-
109- ``` shell
110- sudo apt install -y git make && git clone https://github.com/jitsecurity/jit-customer-scripts.git && cd jit-customer-scripts
111- ```
112-
11384## Generating API Keys
11485
11586* To generate Github Personal Access Token(PAT) refer to
@@ -119,142 +90,11 @@ sudo apt install -y git make && git clone https://github.com/jitsecurity/jit-cus
11990
12091> We recommend generating a fine-grained PAT with read-only access to the organization for the use of this script.
12192
122- ## Installation
123-
124- 1 . Clone the repository:
125-
126- ``` shell
127- git clone --branch 1.0.0 git@github.com:jitsecurity/jit-customer-scripts.git
128- ```
129-
130- 2 . Change into the project directory:
131-
132- ``` shell
133- cd jit-customer-scripts
134- ```
135-
136- ## Sync Teams
137-
138- ### Creating Teams from Github Topics
139-
140- To run the script and create teams and update assets, use the following command:
141-
142- ``` shell
143- make create-teams
144- ```
145-
146- This command is a convenience utility that extracts the teams to generate from Github topics. \
147- It runs these commands:
148-
149- ``` bash
150- python src/utils/github_topics_to_json_file.py
151- python src/scripts/create_teams.py teams.json
152- ```
153-
154- This command will fetch the repository names and topics from the GitHub API and generate the JSON file. And then it will
155- create the teams and update the assets.
156-
157- > We recommend using something like Github Actions and Github secrets to run this script on a schedule to make sure you
158- > are always synced.
159-
160- #### Using External JSON File
161-
162- You can also provide a JSON file containing team details using a command line argument directly. The JSON file should
163- have the following structure:
164-
165- ``` json
166- {
167- "teams" : [
168- {
169- "name" : " Team 1" ,
170- "members" : [
171- " user1" ,
172- " user2"
173- ],
174- "resources" : [
175- {
176- "type" : " {resource_type}" ,
177- "name" : " Resource 1"
178- },
179- {
180- "type" : " {resource_type}" ,
181- "name" : " Resource 2"
182- }
183- ]
184- },
185- {
186- "name" : " Team 2" ,
187- "members" : [
188- " user3" ,
189- " user4"
190- ],
191- "resources" : [
192- {
193- "type" : " {resource_type}" ,
194- "name" : " Resource 3"
195- }
196- ]
197- }
198- ]
199- }
200- ```
201-
202- You can run the command like this:
203-
204- ``` shell
205- python scripts/create_teams.py path/to/teams.json
206- ```
207-
208- Replace ` path/to/teams.json ` with the actual path to your JSON file.
209-
210- #### Excluding Topics
211-
212- You can exclude certain topics from being considered when creating teams. \
213- To exclude topics, you could add them in the ` make configure ` command or update this env var in
214- the ` .env ` file: ` TEAM_WILDCARD_TO_EXCLUDE ` .
215-
216- For example, to exclude topics that contain the word "test", you can set the variable as follows:
217-
218- TEAM_WILDCARD_TO_EXCLUDE=*test*
219-
220- This will exclude topics with names like "test", "test123", and "abc-testing".
221-
222- #### Development
93+ ## Development
22394
22495To override Jit's API endpoint, you can set the ` JIT_API_ENDPOINT ` environment variable. If the variable is not set, the
22596default value will be used.
22697
227- ## Settings Up Self-Hosted Runners
228-
229- To setup self-hosted runners, use the following command:
230-
231- You need to take the self hosted runners token from the Github Actions page of your repository.
232- ` https://github.com/<your-github-org-name>/jit/settings/actions/runners `
233-
234- ### Running on CentOS
235-
236- ``` shell
237- make self-hosted-runner centos runner_token=< runner-token> github_org=< github-organization> jit_repo=< jit-repo-name>
238- ```
239-
240- You will be prompted to answer some questions about your runner. \
241- When you complete this step, restart your EC2 machine. \
242- The runner will be automatically started on boot.
243-
244- Replace ` <runner-token> ` , ` <github-organization> ` , and ` <jit-repo-name> ` with the appropriate values.
245-
246- ### Running on Ubuntu
247-
248- ``` shell
249- make self-hosted-runner ubuntu runner_token=< runner-token> github_org=< github-organization>
250- ```
251-
252- You will be prompted to answer some questions about your runner. \
253- When you complete this step, restart your EC2 machine. \
254- The runner will be automatically started on boot.
255-
256- Replace ` <runner-token> ` and ` <github-organization> ` with the appropriate values.
257-
25898## Help
25999
260100To see the available commands and their descriptions, use the following command:
0 commit comments