Skip to content

Commit 070d71a

Browse files
Md. Emruz Hossaintamalsaha
authored andcommitted
Add SSL support for S3 compatible Minio storage server (#27)
1 parent 2a2ce2b commit 070d71a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+801
-4819
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Twitter](https://img.shields.io/twitter/follow/appscodehq.svg?style=social&logo=twitter&label=Follow)](https://twitter.com/intent/follow?screen_name=AppsCodeHQ)
77

88
# osm
9-
Object Store Manipulator (osm: pronounced like `awesome`) - `curl` for cloud storage services. 🙌 `osm` can create & delete buckets and upload, download & delete files from buckets for AWS S3, DigitalOcean Spaces, Google Cloud Storage, Microsoft Azure storage and OpenStack Swift. Its single binary can be easily packaged instead of official python based clis inside Docker images.
9+
Object Store Manipulator (osm: pronounced like `awesome`) - `curl` for cloud storage services. 🙌 `osm` can create & delete buckets and upload, download & delete files from buckets for AWS S3, AWS S3 compatible other storage services(i.e. Minio), DigitalOcean Spaces, Google Cloud Storage, Microsoft Azure storage and OpenStack Swift. Its single binary can be easily packaged instead of official python based clis inside Docker images.
1010

1111
## Install OSM
1212
You can download and install a pre-built binary:
@@ -43,10 +43,10 @@ Available Commands:
4343
config OSM configuration
4444
help Help about any command
4545
lc List containers
46-
ls List container
46+
ls List items in a container
4747
mc Make container
4848
pull Pull item from container
49-
push Push item from container
49+
push Push item to container
5050
rc Remove container
5151
rm Remove item from container
5252
stat Stat item from container
@@ -59,10 +59,13 @@ Flags:
5959
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
6060
--log_dir string If non-empty, write log files in this directory
6161
--logtostderr log to standard error instead of files
62-
--osmconfig string Path to osm config (default "/home/tamal/.osm/config")
62+
--osmconfig string Path to osm config (default "$HOME/.osm/config")
6363
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
6464
-v, --v Level log level for V logs
6565
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
66+
67+
Use "osm [command] --help" for more information about a command.
68+
6669
```
6770

6871
### OSM Configuration
@@ -72,6 +75,9 @@ This allows providing commands one time for multiple subsequent operations with
7275
# AWS S3:
7376
osm config set-context osm-s3 --provider=s3 --s3.access_key_id=<key_id> --s3.secret_key=<secret_key> --s3.region=us-east-1
7477

78+
# TLS secure Minio server
79+
osm config set-context osm-minio --provider=s3 --s3.access_key_id=<minio_access_key> --s3.secret_key=<minio_secret_key> --s3.endpoint=<minio_server_address> --s3.cacert_file=<root_ca_file_path>
80+
7581
# DigitalOcean Spaces:
7682
osm config set-context osm-do --provider=s3 --s3.access_key_id=<key_id> --s3.secret_key=<secret_key> --s3.endpoint=nyc3.digitaloceanspaces.com
7783

cmds/config/set.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type setContextRequest struct {
2525
s3ConfigRegion string
2626
s3ConfigSecretKey string
2727
s3ConfigDisableSSL bool
28+
s3CACertFile string
2829
gcsConfigJSONKeyPath string
2930
gcsConfigProjectId string
3031
gcsConfigScopes string
@@ -73,6 +74,7 @@ func newCmdSet() *cobra.Command {
7374
setCmd.Flags().StringVar(&req.s3ConfigSecretKey, s3.Kind+"."+s3.ConfigSecretKey, "", "S3 config secret key")
7475
setCmd.Flags().StringVar(&req.s3ConfigAuthType, s3.Kind+"."+s3.ConfigAuthType, "accesskey", "S3 config auth type (accesskey, iam)")
7576
setCmd.Flags().BoolVar(&req.s3ConfigDisableSSL, s3.Kind+"."+s3.ConfigDisableSSL, false, "S3 config disable SSL")
77+
setCmd.Flags().StringVar(&req.s3CACertFile, s3.Kind+"."+s3.ConfigCACertFile, "", "S3 config cacert_file for custom endpoint(i.e minio)")
7678

7779
setCmd.Flags().StringVar(&req.gcsConfigJSONKeyPath, gcs.Kind+".json_key_path", "", "GCS config json key path")
7880
setCmd.Flags().StringVar(&req.gcsConfigProjectId, gcs.Kind+"."+gcs.ConfigProjectId, "", "GCS config project id")
@@ -122,6 +124,9 @@ func setContext(req *setContextRequest, configPath string) {
122124
if req.s3ConfigAuthType != "" {
123125
nc.Config[s3.ConfigAuthType] = req.s3ConfigAuthType
124126
}
127+
if req.s3CACertFile != "" {
128+
nc.Config[s3.ConfigCACertFile] = req.s3CACertFile
129+
}
125130
nc.Config[s3.ConfigDisableSSL] = strconv.FormatBool(req.s3ConfigDisableSSL)
126131
case gcs.Kind:
127132
nc.Provider = gcs.Kind

cmds/ls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func NewCmdListIetms() *cobra.Command {
2121
req := &itemListRequest{}
2222
cmd := &cobra.Command{
2323
Use: "ls <name>",
24-
Short: "List container",
24+
Short: "List items in a container",
2525
Example: "osm ls mybucket",
2626
DisableAutoGenTag: true,
2727
Run: func(cmd *cobra.Command, args []string) {

cmds/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func NewCmdPush() *cobra.Command {
2121
req := &itemPushRequest{}
2222
cmd := &cobra.Command{
2323
Use: "push <src> <dest>",
24-
Short: "Push item from container",
24+
Short: "Push item to container",
2525
Example: "osm push -c mybucket f1.txt /tmp/f1.txt",
2626
DisableAutoGenTag: true,
2727
Run: func(cmd *cobra.Command, args []string) {

docs/README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
[![Go Report Card](https://goreportcard.com/badge/github.com/appscode/osm)](https://goreportcard.com/report/github.com/appscode/osm)
22

33
# osm
4-
Object Store Manipulator (osm: pronounced like `awesome`) - `curl` for cloud storage services. 🙌 `osm` can create & delete buckets and upload, download & delete files from buckets for AWS S3, Google Cloud Storage, Microsoft Azure storage and OpenStack Swift. Its single binary can be easily packaged instead of official python based clis inside Docker images.
4+
Object Store Manipulator (osm: pronounced like `awesome`) - `curl` for cloud storage services. 🙌 `osm` can create & delete buckets and upload, download & delete files from buckets for AWS S3, AWS S3 compatible other storage services(i.e. Minio), DigitalOcean Spaces, Google Cloud Storage, Microsoft Azure storage and OpenStack Swift. Its single binary can be easily packaged instead of official python based clis inside Docker images.
55

66
## Install OSM
77
You can download and install a pre-built binary:
88
```console
99
# Linux amd 64-bit:
10-
wget -O osm https://cdn.appscode.com/binaries/osm/0.6.1/osm-linux-amd64 \
10+
wget -O osm https://cdn.appscode.com/binaries/osm/0.6.3/osm-linux-amd64 \
1111
&& chmod +x osm \
1212
&& sudo mv osm /usr/local/bin/
1313

1414
# Linux 386 32-bit:
15-
wget -O osm https://cdn.appscode.com/binaries/osm/0.6.1/osm-linux-386 \
15+
wget -O osm https://cdn.appscode.com/binaries/osm/0.6.3/osm-linux-386 \
1616
&& chmod +x osm \
1717
&& sudo mv osm /usr/local/bin/
1818

1919
# Mac 64-bit
20-
wget -O osm https://cdn.appscode.com/binaries/osm/0.6.1/osm-darwin-amd64 \
20+
wget -O osm https://cdn.appscode.com/binaries/osm/0.6.3/osm-darwin-amd64 \
2121
&& chmod +x osm \
2222
&& sudo mv osm /usr/local/bin/
2323

2424
# Mac 32-bit
25-
wget -O osm https://cdn.appscode.com/binaries/osm/0.6.1/osm-darwin-386 \
25+
wget -O osm https://cdn.appscode.com/binaries/osm/0.6.3/osm-darwin-386 \
2626
&& chmod +x osm \
2727
&& sudo mv osm /usr/local/bin/
2828
```
@@ -37,20 +37,24 @@ osm [command]
3737
Available Commands:
3838
config OSM configuration
3939
help Help about any command
40-
ls List container
40+
lc List containers
41+
ls List items in a container
4142
mc Make container
4243
pull Pull item from container
43-
push Push item from container
44+
push Push item to container
4445
rc Remove container
4546
rm Remove item from container
4647
stat Stat item from container
4748
version Prints binary version number.
4849

4950
Flags:
5051
--alsologtostderr log to standard error as well as files
52+
--enable-analytics Send usage events to Google Analytics (default true)
53+
-h, --help help for osm
5154
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
5255
--log_dir string If non-empty, write log files in this directory
5356
--logtostderr log to standard error instead of files
57+
--osmconfig string Path to osm config (default "$HOME/.osm/config")
5458
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
5559
-v, --v Level log level for V logs
5660
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
@@ -66,6 +70,12 @@ This allows providing commands one time for multiple subsequent operations with
6670
# AWS S3:
6771
osm config set-context osm-s3 --provider=s3 --s3.access_key_id=<key_id> --s3.secret_key=<secret_key> --s3.region=us-east-1
6872

73+
# TLS secure Minio server
74+
osm config set-context osm-minio --provider=s3 --s3.access_key_id=<minio_access_key> --s3.secret_key=<minio_secret_key> --s3.endpoint=<minio_server_address> --s3.cacert_file=<root_ca_file_path>
75+
76+
# DigitalOcean Spaces:
77+
osm config set-context osm-do --provider=s3 --s3.access_key_id=<key_id> --s3.secret_key=<secret_key> --s3.endpoint=nyc3.digitaloceanspaces.com
78+
6979
# Google Cloud Storage:
7080
osm config set-context osm-gs --provider=google --google.json_key_path=<path_sa_file> --google.project_id=<my_project>
7181

docs/reference/osm.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ osm [command] [flags]
3535
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
3636
--log_dir string If non-empty, write log files in this directory
3737
--logtostderr log to standard error instead of files
38-
--osmconfig string Path to osm config (default "/home/tamal/.osm/config")
38+
--osmconfig string Path to osm config (default "$HOME/.osm/config")
3939
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
4040
-v, --v Level log level for V logs
4141
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
@@ -45,10 +45,10 @@ osm [command] [flags]
4545

4646
* [osm config](/docs/reference/osm_config.md) - OSM configuration
4747
* [osm lc](/docs/reference/osm_lc.md) - List containers
48-
* [osm ls](/docs/reference/osm_ls.md) - List container
48+
* [osm ls](/docs/reference/osm_ls.md) - List items in a container
4949
* [osm mc](/docs/reference/osm_mc.md) - Make container
5050
* [osm pull](/docs/reference/osm_pull.md) - Pull item from container
51-
* [osm push](/docs/reference/osm_push.md) - Push item from container
51+
* [osm push](/docs/reference/osm_push.md) - Push item to container
5252
* [osm rc](/docs/reference/osm_rc.md) - Remove container
5353
* [osm rm](/docs/reference/osm_rm.md) - Remove item from container
5454
* [osm stat](/docs/reference/osm_stat.md) - Stat item from container

docs/reference/osm_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ osm config view
4141
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
4242
--log_dir string If non-empty, write log files in this directory
4343
--logtostderr log to standard error instead of files
44-
--osmconfig string Path to osm config (default "/home/tamal/.osm/config")
44+
--osmconfig string Path to osm config (default "$HOME/.osm/config")
4545
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
4646
-v, --v Level log level for V logs
4747
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

docs/reference/osm_config_current-context.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ osm config current-context
4141
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
4242
--log_dir string If non-empty, write log files in this directory
4343
--logtostderr log to standard error instead of files
44-
--osmconfig string Path to osm config (default "/home/tamal/.osm/config")
44+
--osmconfig string Path to osm config (default "$HOME/.osm/config")
4545
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
4646
-v, --v Level log level for V logs
4747
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

docs/reference/osm_config_get-contexts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ osm config get-contexts
4141
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
4242
--log_dir string If non-empty, write log files in this directory
4343
--logtostderr log to standard error instead of files
44-
--osmconfig string Path to osm config (default "/home/tamal/.osm/config")
44+
--osmconfig string Path to osm config (default "$HOME/.osm/config")
4545
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
4646
-v, --v Level log level for V logs
4747
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

docs/reference/osm_config_set-context.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ osm config set-context <name>
4040
--provider string Cloud storage provider
4141
--s3.access_key_id string S3 config access key id
4242
--s3.auth_type string S3 config auth type (accesskey, iam) (default "accesskey")
43+
--s3.cacert_file string S3 config cacert_file for custom endpoint(i.e minio)
4344
--s3.disable_ssl S3 config disable SSL
4445
--s3.endpoint string S3 config endpoint
4546
--s3.region string S3 config region
@@ -65,7 +66,7 @@ osm config set-context <name>
6566
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
6667
--log_dir string If non-empty, write log files in this directory
6768
--logtostderr log to standard error instead of files
68-
--osmconfig string Path to osm config (default "/home/tamal/.osm/config")
69+
--osmconfig string Path to osm config (default "$HOME/.osm/config")
6970
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
7071
-v, --v Level log level for V logs
7172
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

0 commit comments

Comments
 (0)