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
|
@c -*-texinfo-*-
@c This file is part of Guile-SSH Reference Manual.
@c Copyright (C) 2014 Artyom V. Poptsov
@c See the file guile-ssh.texi for copying conditions.
@node Servers
@section Servers
@cindex servers
@tindex server
The @code{(ssh server)} module provides facilities for creation and
managing of Guile-SSH servers.
@deffn {Scheme Procedure} server? x
Return @code{#t} if @var{x} is a Guile-SSH server, @code{#f}
otherwise.
@end deffn
@deffn {Scheme Procedure} %make-server
Make a new Guile-SSH server.
@end deffn
@deffn {Scheme Procedure} make-server [keywords]
Make a new Guile-SSH server with the specified configuration specified
by keywords. Return a new Guile-SSH server.
Example:
@lisp
(let ((s (make-server #:bindport 12345
#:rsakey "/home/bob/.ssh/id_rsa"
#:log-verbosity 'nolog)))
...)
@end lisp
@end deffn
@deffn {Scheme Procedure} server-set! server option value
Set a @var{option} to @var{value} for Guile-SSH @var{server}. Throw
@code{guile-ssh-error} on error. Return value is undefined.
Here is the description of available options. The description is
based on libssh documentation:
@table @samp
@item bindaddr
Set the bind address for the @var{server}.
Expected type of @var{value}: string.
@item bindport
Set the bind port for the @var{server}, default is 22.
Expected type of @var{value}: number.
@item hostkey
Set the @var{server} public key type: ``ssh-rsa'' or ``ssh-dss''.
@strong{libssh 0.7 note:} you should pass a path to an ssh key for this
option. Only one key from per key type (RSA, DSA, ECDSA) is allowed in an
server at a time, and later calls to @code{server-set!} with this option for
the same key type will override prior calls.
Expected type of @var{value}: string.
@item dsakey
Set the path to the @acronym{SSH} host @acronym{DSA} key.
Expected type of @var{value}: string.
@item rsakey
Set the path to the @acronym{SSH} host @acronym{RSA} key.
Expected type of @var{value}: string.
@item banner
Set the @var{server} banner sent to clients.
Expected type of @var{value}: string.
@item log-verbosity
Set the logging verbosity. Possible values:
@table @samp
@item nolog
No logging at all
@item rare
Only rare and noteworthy events
@item protocol
High level protocol information
@item packet
Lower level protocol infomations, packet level
@item functions
Every function path
@end table
Expected type of @var{value}: symbol.
@item blocking-mode
Set the @var{server} to blocking/nonblocking mode according to
@var{value}. The @var{value} is expected to be @code{#t} or
@code{#f}.
Expected type of @var{value}: boolean.
@end table
@end deffn
@deffn {Scheme Procedure} server-get server option
Get value of @var{option} for Guile-SSH @var{server}. Return @var{option}
value, or @code{#f} if the @var{option} does not set. Throw
@code{guile-ssh-error} on error.
@end deffn
@deffn {Scheme Procedure} server-listen server
Start listening to the socket. Throw @code{guile-ssh-error} on error.
Return value undefined.
@end deffn
@deffn {Scheme Procedure} server-accept server
Accept an incoming @acronym{SSH} connection to the @var{server}.
Return a new Guile-SSH session. Throw @code{guile-ssh-error} on error.
Example:
@lisp
(let ((session (catch 'guile-ssh-error
(lambda ()
(server-accept server))
(lambda (key . args)
;; Handle error
#f))))
...)
@end lisp
One of the possible causes of errors might be that your server has no
access to host keys.
If you get an exception and it shows no cause of the error then try to
set @code{log-verbosity} to a value other than @code{nolog} (e.g. to
@code{rare}, see @code{server-set!} above) and check printouts from
the libssh.
@end deffn
@deffn {Scheme Procedure} server-handle-key-exchange session
Handle key exchange for a @var{session} and setup encryption. Throw
@code{guile-ssh-error} on error. Return value is undefined.
@end deffn
@deffn {Scheme Procedure} server-message-get session
Get a message from a SSH client (@pxref{Messages}). Return a new
Guile-SSH message, or @code{#f} on error.
@end deffn
@c Local Variables:
@c TeX-master: "guile-ssh.texi"
@c End:
|