2017-01-09 00:24:03 +08:00
|
|
|
package obscure
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2019-07-29 01:47:38 +08:00
|
|
|
"github.com/rclone/rclone/cmd"
|
|
|
|
"github.com/rclone/rclone/fs/config/obscure"
|
2017-01-09 00:24:03 +08:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2019-10-11 23:58:11 +08:00
|
|
|
cmd.Root.AddCommand(commandDefinition)
|
2017-01-09 00:24:03 +08:00
|
|
|
}
|
|
|
|
|
2019-10-11 23:58:11 +08:00
|
|
|
var commandDefinition = &cobra.Command{
|
2017-01-09 00:24:03 +08:00
|
|
|
Use: "obscure password",
|
2020-06-05 19:48:28 +08:00
|
|
|
Short: `Obscure password for use in the rclone config file`,
|
|
|
|
Long: `In the rclone config file, human readable passwords are
|
|
|
|
obscured. Obscuring them is done by encrypting them and writing them
|
|
|
|
out in base64. This is **not** a secure way of encrypting these
|
|
|
|
passwords as rclone can decrypt them - it is to prevent "eyedropping"
|
|
|
|
- namely someone seeing a password in the rclone config file by
|
|
|
|
accident.
|
|
|
|
|
|
|
|
Many equally important things (like access tokens) are not obscured in
|
|
|
|
the config file. However it is very hard to shoulder surf a 64
|
|
|
|
character hex token.
|
|
|
|
|
|
|
|
If you want to encrypt the config file then please use config file
|
|
|
|
encryption - see [rclone config](/commands/rclone_config/) for more
|
|
|
|
info.`,
|
2017-01-09 00:24:03 +08:00
|
|
|
Run: func(command *cobra.Command, args []string) {
|
|
|
|
cmd.CheckArgs(1, 1, command, args)
|
|
|
|
cmd.Run(false, false, command, func() error {
|
2018-01-19 04:19:55 +08:00
|
|
|
obscured := obscure.MustObscure(args[0])
|
|
|
|
fmt.Println(obscured)
|
2017-01-09 00:24:03 +08:00
|
|
|
return nil
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|