1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
use structopt::StructOpt;

#[derive(Debug, StructOpt, Clone)]
#[structopt(name = "oramfs", about = "ORAM filesystem written in Rust")]
pub struct CLIArgs {
    #[structopt(subcommand)]
    pub cmd: CLISubCommand,
}

#[allow(clippy::large_enum_variant)]
#[derive(StructOpt, Debug, Clone)]
pub enum CLISubCommand {
    #[structopt(about = "List existing ORAMs", name = "ls")]
    List {
        #[structopt(long = "oneline", help = "Output only one line per ORAM configuration")]
        oneline: bool,
    },
    #[structopt(about = "Add an ORAM", visible_alias = "create")]
    Add {
        #[structopt(name = "oram_name", help = "Name of the ORAM to add")]
        oram_name: String,
        #[structopt(name = "public", help = "Path to public directory")]
        public: String,
        #[structopt(name = "private", help = "Path to private directory")]
        private: String,

        #[structopt(
        long = "disable-encryption",
        visible_aliases = &["noenc"],
        help = "Disable encryption",
        )]
        disable_encryption: bool,

        #[structopt(
            long = "encrypted-encryption-key",
            default_value = "",
            help = "AEAD encrypted encryption key"
        )]
        encrypted_encryption_key: String,

        #[structopt(
        long = "alg",
        default_value = "pathoram",
        help = "ORAM scheme to use.",
        possible_values = &["fakeoram", "pathoram"],
        )]
        algorithm: String,

        #[structopt(
        long = "io",
        default_value = "disk",
        help = "IO Service to use.",
        possible_values = &["disk", "memory"],
        )]
        io: String,

        #[structopt(
            long = "client-data-dir",
            default_value = "/etc/oramfs/pathoram",
            help = "Path to the directory containing the client data"
        )]
        client_data_dir: String,

        #[structopt(
        long = "cipher",
        default_value = "aes-gcm",
        help = "Cipher to use for encryption.",
        possible_values = &["chacha8", "aes-ctr", "aes-gcm"],
        )]
        cipher: String,

        #[structopt(
            long = "non-interactive",
            help = "Ask configuration options interactively"
        )]
        non_interactive: bool,

        #[structopt(
            short = "p",
            long = "passphrase",
            default_value = "",
            help = "Encryption passphrase"
        )]
        encryption_passphrase: String,

        #[structopt(
            short = "m",
            long = "mountpoint",
            default_value = "mnt",
            help = "Path to directory to mount the FUSE ORAM at. \
        The directory will be created if it does not exist yet."
        )]
        mountpoint: String,

        #[structopt(
        short,
        long = "bucket-count",
        visible_aliases = &["nodes-count"],
        default_value = "255",
        help = "Number of buckets",
        )]
        n: i64,

        #[structopt(
        short,
        long = "blocks-per-bucket",
        visible_aliases = &["blocks-per-node"],
        default_value = "4",
        help = "Number of blocks per bucket",
        )]
        z: i64,

        #[structopt(
        short,
        long = "block-size",
        visible_aliases = &["bs"],
        default_value = "16384",
        help = "Block size in bytes",
        )]
        b: i64,
    },
    #[structopt(about = "Remove an existing ORAM", name = "rm")]
    Remove {
        #[structopt(name = "oram_name", help = "Name of the ORAM to remove.")]
        oram_name: String,
    },
    #[structopt(about = "Mount an ORAM", visible_alias = "open")]
    Mount {
        #[structopt(name = "oram_name", help = "Name of the ORAM to mount.")]
        oram_name: String,

        #[structopt(
        long = "foreground",
        visible_aliases = &["f"],
        help = "Run in foreground.",
        )]
        foreground: bool,

        #[structopt(
            long,
            help = "Initialize the ORAM. Warning: some ORAMs perform destructive operations \
        on initialization. Make sure to use this option only the first time you create \
        your ORAM."
        )]
        init: bool,

        #[structopt(
        long = "manual",
        visible_aliases = &["nomount"],
        help = "Use manual mode. Do not mount ORAMFS automatically.",
        )]
        manual: bool,
    },
    #[structopt(about = "Unmount an ORAM", visible_alias = "close")]
    Umount {
        #[structopt(name = "oram_name", help = "Name of the ORAM to unmount.")]
        oram_name: String,
    },
    #[structopt(about = "Enlarge an ORAM. This effectively doubles its size. \
        Note that the ORAM must be unmounted first.")]
    Enlarge {
        #[structopt(name = "oram_name", help = "Name of the ORAM to enlarge.")]
        oram_name: String,

        #[structopt(
        long = "manual",
        visible_aliases = &["nomount"],
        help = "Use manual mode. Do not run resize2fs and unmount automatically. \
        This can be useful for filesystems other than ext4.",
        )]
        manual: bool,
    },
}