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 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
|
=head1 NAME
nbdkit-ssh-plugin - access disk images over the SSH protocol
=head1 SYNOPSIS
nbdkit ssh host=HOST [path=]PATH
[compression=true] [config=CONFIG_FILE]
[create=true] [create-mode=MODE] [create-size=SIZE]
[identity=FILENAME] [known-hosts=FILENAME]
[password=PASSWORD|-|+FILENAME]
[port=PORT] [timeout=SECS] [user=USER]
[verify-remote-host=false]
=head1 DESCRIPTION
This is an L<nbdkit(1)> plugin which lets you access remote disk
images over Secure Shell (SSH). Any server which hosts disk images
and runs an SSH server can be turned into an NBD source using this
plugin.
=head1 EXAMPLES
=over 4
=item nbdkit ssh host=ssh.example.com disk.img
Open a file called F<disk.img> on remote host C<ssh.example.com>.
Because the pathname is relative, it is opened relative to the user’s
home directory on the remote server.
The remote file can be read or written. To force read-only access add
the I<-r> flag.
=item nbdkit ssh host=ssh.example.com disk.img user=bob
As above but log in using username C<bob> (instead of trying the local
username).
=back
=head1 PARAMETERS
=over 4
=item B<compression=true>
Enable compression. You should only use this on slow or
bandwidth-limited connections. On fast connections it will slow
things down.
=item B<config=>CONFIG_FILE
Read local SSH configuration from an alternate configuration file.
Libssh expands some C<%>-sequences in C<CONFIG_FILE>, see
L</Path expansion> below. C<CONFIG_FILE> must expand to an absolute
path.
=item B<config=>
Do not read any local SSH configuration.
The C<config> parameter is optional. If it is I<not> specified at all
then F<~/.ssh/config> and F</etc/ssh/ssh_config> are both read.
Missing or unreadable files are ignored.
=item B<create=true>
(nbdkit E<ge> 1.32)
If set, the remote file will be created. The remote file is created
on the first NBD connection to nbdkit, not when nbdkit starts up. If
the file already exists, it will be replaced and any existing content
lost.
If using this option, you must use C<create-size>. C<create-mode> can
be used to control the permissions of the new file.
=item B<create-mode=>MODE
(nbdkit E<ge> 1.32)
If using C<create=true> specify the default permissions of the new
remote file. You can use octal modes like C<create-mode=0777> or
C<create-mode=0644>. The default is C<0600>, ie. only readable and
writable by the remote user.
=item B<create-size=>SIZE
(nbdkit E<ge> 1.32)
If using C<create=true>, specify the virtual size of the new disk.
C<SIZE> can use modifiers like C<100M> etc.
=item B<host=>HOST
Specify the name or IP address of the remote host.
This parameter is required.
=item B<identity=>FILENAME
Prepend the private key (identity) C<FILENAME> to the list of identity
files used. Libssh examines several identity files by default such as
F<~/.ssh/id_ed25519>, F<~/.ssh/id_ecdsa>, F<~/.ssh/id_rsa> and
F<~/.ssh/id_dsa>. Libssh expands some C<%>-sequences in C<FILENAME>,
see L</Path expansion> below. C<FILENAME> must expand to an absolute
path.
You can give this parameter multiple times.
=item B<known-hosts=>FILENAME
Set name of the file which records the identity of previously seen
hosts. Libssh expands some C<%>-sequences in C<FILENAME>, see
L</Path expansion> below. C<FILENAME> must expand to an absolute
path.
The default is to check F<~/.ssh/known_hosts> followed by
F</etc/ssh/ssh_known_hosts>.
=item B<password=>PASSWORD
Set the password to use when connecting to the remote server.
Note that passing this on the command line is not secure on shared
machines.
=item B<password=->
Ask for the password (interactively) when nbdkit starts up.
=item B<password=+>FILENAME
Read the password from the named file. This is a secure method
to supply a password, as long as you set the permissions on the file
appropriately.
=item B<password=->FD
Read the password from file descriptor number C<FD>, inherited from
the parent process when nbdkit starts up. This is also a secure
method to supply a password.
=item [B<path=>]PATH
Specify the path to the remote file. This can be a relative path in
which case it is relative to the remote home directory.
This parameter is required.
C<path=> __IS_MAGIC__
=item B<port=>PORT
Specify the SSH protocol port name or number.
This parameter is optional. If not given then the default ssh port is
used.
=item B<timeout=>SECS
Set the SSH connection timeout in seconds.
=item B<user=>USER
Specify the remote username.
This parameter is optional. If not given then the local username is
used.
=item B<verify-remote-host=true>
=item B<verify-remote-host=false>
Set whether or not we verify the remote host is one we have previously
seen, using a local file such as F<~/.ssh/known_hosts>. The default
is C<true>, meaning that we verify the remote host’s identity has not
changed.
Setting this to C<false> is dangerous because it allows a
Man-In-The-Middle (MITM) attack to be conducted against you.
=back
=head1 NOTES
=head2 Known hosts
The SSH server’s host key is checked at connection time, and must be
present and correct in the local "known hosts" file.
If you have never connected to the SSH server before then the
connection will usually fail. You can:
=over 4
=item *
connect to the server first using L<ssh(1)> so you can manually accept
the host key, or
=item *
provide the host key in an alternate file which you specify using the
C<known-hosts> option, or
=item *
set I<verify-remote-host=false> on the command line. This latter
option is dangerous because it allows a MITM attack to be conducted
against you.
=back
=head2 Supported authentication methods
This plugin supports only the following authentication methods:
C<none>, C<publickey> or C<password>. In particular note that
C<keyboard-interactive> is I<not> supported.
=head2 SSH agent
There is no means for nbdkit to ask for the public key passphrase when
it is running as a server. Therefore C<publickey> authentication must
be done in conjunction with L<ssh-agent(1)>.
=head2 Path expansion
In the C<config>, C<identity> and C<known-hosts> options, libssh
expands some C<%>-sequences.
=over 4
=item C<%d>
The user’s SSH directory, usually F<~/.ssh>
=item C<%u>
The local username.
=item C<%l>
The local hostname.
=item C<%h>
The remote hostname.
=item C<%r>
The remote username.
=item C<%p>
The SSH port number.
=item C<%%>
In libssh E<gt> 0.9.0 this expands to a single C<%> character. In
earlier versions of libssh there was no way to escape a C<%>
character.
=back
=head1 DEBUG FLAGS
=head2 -D ssh.log=[1..4]
Set the libssh log level to increasing levels of verbosity. Each
level includes messages from the previous levels. Currently
the levels are:
=over 4
=item B<1>
informational and warning messages
=item B<2>
SSH and SFTP protocol steps
=item B<3>
SSH and SFTP packets
=item B<4>
libssh functions
=back
Use level 2 to diagnose SSH protocol or server problems. Levels 3 and
4 are extremely verbose and probably only useful if you are debugging
libssh itself.
If diagnosing SSH problems it is also useful to look at server-side
logs, eg. F</var/log/secure> or C<journalctl -u sshd>
=head1 FILES
=over 4
=item F<~/.ssh/config>
=item F</etc/ssh/ssh_config>
These are the default SSH config files which are read to get other
options. You can change this using the C<config> option.
=item F<~/.ssh/id_dsa>
=item F<~/.ssh/id_ecdsa>
=item F<~/.ssh/id_ed25519>
=item F<~/.ssh/id_rsa>
These are some of the default private key (identify) files used by
libssh. You can prepend more to the list using the C<identity>
option.
=item F<~/.ssh/known_hosts>
=item F</etc/ssh/ssh_known_hosts>
These are the default SSH files recording the identity of previously
seen hosts. You can change this using the C<known-hosts> option.
=item F<$plugindir/nbdkit-ssh-plugin.so>
The plugin.
Use C<nbdkit --dump-config> to find the location of C<$plugindir>.
=back
=head1 VERSION
C<nbdkit-ssh-plugin> first appeared in nbdkit 1.12.
=head1 SEE ALSO
L<nbdkit(1)>,
L<nbdkit-curl-plugin(1)>,
L<nbdkit-extentlist-filter(1)>,
L<nbdkit-retry-filter(1)>,
L<nbdkit-plugin(3)>,
L<ssh(1)>,
L<ssh-agent(1)>,
L<https://libssh.org>.
=head1 AUTHORS
Richard W.M. Jones
Parts derived from Pino Toscano’s qemu libssh driver.
=head1 COPYRIGHT
Copyright Red Hat
|