Skip to content

Commit 40e3a70

Browse files
committed
added encryption methods
1 parent e0d5014 commit 40e3a70

File tree

9 files changed

+285
-50
lines changed

9 files changed

+285
-50
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Adminio-API expose metrics for [Prometheus](https://prometheus.io/) at `/metrics
5353
| `MINIO_REGION` | set minio region | us-east-1 |
5454
| `MINIO_ACCESS` | set minio Access Key | test |
5555
| `MINIO_SECRET` | set minio Secret Key | testtest123 |
56+
| `MINIO_DEFAULT_LOCK_OBLECT_ENABLE` | set minio default make bucket behaviour with locking object | false |
5657
| `ADMINIO_CORS_DOMAIN` | set adminio-api CORS policy domain | * |
5758
| `ADMINIO_OAUTH_ENABLE` | enable oauth over supported providers | false |
5859
| `ADMINIO_OAUTH_PROVIDER` | oauth provider, for more information see the full list of supported providers | github |

openAPI/openapi_v3.yaml

Lines changed: 114 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: "3.0.0"
22
info:
33
description: "Adminio API"
4-
version: "2.3.0"
4+
version: "2.4.0"
55
title: "Adminio API"
66
contact:
77
name: "rzrbld at github.com"
@@ -66,6 +66,11 @@ paths:
6666
type: string
6767
format: string
6868
newBucketRegion:
69+
description: Optional parameter. if value is null value will be retrieved from ENV variable
70+
type: string
71+
format: string
72+
newBucketObjectLocking:
73+
description: Optional parameter. if value is null value will be retrieved from ENV variable
6974
type: string
7075
format: string
7176
responses:
@@ -473,6 +478,98 @@ paths:
473478
application/json:
474479
schema:
475480
$ref: "#/components/schemas/Error"
481+
/bucket/set-encryption:
482+
post:
483+
summary: Set bucket encryption
484+
operationId: setBucketEncryption
485+
tags:
486+
- bucket
487+
requestBody:
488+
content:
489+
multipart/form-data:
490+
schema:
491+
type: object
492+
properties:
493+
bucketName:
494+
type: string
495+
format: string
496+
bucketEncryptionType:
497+
description: available options is sse-kms ans sse-s3
498+
type: string
499+
format: string
500+
kmsMasterKey:
501+
description: master key ID if use sse-kms
502+
type: string
503+
format: string
504+
responses:
505+
'200':
506+
description: Success
507+
content:
508+
application/json:
509+
schema:
510+
$ref: "#/components/schemas/Success"
511+
default:
512+
description: unexpected error
513+
content:
514+
application/json:
515+
schema:
516+
$ref: "#/components/schemas/Error"
517+
/bucket/get-encryption:
518+
post:
519+
summary: Get bucket encryption
520+
operationId: getBucketEncryption
521+
tags:
522+
- bucket
523+
requestBody:
524+
content:
525+
multipart/form-data:
526+
schema:
527+
type: object
528+
properties:
529+
bucketName:
530+
type: string
531+
format: string
532+
responses:
533+
'200':
534+
description: bucket encryption
535+
content:
536+
application/json:
537+
schema:
538+
$ref: "#/components/schemas/BucketEncryption"
539+
default:
540+
description: unexpected error
541+
content:
542+
application/json:
543+
schema:
544+
$ref: "#/components/schemas/Error"
545+
/bucket/remove-encryption:
546+
post:
547+
summary: Remove bucket encryption
548+
operationId: removeBucketEncryption
549+
tags:
550+
- bucket
551+
requestBody:
552+
content:
553+
multipart/form-data:
554+
schema:
555+
type: object
556+
properties:
557+
bucketName:
558+
type: string
559+
format: string
560+
responses:
561+
'200':
562+
description: bucket encryption removed
563+
content:
564+
application/json:
565+
schema:
566+
$ref: "#/components/schemas/Success"
567+
default:
568+
description: unexpected error
569+
content:
570+
application/json:
571+
schema:
572+
$ref: "#/components/schemas/Error"
476573
/users/list:
477574
get:
478575
summary: List all users
@@ -1125,7 +1222,20 @@ components:
11251222
type: array
11261223
items:
11271224
type: string
1128-
1225+
BucketEncryption:
1226+
type: object
1227+
properties:
1228+
XMLname:
1229+
type: object
1230+
properties:
1231+
Space:
1232+
type: string
1233+
Local:
1234+
type: string
1235+
Rules:
1236+
type: array
1237+
items:
1238+
type: object
11291239
BucketEvent:
11301240
type: object
11311241
properties:
@@ -1184,6 +1294,8 @@ components:
11841294
$ref: "#/components/schemas/BucketTags"
11851295
policy:
11861296
type: string
1297+
encryption:
1298+
$ref: "#/components/schemas/BucketEncryption"
11871299
BucketLifecycle:
11881300
type: string
11891301
Error:
@@ -1201,4 +1313,3 @@ components:
12011313
properties:
12021314
Success:
12031315
type: string
1204-

src/clients/clients.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
package clients
22

33
import (
4-
minio "github.com/minio/minio-go/v6"
4+
minio "github.com/minio/minio-go/v7"
5+
"github.com/minio/minio-go/v7/pkg/credentials"
56
madmin "github.com/minio/minio/pkg/madmin"
67
cnf "github.com/rzrbld/adminio-api/config"
78
"log"
89
)
910

1011
var MadmClnt, MadmErr = madmin.New(cnf.Server, cnf.Maccess, cnf.Msecret, cnf.Ssl)
11-
var MinioClnt, MinioErr = minio.New(cnf.Server, cnf.Maccess, cnf.Msecret, cnf.Ssl)
12+
13+
// var MinioClnt, MinioErr = minio.New(cnf.Server, cnf.Maccess, cnf.Msecret, cnf.Ssl)
14+
15+
var MinioClnt, MinioErr = minio.New(cnf.Server, &minio.Options{
16+
Creds: credentials.NewStaticV4(cnf.Maccess, cnf.Msecret, ""),
17+
Secure: cnf.Ssl,
18+
})
1219

1320
func main() {
1421
if MadmErr != nil {

src/config/config.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import (
66
)
77

88
var (
9-
Server = getEnv("MINIO_HOST_PORT", "localhost:9000")
10-
Maccess = getEnv("MINIO_ACCESS", "test")
11-
Msecret = getEnv("MINIO_SECRET", "testtest123")
12-
Region = getEnv("MINIO_REGION", "us-east-1")
13-
Ssl, _ = strconv.ParseBool(getEnv("MINIO_SSL", "false"))
14-
ServerHostPort = getEnv("ADMINIO_HOST_PORT", "localhost:8080")
15-
AdminioCORS = getEnv("ADMINIO_CORS_DOMAIN", "*")
9+
Server = getEnv("MINIO_HOST_PORT", "localhost:9000")
10+
Maccess = getEnv("MINIO_ACCESS", "test")
11+
Msecret = getEnv("MINIO_SECRET", "testtest123")
12+
Region = getEnv("MINIO_REGION", "us-east-1")
13+
// Enable object locking by default
14+
DefaultObjectLocking, _ = strconv.ParseBool(getEnv("MINIO_DEFAULT_LOCK_OBLECT_ENABLE", "false"))
15+
Ssl, _ = strconv.ParseBool(getEnv("MINIO_SSL", "false"))
16+
ServerHostPort = getEnv("ADMINIO_HOST_PORT", "localhost:8080")
17+
AdminioCORS = getEnv("ADMINIO_CORS_DOMAIN", "*")
1618
// AES only supports key sizes of 16, 24 or 32 bytes.
1719
// You either need to provide exactly that amount or you derive the key from what you type in.
1820
ScHashKey = getEnv("ADMINIO_COOKIE_HASH_KEY", "NRUeuq6AdskNPa7ewZuxG9TrDZC4xFat")

src/go.mod

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ require (
1717
github.com/eapache/go-resiliency v1.2.0 // indirect
1818
github.com/etcd-io/bbolt v1.3.3 // indirect
1919
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
20+
github.com/flosch/pongo2/v4 v4.0.1 // indirect
2021
github.com/fsnotify/fsnotify v1.4.9 // indirect
2122
github.com/gavv/httpexpect v2.0.0+incompatible // indirect
2223
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 // indirect
2324
github.com/go-check/check v0.0.0-20200902074654-038fdea0a05b // indirect
24-
github.com/google/go-cmp v0.5.3 // indirect
25+
github.com/google/go-cmp v0.5.4 // indirect
2526
github.com/google/go-querystring v1.0.0 // indirect
2627
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
2728
github.com/gorilla/securecookie v1.1.1
@@ -51,9 +52,9 @@ require (
5152
github.com/minio/hdfs/v3 v3.0.1 // indirect
5253
github.com/minio/lsync v1.0.1 // indirect
5354
github.com/minio/md5-simd v1.1.1 // indirect
54-
github.com/minio/minio v0.0.0-20201117171328-7ff8128f15ce
55+
github.com/minio/minio v0.0.0-20201129051545-bdd094bc3927
5556
github.com/minio/minio-go/v6 v6.0.58-0.20200612001654-a57fec8037ec
56-
github.com/minio/minio-go/v7 v7.0.6-0.20200929220449-755b5633803a
57+
github.com/minio/minio-go/v7 v7.0.6
5758
github.com/minio/parquet-go v0.0.0-20200414234858-838cfa8aae61 // indirect
5859
github.com/montanaflynn/stats v0.6.3 // indirect
5960
github.com/moul/http2curl v1.0.0 // indirect
@@ -80,11 +81,12 @@ require (
8081
github.com/smartystreets/goconvey v1.6.4 // indirect
8182
github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 // indirect
8283
github.com/stretchr/testify v1.6.1 // indirect
84+
github.com/tdewolff/parse/v2 v2.5.6 // indirect
8385
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
8486
github.com/ugorji/go v1.1.5-pre // indirect
8587
github.com/valyala/fasthttp v1.16.0 // indirect
8688
github.com/vmihailenco/msgpack/v4 v4.3.11 // indirect
87-
github.com/vmihailenco/msgpack/v5 v5.0.0-rc.5 // indirect
89+
github.com/vmihailenco/msgpack/v5 v5.0.0 // indirect
8890
github.com/vmihailenco/tagparser v0.1.2 // indirect
8991
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
9092
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
@@ -93,15 +95,16 @@ require (
9395
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
9496
github.com/yudai/pp v2.0.1+incompatible // indirect
9597
go.uber.org/zap v1.15.0 // indirect
96-
golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 // indirect
98+
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 // indirect
9799
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
98100
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 // indirect
99-
golang.org/x/sys v0.0.0-20201117222635-ba5294a509c7 // indirect
101+
golang.org/x/sys v0.0.0-20201126233918-771906719818 // indirect
100102
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
101103
google.golang.org/appengine v1.6.7 // indirect
102104
google.golang.org/protobuf v1.25.0 // indirect
105+
gopkg.in/check.v1 v1.0.0-20201128035030-22ab2dfb190c // indirect
103106
gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect
104107
gopkg.in/ini.v1 v1.62.0 // indirect
105-
gopkg.in/yaml.v2 v2.3.0 // indirect
108+
gopkg.in/yaml.v2 v2.4.0 // indirect
106109
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
107110
)

0 commit comments

Comments
 (0)