Skip to content

Commit 742944c

Browse files
Skarlsomichelvocks
authored andcommitted
A secret vault storage with AES encryption using a certificate (#56)
* Hammering out the api. * Changing the api. * More work on the api. * Steps * Created the vault back-end. * Fixed the logger nil pointer. * Removed un-needed open. * Started chunking on the web interface. * Some linting. * Fixed some values and names. * Making the end-point work. * Working on the display. * Added missing open. * Done with managing secret view. Added secret field masking. * Not returning the values at all so they aren't even getting to the end user. Also fixed the possibility to have an empty vault. * Front-end done and vault now is using the certificate for encryption. * Defaulting vault path to the data folder. * addressed comments. * Some small adjustments and creating the SetSecret endpoint. * Added readme, added tests, and fixed up some more comments. * Readme style fixes. * Battle tested the front-end. * Added the VaultStorer interface to be able to extract the storage medium. * Added test testing default storer initialization.
1 parent 3d8da40 commit 742944c

File tree

12 files changed

+1329
-18
lines changed

12 files changed

+1329
-18
lines changed

README.rst

+21-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.. raw:: html
2-
2+
33
<img src="https://cdn.rawgit.com/michelvocks/ef3894f63c3bb004bca1a2fd5f7eb644/raw/c36d614db8afe229b466b38de1636a82ad809f64/gaia-logo-text.png" width="650px">
44

55
|build-status| |go-report| |go-doc| |apache2| |chat| |codecov|
@@ -13,8 +13,8 @@ Motivation
1313

1414
.. begin-motivation
1515
16-
*Automation Engineer*, *DevOps*, *SRE*, *Cloud Engineer*,
17-
*Platform Engineer* - they all have one in common:
16+
*Automation Engineer*, *DevOps*, *SRE*, *Cloud Engineer*,
17+
*Platform Engineer* - they all have one in common:
1818
The majority of tech people are not motivated to take up this work and they are hard to recruit.
1919

2020
One of the main reasons for this is the abstraction and poor execution of many automation tools. They come with their own configuration (`YAML`_ syntax) specification or limit the user to one specific programming language. Testing is nearly impossible because most automation tools lack the ability to mock services and subsystems. Even tiny things, for example parsing a JSON file, are sometimes really painful because external, outdated libraries were used and not included in the standard framework.
@@ -26,11 +26,11 @@ How does it work?
2626

2727
.. begin-architecture
2828
29-
Gaia is based on `HashiCorp's go-plugin`_. It's a plugin system that uses `gRPC`_ to communicate over `HTTP/2`_. HashiCorp developed this tool initially for `Packer`_ but it's now heavily used by `Terraform`_, `Nomad`_, and `Vault`_ too.
29+
Gaia is based on `HashiCorp's go-plugin`_. It's a plugin system that uses `gRPC`_ to communicate over `HTTP/2`_. HashiCorp developed this tool initially for `Packer`_ but it's now heavily used by `Terraform`_, `Nomad`_, and `Vault`_ too.
3030

3131
Plugins, which we named pipelines, are applications which can be written in any programming language as long as `gRPC`_ is supported. All functions, which we call Jobs, are exposed to Gaia and can form up a dependency graph which describes the order of execution.
3232

33-
Pipelines can be compiled locally or simply over the build system. Gaia clones the git repository and automatically builds the included pipeline. If a change (`git push`_) happened, Gaia will automatically rebuild the pipeline for you.
33+
Pipelines can be compiled locally or simply over the build system. Gaia clones the git repository and automatically builds the included pipeline. If a change (`git push`_) happened, Gaia will automatically rebuild the pipeline for you.
3434

3535
After a pipeline has been started, all log output are returned back to Gaia and displayed in a detailed overview with their final result status.
3636

@@ -107,7 +107,7 @@ Here is an example:
107107
jobs := sdk.Jobs{
108108
sdk.Job{
109109
Handler: DoSomethingAwesome,
110-
Title: "DoSomethingAwesome",
110+
Title: "DoSomethingAwesome",
111111
Description: "This job does something awesome.",
112112
113113
// Increase the priority if this job should be executed later than other jobs.
@@ -123,7 +123,7 @@ Here is an example:
123123
124124
Like you can see, pipelines are defined by jobs. Usually, a function represents a job. You can define as many jobs in your pipeline as you want.
125125

126-
At the end, we define a jobs array that populates all jobs to gaia. We also add some information like a title, a description and the priority.
126+
At the end, we define a jobs array that populates all jobs to gaia. We also add some information like a title, a description and the priority.
127127

128128
The priority is really important and should always be used. If, for example, job A has a higher priority (decimal number) as job B, job A will be executed **after** job B. Priority defines therefore the order of execution. If two or more jobs have the same priority, those will be executed simultanously. You can compare it with the `Unix nice level`_.
129129

@@ -132,6 +132,11 @@ Gaia will compile it and add it to it's store for later execution.
132132

133133
Please find a bit more sophisticated example in our `go-example repo`_.
134134

135+
Security
136+
========
137+
138+
See the Documentation located here: `security-docs`_.
139+
135140
Documentation and more
136141
======================
137142

@@ -144,11 +149,11 @@ What problem solves **Gaia**?
144149
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145150
Literally every tool which were designed for automation, continuous integration (CI), and continuous deployment (CD) like Spinnaker, Jenkins, Gitlab CI/CD, TravisCI, CircleCI, Codeship, Bamboo and many more, introduced their own configuration format. Some of them don't even support *configuration/automation as code*. This works well for simple tasks like running a ``go install`` or ``mvn clean install`` but in the real world there is more to do.
146151

147-
Gaia is the first platform which does not limit the user and provides full support for almost all common programming languages without losing the features offered by todays CI/CD tools.
152+
Gaia is the first platform which does not limit the user and provides full support for almost all common programming languages without losing the features offered by todays CI/CD tools.
148153

149154
What is a **pipeline**?
150155
~~~~~~~~~~~~~~~~~~~~~~~
151-
A pipeline is a real application with at least one function (we call it Job). Every programming language can be used as long as gRPC is supported. We offer SDKs (currently only Go but others are already in development) to support the development.
156+
A pipeline is a real application with at least one function (we call it Job). Every programming language can be used as long as gRPC is supported. We offer SDKs (currently only Go but others are already in development) to support the development.
152157

153158
What is a **job**?
154159
~~~~~~~~~~~~~~~~~~
@@ -169,12 +174,12 @@ Gaia is currently in alpha version available. We extremely recommend to not use
169174

170175
One of the main issues currently is the lack of unit- and integration tests. This is on our to-do list and we are working on this topic with high priority.
171176

172-
It is planned that other programming languages should be supported in the next few month. It is up to the community which languages will be supported next.
177+
It is planned that other programming languages should be supported in the next few month. It is up to the community which languages will be supported next.
173178

174179
Contributing
175180
============
176181

177-
Gaia can only evolve and become a great product with the help of contributors. If you like to contribute, please have a look at our `issues section`_. We do our best to mark issues for new contributors with the label *good first issue*.
182+
Gaia can only evolve and become a great product with the help of contributors. If you like to contribute, please have a look at our `issues section`_. We do our best to mark issues for new contributors with the label *good first issue*.
178183

179184
If you think you found a good first issue, please consider this list as a short guide:
180185

@@ -207,6 +212,7 @@ If you have any questions feel free to contact us on `gitter`_.
207212
.. _`Kubernetes deployment with vault integration`: https://docs.gaia-pipeline.io/tutorials/kube-vault-deploy/
208213
.. _`git push`: https://git-scm.com/docs/git-push
209214
.. _`HTTP/2`: https://http2.github.io/
215+
.. _`security-docs`: https://github.com/gaia-pipeline/gaia/blob/master/security/README.md
210216

211217
.. |build-status| image:: https://circleci.com/gh/gaia-pipeline/gaia/tree/master.svg?style=shield&circle-token=c0e15edfb08f8076076cbbb55558af6cfecb89b8
212218
:alt: Build Status
@@ -225,7 +231,7 @@ If you have any questions feel free to contact us on `gitter`_.
225231
:alt: Apache licensed
226232
:target: https://github.com/gaia-pipeline/gaia/blob/master/LICENSE
227233

228-
.. |chat| image:: https://badges.gitter.im/Join%20Chat.svg
234+
.. |chat| image:: https://badges.gitter.im/Join%20Chat.svg
229235
:alt: Gitter
230236
:target: https://gitter.im/gaia-pipeline
231237

@@ -247,15 +253,16 @@ If you have any questions feel free to contact us on `gitter`_.
247253
.. |sh-create-pipeline-history| image:: https://cdn.rawgit.com/michelvocks/6868118d0da06a422e69e453497eb30d/raw/142a2969c4d27d4135ef8f96213bb166009fda1e/create_pipeline_history.png
248254
:alt: gaia create pipeline history screenshot
249255
:width: 650px
250-
256+
251257
.. |sh-pipeline-detailed| image:: https://cdn.rawgit.com/michelvocks/6868118d0da06a422e69e453497eb30d/raw/51b4d6cbc3d86b1fe9531250db5456595423d9ec/pipeline_detailed.png
252258
:alt: gaia pipeline detailed screenshot
253259
:width: 650px
254-
260+
255261
.. |sh-pipeline-logs| image:: https://cdn.rawgit.com/michelvocks/6868118d0da06a422e69e453497eb30d/raw/51b4d6cbc3d86b1fe9531250db5456595423d9ec/pipeline_logs.png
256262
:alt: gaia pipeline logs screenshot
257263
:width: 650px
258264

259265
.. |sh-settings| image:: https://cdn.rawgit.com/michelvocks/6868118d0da06a422e69e453497eb30d/raw/142a2969c4d27d4135ef8f96213bb166009fda1e/settings.png
260266
:alt: gaia settings screenshot
261267
:width: 650px
268+

cmd/gaia/main.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func init() {
4040
// command line arguments
4141
flag.StringVar(&gaia.Cfg.ListenPort, "port", "8080", "Listen port for gaia")
4242
flag.StringVar(&gaia.Cfg.HomePath, "homepath", "", "Path to the gaia home folder")
43+
flag.StringVar(&gaia.Cfg.VaultPath, "vaultpath", "", "Path to the gaia vault folder")
4344
flag.StringVar(&gaia.Cfg.Worker, "worker", "2", "Number of worker gaia will use to execute pipelines in parallel")
4445
flag.StringVar(&gaia.Cfg.JwtPrivateKeyPath, "jwtPrivateKeyPath", "", "A RSA private key used to sign JWT tokens")
4546
flag.StringVar(&gaia.Cfg.CAPath, "capath", "", "Folder path where the generated CA certificate files will be saved")
@@ -133,7 +134,7 @@ func main() {
133134
}
134135

135136
// Setup CA for cerificate signing
136-
_, err = security.InitCA()
137+
cert, err := security.InitCA()
137138
if err != nil {
138139
gaia.Cfg.Logger.Error("cannot create CA", "error", err.Error())
139140
os.Exit(1)
@@ -168,6 +169,18 @@ func main() {
168169
os.Exit(1)
169170
}
170171

172+
// Initiating Vault
173+
// Check Vault path
174+
if gaia.Cfg.VaultPath == "" {
175+
// Set default to data folder
176+
gaia.Cfg.VaultPath = gaia.Cfg.DataPath
177+
}
178+
_, err = security.NewVault(cert, nil)
179+
if err != nil {
180+
gaia.Cfg.Logger.Error("error initiating vault")
181+
os.Exit(1)
182+
}
183+
171184
// Start ticker. Periodic job to check for new plugins.
172185
pipeline.InitTicker(store, scheduler)
173186

frontend/client/store/modules/menu/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ const state = {
2222
},
2323
component: lazyLoading('pipeline/create')
2424
},
25+
{
26+
name: 'Vault',
27+
path: '/vault',
28+
meta: {
29+
icon: 'fa-lock'
30+
},
31+
component: lazyLoading('vault', true)
32+
},
2533
{
2634
name: 'Settings',
2735
path: '/settings',

frontend/client/views/settings/index.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,9 @@ export default {
365365
.get('/api/v1/pipeline', { showProgressBar: false })
366366
.then(response => {
367367
if (response.data) {
368-
this.pipelineRows = response.data;
368+
this.pipelineRows = response.data
369369
} else {
370-
this.pipelineRows = [];
370+
this.pipelineRows = []
371371
}
372372
}).catch((error) => {
373373
this.$onError(error)
@@ -560,7 +560,7 @@ export default {
560560
561561
.tabs {
562562
margin: 10px;
563-
563+
564564
.tab-content {
565565
min-height: 50px;
566566
}

0 commit comments

Comments
 (0)