| 1 | /*
|
|---|
| 2 | * Copyright (c) 2004 Kungliga Tekniska Högskolan
|
|---|
| 3 | * (Royal Institute of Technology, Stockholm, Sweden).
|
|---|
| 4 | * All rights reserved.
|
|---|
| 5 | *
|
|---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
|---|
| 7 | * modification, are permitted provided that the following conditions
|
|---|
| 8 | * are met:
|
|---|
| 9 | *
|
|---|
| 10 | * 1. Redistributions of source code must retain the above copyright
|
|---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
|---|
| 12 | *
|
|---|
| 13 | * 2. Redistributions in binary form must reproduce the above copyright
|
|---|
| 14 | * notice, this list of conditions and the following disclaimer in the
|
|---|
| 15 | * documentation and/or other materials provided with the distribution.
|
|---|
| 16 | *
|
|---|
| 17 | * 3. Neither the name of the Institute nor the names of its contributors
|
|---|
| 18 | * may be used to endorse or promote products derived from this software
|
|---|
| 19 | * without specific prior written permission.
|
|---|
| 20 | *
|
|---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
|---|
| 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
|---|
| 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|---|
| 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|---|
| 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|---|
| 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|---|
| 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|---|
| 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|---|
| 31 | * SUCH DAMAGE.
|
|---|
| 32 | */
|
|---|
| 33 | /* $Id$ */
|
|---|
| 34 |
|
|---|
| 35 | command = {
|
|---|
| 36 | name = "add"
|
|---|
| 37 | option = {
|
|---|
| 38 | long = "principal"
|
|---|
| 39 | short = "p"
|
|---|
| 40 | type = "string"
|
|---|
| 41 | help = "principal to add"
|
|---|
| 42 | argument = "principal"
|
|---|
| 43 | default = ""
|
|---|
| 44 | }
|
|---|
| 45 | option = {
|
|---|
| 46 | long = "kvno"
|
|---|
| 47 | short = "V"
|
|---|
| 48 | type = "integer"
|
|---|
| 49 | help = "key version number"
|
|---|
| 50 | default = "-1"
|
|---|
| 51 | }
|
|---|
| 52 | option = {
|
|---|
| 53 | long = "enctype"
|
|---|
| 54 | short = "e"
|
|---|
| 55 | type = "string"
|
|---|
| 56 | argument = "enctype"
|
|---|
| 57 | help = "encryption type"
|
|---|
| 58 | }
|
|---|
| 59 | option = {
|
|---|
| 60 | long = "password"
|
|---|
| 61 | short = "w"
|
|---|
| 62 | type = "string"
|
|---|
| 63 | help = "password for key"
|
|---|
| 64 | }
|
|---|
| 65 | option = {
|
|---|
| 66 | long = "salt"
|
|---|
| 67 | short = "s"
|
|---|
| 68 | type = "-flag"
|
|---|
| 69 | help = "use unsalted keys"
|
|---|
| 70 | default = "1"
|
|---|
| 71 | }
|
|---|
| 72 | option = {
|
|---|
| 73 | long = "random"
|
|---|
| 74 | short = "r"
|
|---|
| 75 | type = "flag"
|
|---|
| 76 | help = "generate random key"
|
|---|
| 77 | }
|
|---|
| 78 | option = {
|
|---|
| 79 | long = "hex"
|
|---|
| 80 | short = "H"
|
|---|
| 81 | type = "flag"
|
|---|
| 82 | help = "password is a hexadecimal string"
|
|---|
| 83 | }
|
|---|
| 84 | function = "kt_add"
|
|---|
| 85 | help = "Adds a key to a keytab."
|
|---|
| 86 | max_args = "0"
|
|---|
| 87 | }
|
|---|
| 88 | command = {
|
|---|
| 89 | name = "change"
|
|---|
| 90 | option = {
|
|---|
| 91 | long = "realm"
|
|---|
| 92 | short = "r"
|
|---|
| 93 | type = "string"
|
|---|
| 94 | argument = "realm"
|
|---|
| 95 | help = "realm to use"
|
|---|
| 96 | }
|
|---|
| 97 | option = {
|
|---|
| 98 | long = "admin-server"
|
|---|
| 99 | short = "a"
|
|---|
| 100 | type = "string"
|
|---|
| 101 | argument = "host"
|
|---|
| 102 | help = "server to contact"
|
|---|
| 103 | }
|
|---|
| 104 | option = {
|
|---|
| 105 | long = "server-port"
|
|---|
| 106 | short = "s"
|
|---|
| 107 | type = "integer"
|
|---|
| 108 | argument = "port number"
|
|---|
| 109 | help = "port number on server"
|
|---|
| 110 | }
|
|---|
| 111 | function = "kt_change"
|
|---|
| 112 | argument = "[principal...]"
|
|---|
| 113 | help = "Change keys for specified principals (default all)."
|
|---|
| 114 | }
|
|---|
| 115 | command = {
|
|---|
| 116 | name = "copy"
|
|---|
| 117 | function = "kt_copy"
|
|---|
| 118 | argument = "source destination"
|
|---|
| 119 | min_args = "2"
|
|---|
| 120 | max_args = "2"
|
|---|
| 121 | help = "Copies one keytab to another."
|
|---|
| 122 | }
|
|---|
| 123 | command = {
|
|---|
| 124 | name = "get"
|
|---|
| 125 | option = {
|
|---|
| 126 | long = "principal"
|
|---|
| 127 | short = "p"
|
|---|
| 128 | type = "string"
|
|---|
| 129 | help = "admin principal"
|
|---|
| 130 | argument = "principal"
|
|---|
| 131 | }
|
|---|
| 132 | option = {
|
|---|
| 133 | long = "enctypes"
|
|---|
| 134 | short = "e"
|
|---|
| 135 | type = "strings"
|
|---|
| 136 | help = "encryption types to use"
|
|---|
| 137 | argument = "enctype"
|
|---|
| 138 | }
|
|---|
| 139 | option = {
|
|---|
| 140 | long = "realm"
|
|---|
| 141 | short = "r"
|
|---|
| 142 | type = "string"
|
|---|
| 143 | argument = "realm"
|
|---|
| 144 | help = "realm to use"
|
|---|
| 145 | }
|
|---|
| 146 | option = {
|
|---|
| 147 | long = "admin-server"
|
|---|
| 148 | short = "a"
|
|---|
| 149 | type = "string"
|
|---|
| 150 | argument = "host"
|
|---|
| 151 | help = "server to contact"
|
|---|
| 152 | }
|
|---|
| 153 | option = {
|
|---|
| 154 | long = "server-port"
|
|---|
| 155 | short = "s"
|
|---|
| 156 | type = "integer"
|
|---|
| 157 | argument = "port number"
|
|---|
| 158 | help = "port number on server"
|
|---|
| 159 | }
|
|---|
| 160 | function = "kt_get"
|
|---|
| 161 | min_args = "1"
|
|---|
| 162 | argument = "principal..."
|
|---|
| 163 | help = "Change keys for specified principals, and add them to the keytab."
|
|---|
| 164 | }
|
|---|
| 165 | command = {
|
|---|
| 166 | name = "list"
|
|---|
| 167 | option = {
|
|---|
| 168 | long = "keys"
|
|---|
| 169 | type = "flag"
|
|---|
| 170 | help = "show key values"
|
|---|
| 171 | }
|
|---|
| 172 | option = {
|
|---|
| 173 | long = "timestamp"
|
|---|
| 174 | type = "flag"
|
|---|
| 175 | help = "show timestamps"
|
|---|
| 176 | }
|
|---|
| 177 | max_args = "0"
|
|---|
| 178 | function = "kt_list"
|
|---|
| 179 | help = "Show contents of keytab."
|
|---|
| 180 | }
|
|---|
| 181 | command = {
|
|---|
| 182 | name = "purge"
|
|---|
| 183 | option = {
|
|---|
| 184 | long = "age"
|
|---|
| 185 | type = "string"
|
|---|
| 186 | help = "age to retiere"
|
|---|
| 187 | default = "1 week";
|
|---|
| 188 | argument = "time"
|
|---|
| 189 | }
|
|---|
| 190 | max_args = "0"
|
|---|
| 191 | function = "kt_purge"
|
|---|
| 192 | help = "Remove superceded keys from keytab."
|
|---|
| 193 | }
|
|---|
| 194 | command = {
|
|---|
| 195 | name = "remove"
|
|---|
| 196 | name = "delete"
|
|---|
| 197 | option = {
|
|---|
| 198 | long = "principal"
|
|---|
| 199 | short = "p"
|
|---|
| 200 | type = "string"
|
|---|
| 201 | help = "principal to remove"
|
|---|
| 202 | argument = "principal"
|
|---|
| 203 | }
|
|---|
| 204 | option = {
|
|---|
| 205 | long = "kvno"
|
|---|
| 206 | short = "V"
|
|---|
| 207 | type = "integer"
|
|---|
| 208 | help = "key version to remove"
|
|---|
| 209 | argument = "enctype"
|
|---|
| 210 | default = "0"
|
|---|
| 211 | }
|
|---|
| 212 | option = {
|
|---|
| 213 | long = "enctype"
|
|---|
| 214 | short = "e"
|
|---|
| 215 | type = "string"
|
|---|
| 216 | help = "enctype to remove"
|
|---|
| 217 | argument = "enctype"
|
|---|
| 218 | }
|
|---|
| 219 | max_args = "0"
|
|---|
| 220 | function = "kt_remove"
|
|---|
| 221 | help = "Remove keys from keytab."
|
|---|
| 222 | }
|
|---|
| 223 | command = {
|
|---|
| 224 | name = "rename"
|
|---|
| 225 | function = "kt_rename"
|
|---|
| 226 | argument = "from to"
|
|---|
| 227 | min_args = "2"
|
|---|
| 228 | max_args = "2"
|
|---|
| 229 | help = "Renames an entry in the keytab."
|
|---|
| 230 | option = {
|
|---|
| 231 | long = "delete"
|
|---|
| 232 | type = "-flag"
|
|---|
| 233 | help = "don't delete orignal entry"
|
|---|
| 234 | }
|
|---|
| 235 | }
|
|---|
| 236 | command = {
|
|---|
| 237 | name = "destroy"
|
|---|
| 238 | function = "kt_destroy"
|
|---|
| 239 | max_args = "0"
|
|---|
| 240 | help = "Destroy (remove) the keytab."
|
|---|
| 241 | }
|
|---|
| 242 | command = {
|
|---|
| 243 | name = "help"
|
|---|
| 244 | argument = "command"
|
|---|
| 245 | max_args = "1"
|
|---|
| 246 | function = "help"
|
|---|
| 247 | }
|
|---|