Coder Social home page Coder Social logo

scaleway / c14-cli Goto Github PK

View Code? Open in Web Editor NEW
89.0 14.0 21.0 17.99 MB

[EOL] πŸ’» Manage your C14 Online Cold Storage from Command Line

License: MIT License

Makefile 4.39% Go 94.36% Dockerfile 0.19% Shell 1.06%
scaleway coldstorage glacier glacier-cli

c14-cli's Introduction

C14 CLI

Interact with Online C14 API from the command line.


⚠️ C14 Classic has been discontinued

Discover our new C14 Cold Storage service on Scaleway Elements, compatible with S3 Glacier!


Online C14 logo

Table of Contents

Overview

A command-line tool to manage your C14 storage easily

Install

Grab your binary on the releases page.

Usage

$ c14
Usage: c14 [OPTIONS] COMMAND [arg...]

Interact with C14 from the command line.

Options:
  -D, --debug        Enable debug mode
  -V, --verbose      Enable verbose mode

Commands:
    create    Create a new archive
    files     List the files of an archive
    freeze    Lock an archive
    help      Help of the c14 command line
    login     Log in to Online API
    ls        List the archives
    rename    Rename an archive
    remove    Remove an archive
    unfreeze  Unlock an archive
    upload    Upload your file or directory into an archive
    bucket    Displays all information of bucket
    version   Show the version information
    download  Download your file or directory from an archive
    migrate   Migration helper to S3 Cold Storage

Run 'c14 COMMAND --help' for more information on a command.

Login

$ c14 login
Please opens this link with your browser: https://console.online.net/oauth/v2/device/usercode
Then copy paste the code XXXXXX
$

Commands

c14 create

Usage: c14 create [OPTIONS]

Create a new archive, by default with a random name, standard storage (0.0002€/GB/month), automatic locked in 7 days and your datas will be stored in the choosen platform (by default at DC4).

Options:
  -c, --crypto=true     Enable aes-256-bc cryptography, enabled by default.
  -d, --description=""  Assigns a description
  -h, --help=false      Print usage
  -k, --sshkey=""       A list of UUIDs corresponding to the SSH keys (separated by a comma) that will be used for the connection.
  -l, --large=false     Ask for a large bucket
  -n, --name=""         Assigns a name
  -P, --platform=2      Select the platform (by default at DC4)
  -p, --parity=standard Specify a parity to use
  -q, --quiet=false     Don't display the waiting loop
  -s, --safe=""         Name of the safe to use. If it doesn't exists it will be created.

Examples:
        $ c14 create
        $ c14 create --name "MyBooks" --description "hardware books" -P 1
        $ c14 create --name "MyBooks" --description "hardware books" --safe "Bookshelf" --platform 2
        $ c14 create --sshkey "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

c14 freeze

Usage: c14 freeze [OPTIONS] [ARCHIVE]+

Lock an archive, your archive will be stored in highly secure Online data centers and will stay available On Demand (0.01€/GB).

Options:
  -h, --help=false      Print usage
  --nowait=false
  -q, --quiet=false

Examples:
        $ c14 freeze 83b93179-32e0-11e6-be10-10604b9b0ad9

c14 ls

Usage: c14 ls [OPTIONS] [ARCHIVE]*

Displays the archives, by default only the NAME, STATUS, UUID.

Options:
  -a, --all=false       Show all information on archives (size,parity,creationDate,description)
  -h, --help=false      Print usage
  -p, --platform=false  Show the platforms
  -q, --quiet=false     Only display UUIDs
  -t, --ts=false        Show unix timestamp of archives (to script deletion for instance)

Examples:
        $ c14 ls
        $ c14 ls -a
        $ c14 ls -t

        archives older than one week
        $ c14 ls -t | awk '$NF < '$(date -d '1 week ago' +%s)' { print }'

c14 help

Usage: c14 help [COMMAND]

Help prints help information about c14 and its commands.
By default, help lists available commands.
When invoked with a command name, it prints the usage and the help of
the command.

Options:
  -h, --help=false      Print usage

Examples:
        $ c14 help
        $ c14 help create

c14 login

Usage: c14 login

Generates a credentials file in $CONFIG/c14-cli/c14rc.json
containing informations to generate a token.

Options:
  -h, --help=false      Print usage

Examples:
    $ c14 login

c14 files

Usage: c14 files ARCHIVE

List the files of an archive, displays the name and size of files

Options:
  -h, --help=false      Print usage

Examples:
        $ c14 files 83b93179-32e0-11e6-be10-10604b9b0ad9

c14 rename

Usage: c14 rename ARCHIVE new_name

Rename an archive.

Options:
  -h, --help=false      Print usage

Examples:
        $ c14 rename 83b93179-32e0-11e6-be10-10604b9b0ad9 new_name
        $ c14 rename old_name new_name

c14 remove

Usage: c14 remove [ARCHIVE]+

Remove an archive

Options:
  -h, --help=false      Print usage

Examples:
        $ c14 remove 83b93179-32e0-11e6-be10-10604b9b0ad9 2d752399-429f-447f-85cd-c6104dfed5db

c14 unfreeze

Usage: c14 unfreeze [OPTIONS] [ARCHIVE]+

Unlock an archive, extraction of the archive's data (0.01€/GB).

Options:
  -h, --help=false      Print usage
  --nowait=false
  -q, --quiet=false

Examples:
        $ c14 unfreeze 83b93179-32e0-11e6-be10-10604b9b0ad9

c14 upload

Usage: c14 upload [DIR|FILE]* ARCHIVE

Upload your file or directory into an archive, use SFTP protocol.

Options:
  -h, --help=false      Print usage
  -n, --name=""         Assigns a name (only with tar method)

Examples:
        $ c14 upload
        $ c14 upload test.go 83b93179-32e0-11e6-be10-10604b9b0ad9
        $ c14 upload /upload 83b93179-32e0-11e6-be10-10604b9b0ad9
        $ tar cvf - /upload 2> /dev/null | ./c14 upload --name "file.tar.gz" fervent_austin

c14 download

Usage: c14 download [DIR|FILE]* ARCHIVE

Download your file or directory into an archive, use SFTP protocol.

Options:
  -h, --help=false      Print usage

Examples:
        $ c14 download
        $ c14 download file 83b93179-32e0-11e6-be10-10604b9b0ad9

c14 bucket

Usage: c14 bucket [OPTIONS] [ARCHIVE]*

Displays (JSON or tab output) all information of bucket.

Options:
  -h, --help=false      Print usage
  -p, --pretty=""       Show all information in tab (default json output)

Examples:
        $ c14 bucket
        $ c14 bucket 83b93179-32e0-11e6-be10-10604b9b0ad9
        $ c14 bucket -p 83b93179-32e0-11e6-be10-10604b9b0ad9

c14 version

Usage: c14 version

Show the version information.

Options:
  -h, --help=false      Print usage

Examples:
        $ c14 version

c14 migrate

Usage: c14 migrate [OPTIONS] [ACTION] [ARCHIVE]

Migrate an archive to Cold Storage

[ACTION] is one of [precheck, generate-rclone-config, rclone-sync]

Options:
  -h, --help=false      Print usage
  --s3-access-key=""    aws_access_key_id
  --s3-bucket=""        Destination bucket name
  --s3-create-bucket=false Prefix in destination bucket
  --s3-prefix=""        Prefix in destination bucket
  --s3-profile=""       aws_profile
  --s3-secret-key=""    aws_secret_access_key

Examples:
        $ c14 migrate --s3-access-key xxx --s3-secret-key yyy precheck d28d0f7b-4524-4f7c-a7a3-7341503e9110
        $ c14 migrate --s3-profile scw-par generate-rclone-config d28d0f7b-4524-4f7c-a7a3-7341503e9110

Development

Feel free to contribute! πŸ˜ƒπŸ»

Hack

  1. Install Go
  2. Ensure you have $GOPATH and $PATH well configured, something like:
    • export GOPATH=$HOME/go
    • export PATH=$PATH:$GOPATH/bin
  3. Fetch the project: git clone https://github.com/scaleway/c14-cli.git
  4. Go to c14-cli directory: cd c14-cli
  5. Hack: vim
  6. Build: make
  7. Run: ./c14

License

MIT

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

c14-cli's People

Contributors

agirot avatar alpagap avatar angristan avatar coolya avatar edouardb avatar moul avatar quentinperez avatar quentinselle avatar remyleone avatar reversteam avatar segfault42 avatar solvik avatar sophieqc avatar thibault-ketterer avatar wowi42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

c14-cli's Issues

Add command to return safe deposit box connection details

Hey, would it be possible to add a command that would return username, password, host and port for a safe deposit box with given UUID? Optionally, a flag could be used to also set ENV variables with returned values. Also, this could be an option for "create" command, returning everything you need to connected to a newly created safe deposit box.

This would greatly simplify using c14 with rsync, sshfs, davfs, etc.

Docker documentation

Hello,

the documentation in regards to docker should be extended with the following information:

  1. official image on docker hub - i worked around it by creating a fork and publishing it on titpetric/c14-cli,
  2. Dockerfile including the VOLUME command, to declare a location needed for data, so it may be used with -v for persistence.

I currently have no idea about the second task and I'm going to have to read some code to find out where c14-cli stores it's data. Edit: the path is /root/.config/c14-cli. Code/help references some $CONFIG which is not an environment variable from what I can tell.

On windows, folder structure is not respected.

I installed the C14 CLI on windows 10pro x64.

I logged in successfully then tried to upload a folder containing lots of subfolders.

It seems that the " \ " char is not considered as a directory separator on windows. So instead of creating subfolders, the tool creates a new folder with name 'Folder\Subfolder" on the same level.

1 picture is better than 1000 words of my poor english, see screenshot attached.

c14

my go version : go version go1.7.1 windows/amd64

c14 create picks wrong ssh key

I have multiple SSH keys added so I can use different key for different servers.

When I create new bucket using "c14 create", it just picks wrong key. I would like to specify which key to use for ssh connections or even better use current ~/.ssh/id_rsa.pub

Rate limiting?

Starting last weekend I was getting 503 responses from the online.net api when I used c14. Especially when creating new safes. I created a ticket at online.net because I thought I was a problem with api backend. I was then told that this was causes because of rate limiting and that I was polling the api to often. Since I haven't changed anything in c14 with regard to that I'm not sure what caused this.

Is there something we can do in the client to prevent this?

The internal ticket id is #510273 if that helps.

Traces essentially looked like this:

./c14 --debug create --name=test6
 DEBUG[0000] [GET]: https://api.online.net/api/v1/user/key/ssh
 DEBUG[0000] [Response]: [200] [{"uuid_ref":"226e8a7f-b267-421c-9b96-d71bcb595135","description":"gitlab","fingerprint":"11:93:ff:c6:6c:aa:ad:f7:50:eb:89:90:d0:22:95:b3"}]
 DEBUG[0000] [POST]: https://api.online.net/api/v1/storage/c14/safe
 DEBUG[0000] [Response]: [201] {"uuid_ref":"bec8e55b-cd5f-46b4-a512-dfa51c1a3b3a"}
 DEBUG[0000] [GET]: https://api.online.net/api/v1/storage/c14/safe/bec8e55b-cd5f-46b4-a512-dfa51c1a3b3a
 DEBUG[0001] [Response]: [200] {"$ref":"\/api\/v1\/storage\/c14\/safe\/bec8e55b-cd5f-46b4-a512-dfa51c1a3b3a","uuid_ref":"bec8e55b-cd5f-46b4-a512-dfa51c1a3b3a","name":"test6_safe","status":"active","description":""}
 DEBUG[0001] [POST]: https://api.online.net/api/v1/storage/c14/safe/bec8e55b-cd5f-46b4-a512-dfa51c1a3b3a/archive
 DEBUG[0001] [Response]: [503] <html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body bgcolor="white">
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>

 FATAL[0001] /Users/kdummann/go/src/github.com/online-net/c14-cli/pkg/api/api.go:179: [503] <html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body bgcolor="white">
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>nginx</center>
</body>
</html>

/Users/kdummann/go/src/github.com/online-net/c14-cli/pkg/api/methods.go:186: CreateArchive
/Users/kdummann/go/src/github.com/online-net/c14-cli/pkg/api/helpers.go:56: CreateSSHBucketFromScratch:CreateArchive
/Users/kdummann/go/src/github.com/online-net/c14-cli/pkg/commands/create.go:97: Run:CreateSSHBucketFromScratch

Add the scrub feature

The API exposes a feature to verify (scrub) an archive
We should implement it

/storage/c14/safe/{safe_id}/archive/{archive_id}/location/{location_id}/verify

mflag

cannot find package "github.com/docker/docker/pkg/mflag"

Usage/Architecture

Usage

$ c14 vault create                                           # Creates new vault
375BE0D8-D294-4B25-9BE5-E08224151A62
$ c14 vault remove 375BE0D8-D294-4B25-9BE5-E08224151A62      # Removes vault
$ c14 vault download  375BE0D8-D294-4B25-9BE5-E08224151A62   # Download files from vault
$ c14 vault upload dir/ 375BE0D8-D294-4B25-9BE5-E08224151A62 # Upload files from dir to c14
$ c14 vault info 375BE0D8-D294-4B25-9BE5-E08224151A62        # Displays info/metadata about vault
$ c14 vault lock 375BE0D8-D294-4B25-9BE5-E08224151A62        # Lock vault to upload it to c14
$ c14 vault list                                             # Displays the list of vault
73B3514A-63EC-40BC-A7EB-A233AAEC97B9
$ c14 worker show                                            # Displays workers which upload the datas
82AFF89D-5B3C-430F-AA1F-164A9772FC54 total_size total_time
|--7DDFA7F4-F21B-4D2A-A7C2-25EE0C390640  file size time
\--3C5FF29D-B57C-4857-8DB4-83F436C6231E   file size time

$ c14 worker abort 82AFF89D-5B3C-430F-AA1F-164A9772FC54     # Abort a woker

$ c14 freeze dir/                                           # Creates a vault/ uploads dir/ and locks it
$ c14 watch dir/ 375BE0D8-D294-4B25-9BE5-E08224151A62       # Download the archive and syncs the data when they are modified
$ c14 wait 73B3514A-63EC-40BC-A7EB-A233AAEC97B9             # Waits until the data are transferred
$ c14 verify 73B3514A-63EC-40BC-A7EB-A233AAEC97B9           # Checks data checksum
$ c14 logs                                                  # Displays the history/errors
$ c14 stats                                                 # Stats about your account


/// BONUS
$ c14 cron every-week dir                                   # Makes an archive every-week

Architecture

// RPC Architecture:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                        
β”‚                                                            β”‚                        
β”‚                                                            β”‚                        
β”‚                                                            β”‚                        
β”‚              LOCAL                                         β”‚                        
β”‚                                                            β”‚                        
β”‚                                                            β”‚                        
β”‚                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚                        
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚      SERVER (RPC)      β”‚    β”‚                        
β”‚  β”‚                  β”‚        β”‚                        β”‚    β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  β”‚                  β”‚        β”‚    β”Œβ”¬β”€β”¬β”€β”¬β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚    β”‚         β”‚             β”‚
β”‚  β”‚                  β”‚  API   β”‚    β”‚β”‚ β”‚ β”‚  β”‚        β”‚  β”‚    β”‚         β”‚             β”‚
β”‚  β”‚ CLI (client RPC) β”‚        β”‚    β”‚β”‚ β”‚ β”‚  β”‚ WORKERSβ”‚  β”‚    β”‚         β”‚             β”‚
β”‚  β”‚                  │───────▢│    β”‚β”‚ β”‚ β”‚  β”‚        │──┼────┼────────▢│     C14     β”‚
β”‚  β”‚                  β”‚        β”‚    β”‚β”‚ β”‚ β”‚  β”‚        β”‚  β”‚    β”‚         β”‚             β”‚
β”‚  β”‚                  β”‚        β”‚    β””β”΄β”€β”΄β”€β”΄β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚    β”‚         β”‚             β”‚
β”‚  β”‚                  β”‚        β”‚             β–²          β”‚    β”‚         β”‚             β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚             β”‚          β”‚    β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚                        
β”‚                                           β”‚β”‚               β”‚                        
β”‚                                           β”‚β”‚               β”‚                        
β”‚                                           β””β”˜               β”‚                        
β”‚                                                            β”‚                        
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                        

Create intensive archive?

I'd love to be able to use this to create intensive type archives, instead of having to use the ui!

Equivalent of the 4 operations in CLI

There is 4 operations: Archiving, Unarchiving, Destruction and Verification.
What is the equivalent of these CLI operations?
I guess, Archiving is "c14 freeze".
I guess, Unarchiving is "c14 unfreeze".
I guess, Destruction is "c14 remove".
But, which one is for Verification?

ssh: must specify HostKeyCallback

Hi
When trying to upload via C14 CLI I get this error ..
root@vrayo:~# c14 upload /etc/ 6cd0ab4e-xxxx-4fe8-8207-0614fc5f494b
FATAL[0000] ssh: must specify HostKeyCallback
Host runs Ubuntu 16.04.2 LTS
Go version : go version go1.6.2 linux/amd64

Any idea on how to fix this ? :)

thanks

Gonzague

c14-cli doesn't install

Hello,

I'm new to go, and unless I'm mistaken, my version is above 1.6 :

go version go1.11.5 linux/amd64

when I run the go get as displayed in the README.md:

# go get -v -u github.com/scaleway/c14-cli/cmd/c14
github.com/scaleway/c14-cli (download)

No output is given, and then :

bash: c14: command not found

Is there a way to tshoot this ?

CentOS Linux release 7.6.1810 (Core)
golang.x86_64                         1.11.5-1.el7                   @epel
golang-bin.x86_64                     1.11.5-1.el7                   @epel
golang-src.noarch                     1.11.5-1.el7                   @ErwanPaillard 
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
Linux nas-centos 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Thanks,

Errors installing

root@debian:~# go get -u github.com/online-net/c14-cli/cmd/c14
# github.com/docker/docker/pkg/term
go/src/github.com/docker/docker/pkg/term/term.go:114: syntax error: unexpected range, expecting {
go/src/github.com/docker/docker/pkg/term/term.go:121: syntax error: argument to go/defer must be function call
# github.com/go-yaml/yaml
go/src/github.com/go-yaml/yaml/error.go:4: "ERROR: the correct import path is gopkg.in/yaml.v2 ... " evaluated but not used
# golang.org/x/crypto/ed25519
go/src/golang.org/x/crypto/ed25519/ed25519.go:54: undefined: crypto.SignerOpts

c14 with cron ?

I have some problem with a really simple script, executed by cron.

Here is it, for testing :

#! /bin/bash c14 upload /tmp/2017-01-17-backup.tar.gz xxxx-xxxxx-xxxxx

I was logged as root and I setup this script using crontab -e.

On executing this script manually, everything is working fine, but when cron did it, i have this error on my mail :

FATAL[0000] You need to specified a name

Can you help me to solve this problem please ?

Thanks

Regards

github.com/docker/docker/pkg/mflag doesn't exist anymore

I get an error when I try to install the c14 command line on Debian Stable (Jessie/8) with only the "golang" package installed.

# go get -u github.com/online-net/c14-cli/cmd/c14
package github.com/online-net/c14-cli/cmd/c14
        imports github.com/BurntSushi/toml
        imports github.com/QuentinPerez/go-encodeUrl
        imports github.com/apex/log
        imports github.com/apex/log/handlers/text
        imports github.com/docker/docker/pkg/jsonlog
        imports github.com/docker/docker/pkg/jsonmessage
        imports github.com/docker/docker/pkg/term
        imports github.com/docker/go-units
        imports github.com/docker/docker/pkg/mflag
        imports github.com/docker/docker/pkg/mflag
        imports github.com/docker/docker/pkg/mflag: cannot find package "github.com/docker/docker/pkg/mflag" in any of:
        /usr/lib/go/src/pkg/github.com/docker/docker/pkg/mflag (from $GOROOT)
        /root/go/src/github.com/docker/docker/pkg/mflag (from $GOPATH)

It might be related to moby/moby@14712f9 where the whole mflag directory was seemingly removed from the master branch.

Another VM on Debian Testing doesn't raise an error, but already has the "docker.io" package installed (version 1.11.2~ds1-5)

c14 ls only lists the first 50 archives

Hello,

In my account, I have 100+ archives, each in one safe.

When using c14 ls, it only list the first 50 archives. How can I get the others ones ?

Thanks.

Can't make it in FreeBSD (FreeNAS Jail)

I've install Go in a FreeBSD Jail and make command didn't make everything.

First, I've to hack Makefile because it didn't want ifneq:

make: "/root/go/src/github.com/online-net/c14-cli/Makefile" line 23: Missing dependency operator
make: "/root/go/src/github.com/online-net/c14-cli/Makefile" line 25: Need an operator
make: Fatal errors encountered -- cannot continue
make: stopped in /root/go/src/github.com/online-net/c14-cli

Then, it didn't compil at all because it don't understand variable $SOURCES

gofmt -w -s 
error: cannot use -w with standard input
*** Error code 2

Stop.
make: stopped in /root/go/src/github.com/online-net/c14-cli

But command work:

find . -type f -name "*.go" | grep -vE '^./vendor'
./cmd/c14/main.go
./pkg/commands/login.go
./pkg/commands/verify.go
./pkg/commands/command.go
./pkg/commands/help.go
./pkg/commands/freezze.go
./pkg/commands/upload.go
./pkg/commands/remove.go
./pkg/commands/ls.go
./pkg/commands/root.go
./pkg/commands/unfreeze.go
./pkg/commands/files.go
./pkg/commands/rename.go
./pkg/commands/create.go
./pkg/utils/ssh/ssh.go
./pkg/utils/configstore/store.go
./pkg/utils/pgbar/pgbar.go
./pkg/api/methods.go
./pkg/api/cache.go
./pkg/api/error.go
./pkg/api/helpers.go
./pkg/api/auth/auth.go
./pkg/api/api.go
./pkg/api/resources.go
./pkg/version/version.go

I've install Go with pkg:
#go version
go version go1.7.3 freebsd/amd64

Caching of Archives appears to be broken

I was seeing strange behaviour with the c14-cli utility whenever I tried to have multiple buckets open and tried interacting with the newly created ones.

The online console was showing these archives with a ready temporary storage and was providing ssh authentication data that worked when entered manually, but the c14-cli utility would insist that the archive didn't exist.

Looking more closely at the source code I noticed that all of these commands were calling FindSafeUUIDFromArchive with useCache set to true, a quick and dirty patch, setting all of these calls to false resolved all of the issues I was facing.

The c14 upload command already seems to fall back to not using the cache automatically but the c14 bucket command does not, which I used to check if the bucket was ready, since bucket creation isn't instant even after the archive has been created using c14 create from what I could tell. At least I did get error messages of missing archives every so often with the upload command until I changed the script I had written to wait for the bucket to be returned with the c14 bucket command.

Generally the c14 bucket command seems to have been left in the dust a bit, since you have to use the uuid to refer to the archive rather than its given name like with all the other commands and the missing fallback to not using the cache.

That being said however I do believe the caching mechanism is not working as intended and is the issue at heart, since even after an entire day of waiting the command would still report the archive as missing, no matter what I tried, like running c14 ls or other commands.

I suspect that elements do not get added to the cache properly and are overwriting previous entries rather than being appended since the one archive that would work no matter what was always the oldest one, which was lowest in the ls command.

When use 'c14 login'

When do we have to use c14 login? Each time by computer or each time we want to use a c14 command line?

Chose a Safe

Hi,

Can you implement a command that can choose where we want to store an archive?

Thanks

Man in the middle vulnerability due to use of InsecureIgnoreHostKey

Hey there, I'm a security researcher and I found this project by looking for projects using the InsecureIgnoreHostKey function on Github.

To fix issue #36 (a runtime error that broke the application on a new Go version), this code was introduced.

The error is actually created on purpose to make it clear that implementations needed to do host key checking. Without it, clients are vulnerable to "man in the middle" attacks, where attackers can get in between the user and the server and snoop commands and files or even inject their own. In the case of c14-cli, it seems a man in the middle server could forward the one time password to the server in order to log in as the user and inject commands.

More information is in the golang commit and the blog post by the person who found the issue in Go.

I would suggest adding the host key of the online.net SSH server to the c14-cli if that's possible, or otherwise maybe you can extend the Online web API to also send the trusted SSH host key for host key verification.

I hope you can use this information to improve the security for your users. :-)

Permit private token usage

The console allows the usage of a private token which has all permissions
Could be cool to allow the user to use it

Progress output should go to stderr, not stdout.

I'm trying to get the create output to a variable so I can upload to it from a script, but the output is a mess:
$'\r'-$'\r'$'\r'\\$'\r'$'\r'\|$'\r'$'\r'/$'\r'$'\r'-$'\r'$'\r'-$'\r'$'\r'\\$'\r'$'\r'\|$'\r'$'\r'/$'\r'$'\r'-$'\r'$'\r'-$'\r'$'\r'\\$'\r'$'\r'\|$'\r'$'\r'/$'\r'$'\r'-$'\r'$'\r'-$'\r'$'\r'\\$'\r'$'\r'\|$'\r'$'\r'/$'\r'$'\r'-$'\r'$'\r'-$'\r'$'\r'\\$'\r'$'\r'\|$'\r'$'\r'/$'\r'$'\r'-$'\r'$'\r'-$'\r'$'\r'\\$'\r'$'\r'\ $'\r'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa

uuid was replaced with a's for potential security reasons.

This makes scripting an unnecessary pain, and is probably a bug.

Here's what Ask Ubuntu General Room has to say: It looks like a progress spinner of sorts, the output - Ah! Yes. And the idiots are printing it to stdout. - Ask them to print progress reports to stderr where they belong.

Improve `c14 login`

We should synchronize with the Online API team to allow the form fields to be prefilled using the URL query string, i.e:


Actual

$ c14 login
! You must provide a ClientID !

Please opens this link with your web browser: https://console.online.net/en/api/apps
You can create a new app with the following fields:

---
    App name:    c14
    Description: c14 cli
    Permissions:
        (c14)  Read/Write
        (user) Read/Write

---
Then copy the client_id here : XXXXXXXXXXXXXXXXXXXXXXXXX

Please opens this link with your browser: https://console.online.net/oauth/v2/device/usercode
Then copy paste the code XXXXXXXX (enter when is done) :

expected

➜  c14-cli git:(master) ./c14 login
! You must provide a ClientID !

Please opens this link with your web browser: https://console.online.net/en/api/apps/?app_name=c14&app_description=c14+cli&c14_permissions=rw&user_permissions=rw
Then copy the client_id here :XXXXXXXXXXXXXXXXXXXXXXXXX

Please opens this link with your browser: https://console.online.net/oauth/v2/device/usercode?code= XXXXXXXX

silent output during upload

Hi,
When using this cli in a script, it should be good to have a quiet or silent option to not output the progress bar but just the status at the end, because when uploading a big file, the output is very long.

Example during a proxmox backup :

102: 2018-01-25 02:40:45 INFO: Uploading vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg to C14
102: 2018-01-25 02:40:47 INFO: vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg [> ] 8.389MB/40.57GB
102: 2018-01-25 02:40:47 INFO: vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg [> ] 16.78MB/40.57GB
102: 2018-01-25 02:40:47 INFO: vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg [> ] 25.17MB/40.57GB
102: 2018-01-25 02:40:47 INFO: vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg [> ] 33.55MB/40.57GB
102: 2018-01-25 02:40:47 INFO: vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg [> ] 41.94MB/40.57GB
102: 2018-01-25 02:40:48 INFO: vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg [> ] 50.33MB/40.57GB
102: 2018-01-25 02:40:48 INFO: vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg [> ] 58.72MB/40.57GB
102: 2018-01-25 02:40:48 INFO: vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg [> ] 67.11MB/40.57GB
102: 2018-01-25 02:40:48 INFO: vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg [> ] 75.5MB/40.57GB
102: 2018-01-25 02:40:48 INFO: vzdump-lxc-102-2018_01_25-00_46_51.tar.gz.gpg [> ] 83.89MB/40.57GB
…

ansible module ?

Hello, the CLI was written in GoLang, this is nice, but is there a project to add ansible modules support ? Could be very very great to manage C14 backups like S3/Glacier in ansible

Thanks

Issue removing archive

Hello
I've got some trouble about removing old archive. (older than a month)
When I run the command c14 remove I've got this warning

WARN[0000] xxxxx: Archive xxxxx not found

But when I'm using the web interface I can remove the concerned archive without any problem

What could be the problem?

Thanks
Matthieu

use the device code auth for login

As described on https://console.online.net/en/api/ > Authentication > OAuth2 for opensource apps

Request the following URL: GET https://console.online.net/oauth/v2/device/code?client_id=OUR_APPS_CLIENT_ID&new_credentials=yes

You should get an object that gives you a device_code, user_code, and verification_url. (The codes have a TTL of 30 minutes.)

Tell the user to go to the verification URL and enter the value of user_code, then allow your app.
While the user is busy doing that, poll the following URL until you don't have an error anymore: GET https://console.online.net/oauth/v2/device/credentials?client_id=OUR_APPS_CLIENT_ID&code=DEVICE_CODE

That URL should give you an object with client_id and client_secret. These are specific to the user, and can't be used with another user.

With those, you can now request a token: curl -X POST "https://console.online.net/oauth/v2/token" -d "client_id=THE_NEW_CLIENT_ID&client_secret=THE_NEW_CLIENT_SECRET&code=DEVICE_CODE&grant_type=http://oauth.net/grant_type/device/1.0"

How to "Download" data back from C14 archive

Reviewing the commands below:
There seems to be no command to download data back from C14 Archive

Commands:
create Create a new archive
files List the files of an archive
freeze Lock an archive
help Help of the c14 command line
login Log in to Online API
ls List the archives
rename Rename an archive
remove Remove an archive
unfreeze Unlock an archive
upload Upload your file or directory into an archive

Can't create archive in existing safe

root@vrayo:~# c14 create --safe "MySafe" FATAL[0000] [409] : This name is already used
When trying to create an archive in a safe which already exists ( because c14 create without a safe name creates a new safe each time which I dont want) ... it fails :(

What is the expected behaviour ?
I would like to do c14 create --name "MyArchive" --description "A new archive" --safe "MySafe"`` where MySafe already exists and this adds an archive to this safe

thanks !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.