initial commit
This commit is contained in:
commit
a800a8c853
11
CA/.gitignore
vendored
Normal file
11
CA/.gitignore
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
index.txt
|
||||
index.txt.old
|
||||
index.txt.attr
|
||||
index.txt.attr.old
|
||||
cacert.pem
|
||||
serial
|
||||
serial.old
|
||||
openssl.cnf
|
||||
private/*
|
||||
newcerts/*
|
||||
|
1
CA/INTER/.gitignore
vendored
Normal file
1
CA/INTER/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*
|
30
CA/geninter.sh
Executable file
30
CA/geninter.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright [2010] [Anso Labs, LLC]
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
# ARG is the id of the user
|
||||
|
||||
mkdir INTER/$1
|
||||
cd INTER/$1
|
||||
cp ../../openssl.cnf.tmpl openssl.cnf
|
||||
sed -i -e s/%USERNAME%/$1/g openssl.cnf
|
||||
mkdir certs crl newcerts private
|
||||
echo "10" > serial
|
||||
touch index.txt
|
||||
openssl genrsa -out private/cakey.pem 1024 -config ./openssl.cnf -batch -nodes
|
||||
openssl req -new -sha1 -key private/cakey.pem -out ../../reqs/inter$1.csr -batch -subj "/C=US/ST=California/L=Mountain View/O=Anso Labs/OU=Nova Dev/CN=customer-intCA-$1"
|
||||
cd ../../
|
||||
openssl ca -extensions v3_ca -days 365 -out INTER/$1/cacert.pem -in reqs/inter$1.csr -config openssl.cnf -batch
|
26
CA/genrootca.sh
Executable file
26
CA/genrootca.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright [2010] [Anso Labs, LLC]
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
if [ -f "cacert.pem" ];
|
||||
then
|
||||
echo "Not installing, it's already done."
|
||||
else
|
||||
cp openssl.cnf.tmpl openssl.cnf
|
||||
sed -i -e s/%USERNAME%/ROOT/g openssl.cnf
|
||||
openssl req -new -x509 -extensions v3_ca -keyout private/cakey.pem -out cacert.pem -days 365 -config ./openssl.cnf -batch -nodes
|
||||
touch index.txt
|
||||
echo "10" > serial
|
||||
fi
|
0
CA/newcerts/.placeholder
Normal file
0
CA/newcerts/.placeholder
Normal file
87
CA/openssl.cnf.tmpl
Normal file
87
CA/openssl.cnf.tmpl
Normal file
@ -0,0 +1,87 @@
|
||||
# Copyright [2010] [Anso Labs, LLC]
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#
|
||||
# OpenSSL configuration file.
|
||||
#
|
||||
|
||||
# Establish working directory.
|
||||
|
||||
dir = .
|
||||
|
||||
[ ca ]
|
||||
default_ca = CA_default
|
||||
unique_subject = no
|
||||
|
||||
[ CA_default ]
|
||||
serial = $dir/serial
|
||||
database = $dir/index.txt
|
||||
new_certs_dir = $dir/newcerts
|
||||
certificate = $dir/cacert.pem
|
||||
private_key = $dir/private/cakey.pem
|
||||
default_days = 365
|
||||
default_md = md5
|
||||
preserve = no
|
||||
email_in_dn = no
|
||||
nameopt = default_ca
|
||||
certopt = default_ca
|
||||
policy = policy_match
|
||||
|
||||
[ policy_match ]
|
||||
countryName = match
|
||||
stateOrProvinceName = match
|
||||
organizationName = optional
|
||||
organizationalUnitName = optional
|
||||
commonName = supplied
|
||||
emailAddress = optional
|
||||
|
||||
|
||||
[ req ]
|
||||
default_bits = 1024 # Size of keys
|
||||
default_keyfile = key.pem # name of generated keys
|
||||
default_md = md5 # message digest algorithm
|
||||
string_mask = nombstr # permitted characters
|
||||
distinguished_name = req_distinguished_name
|
||||
|
||||
[ req_distinguished_name ]
|
||||
# Variable name Prompt string
|
||||
#---------------------- ----------------------------------
|
||||
0.organizationName = Organization Name (company)
|
||||
organizationalUnitName = Organizational Unit Name (department, division)
|
||||
emailAddress = Email Address
|
||||
emailAddress_max = 40
|
||||
localityName = Locality Name (city, district)
|
||||
stateOrProvinceName = State or Province Name (full name)
|
||||
countryName = Country Name (2 letter code)
|
||||
countryName_min = 2
|
||||
countryName_max = 2
|
||||
commonName = Common Name (hostname, IP, or your name)
|
||||
commonName_max = 64
|
||||
|
||||
# Default values for the above, for consistency and less typing.
|
||||
# Variable name Value
|
||||
#------------------------------ ------------------------------
|
||||
0.organizationName_default = NOVA %USERNAME%
|
||||
localityName_default = Mountain View
|
||||
stateOrProvinceName_default = California
|
||||
countryName_default = US
|
||||
|
||||
[ v3_ca ]
|
||||
basicConstraints = CA:TRUE
|
||||
subjectKeyIdentifier = hash
|
||||
authorityKeyIdentifier = keyid:always,issuer:always
|
||||
|
||||
[ v3_req ]
|
||||
basicConstraints = CA:FALSE
|
||||
subjectKeyIdentifier = hash
|
0
CA/private/.placeholder
Normal file
0
CA/private/.placeholder
Normal file
1
CA/reqs/.gitignore
vendored
Normal file
1
CA/reqs/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*
|
53
HACKING
Normal file
53
HACKING
Normal file
@ -0,0 +1,53 @@
|
||||
Nova Style Commandments
|
||||
=======================
|
||||
|
||||
Step 1: Read http://www.python.org/dev/peps/pep-0008/
|
||||
Step 2: Read http://www.python.org/dev/peps/pep-0008/ again
|
||||
Step 3: Read on
|
||||
|
||||
Imports
|
||||
-------
|
||||
- thou shalt not import objects, only modules
|
||||
- thou shalt not import more than one module per line
|
||||
- thou shalt not make relative imports
|
||||
- thou shalt "from nova import vendor" before importing third party code
|
||||
- thou shalt organize your imports according to the following template
|
||||
|
||||
::
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
{{stdlib imports in human alphabetical order}}
|
||||
\n
|
||||
from nova import vendor
|
||||
{{vendor imports in human alphabetical order}}
|
||||
\n
|
||||
{{nova imports in human alphabetical order}}
|
||||
\n
|
||||
\n
|
||||
{{begin your code}}
|
||||
|
||||
|
||||
General
|
||||
-------
|
||||
- thou shalt put two newlines twixt toplevel code (funcs, classes, etc)
|
||||
- thou shalt put one newline twixt methods in classes and anywhere else
|
||||
- thou shalt not write "except:", use "except Exception:" at the very least
|
||||
- thou shalt include your name with TODOs as in "TODO(termie)"
|
||||
- thou shalt not name anything the same name as a builtin or reserved word
|
||||
- thou shalt not violate causality in our time cone, or else
|
||||
|
||||
|
||||
Human Alphabetical Order Examples
|
||||
---------------------------------
|
||||
::
|
||||
import httplib
|
||||
import logging
|
||||
import random
|
||||
import StringIO
|
||||
import time
|
||||
import unittest
|
||||
|
||||
from nova import flags
|
||||
from nova import test
|
||||
from nova.auth import users
|
||||
from nova.endpoint import api
|
||||
from nova.endpoint import cloud
|
176
LICENSE
Normal file
176
LICENSE
Normal file
@ -0,0 +1,176 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
6
debian/changelog
vendored
Normal file
6
debian/changelog
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
nova (0.3.0-1) UNRELEASED; urgency=low
|
||||
|
||||
* initial release
|
||||
|
||||
-- Jesse Andrews <jesse@ansolabs.com> Thur, 27 May 2010 12:28:00 -0700
|
||||
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
||||
7
|
40
debian/control
vendored
Normal file
40
debian/control
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
Source: nova
|
||||
Section: net
|
||||
Priority: extra
|
||||
Maintainer: Jesse Andrews <jesse@ansolabs.com>
|
||||
Build-Depends: debhelper (>= 7)
|
||||
Build-Depends-Indep: python-support
|
||||
Standards-Version: 3.8.4
|
||||
XS-Python-Version: 2.6
|
||||
|
||||
Package: nova-common
|
||||
Architecture: all
|
||||
Depends: ${python:Depends}, aoetools, vlan, python-ipy, python-boto, python-m2crypto, python-pycurl, python-twisted, python-daemon, python-redis, python-carrot, python-lockfile, python-gflags, python-tornado, ${misc:Depends}
|
||||
Provides: ${python:Provides}
|
||||
Conflicts: nova
|
||||
Description: Nova is a cloud
|
||||
|
||||
Package: nova-compute
|
||||
Architecture: all
|
||||
Depends: nova-common (= ${binary:Version}), kpartx, kvm, python-libvirt, libvirt-bin (>= 0.8.1), ${python:Depends}, ${misc:Depends}
|
||||
Description: Nova compute
|
||||
|
||||
Package: nova-volume
|
||||
Architecture: all
|
||||
Depends: nova-common (= ${binary:Version}), vblade, vblade-persist, ${python:Depends}, ${misc:Depends}
|
||||
Description: Nova volume
|
||||
|
||||
Package: nova-api
|
||||
Architecture: all
|
||||
Depends: nova-common (= ${binary:Version}), ${python:Depends}, ${misc:Depends}
|
||||
Description: Nova api
|
||||
|
||||
Package: nova-objectstore
|
||||
Architecture: all
|
||||
Depends: nova-common (= ${binary:Version}), ${python:Depends}, ${misc:Depends}
|
||||
Description: Nova object store
|
||||
|
||||
Package: nova-tools
|
||||
Architecture: all
|
||||
Depends: python-boto, ${python:Depends}, ${misc:Depends}
|
||||
Description: CLI tools to access nova
|
69
debian/nova-api.init
vendored
Normal file
69
debian/nova-api.init
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nova-api
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: nova-api
|
||||
# Description: nova-api
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
DAEMON=/usr/bin/nova-api
|
||||
DAEMON_ARGS="--flagfile=/etc/nova.conf"
|
||||
PIDFILE=/var/run/nova-api.pid
|
||||
|
||||
ENABLED=false
|
||||
|
||||
if test -f /etc/default/nova-api; then
|
||||
. /etc/default/nova-api
|
||||
fi
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
log_daemon_msg "Starting nova api" "nova-api"
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS start; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
log_daemon_msg "Stopping nova api" "nova-api"
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS stop; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
restart|force-reload)
|
||||
test "$ENABLED" = "true" || exit 1
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS restart; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
status_of_proc -p $PIDFILE $DAEMON nova-api && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
log_action_msg "Usage: /etc/init.d/nova-api {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
1
debian/nova-api.install
vendored
Normal file
1
debian/nova-api.install
vendored
Normal file
@ -0,0 +1 @@
|
||||
bin/nova-api usr/bin
|
4
debian/nova-common.install
vendored
Normal file
4
debian/nova-common.install
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
bin/nova-manage usr/bin
|
||||
nova/auth/novarc.template usr/lib/pymodules/python2.6/nova/auth
|
||||
nova/compute/libvirt.xml.template usr/lib/pymodules/python2.6/nova/compute
|
||||
usr/lib/python*/*-packages/nova/*
|
69
debian/nova-compute.init
vendored
Normal file
69
debian/nova-compute.init
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nova-compute
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: nova-compute
|
||||
# Description: nova-compute
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
DAEMON=/usr/bin/nova-compute
|
||||
DAEMON_ARGS="--flagfile=/etc/nova.conf"
|
||||
PIDFILE=/var/run/nova-compute.pid
|
||||
|
||||
ENABLED=false
|
||||
|
||||
if test -f /etc/default/nova-compute; then
|
||||
. /etc/default/nova-compute
|
||||
fi
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
log_daemon_msg "Starting nova compute" "nova-compute"
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS start; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
log_daemon_msg "Stopping nova compute" "nova-compute"
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS stop; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
restart|force-reload)
|
||||
test "$ENABLED" = "true" || exit 1
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS restart; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
status_of_proc -p $PIDFILE $DAEMON nova-compute && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
log_action_msg "Usage: /etc/init.d/nova-compute {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
1
debian/nova-compute.install
vendored
Normal file
1
debian/nova-compute.install
vendored
Normal file
@ -0,0 +1 @@
|
||||
bin/nova-compute usr/bin
|
69
debian/nova-objectstore.init
vendored
Normal file
69
debian/nova-objectstore.init
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nova-objectstore
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: nova-objectstore
|
||||
# Description: nova-objectstore
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
DAEMON=/usr/bin/nova-objectstore
|
||||
DAEMON_ARGS="--flagfile=/etc/nova.conf"
|
||||
PIDFILE=/var/run/nova-objectstore.pid
|
||||
|
||||
ENABLED=false
|
||||
|
||||
if test -f /etc/default/nova-objectstore; then
|
||||
. /etc/default/nova-objectstore
|
||||
fi
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
log_daemon_msg "Starting nova objectstore" "nova-objectstore"
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS start; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
log_daemon_msg "Stopping nova objectstore" "nova-objectstore"
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS stop; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
restart|force-reload)
|
||||
test "$ENABLED" = "true" || exit 1
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS restart; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
status_of_proc -p $PIDFILE $DAEMON nova-objectstore && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
log_action_msg "Usage: /etc/init.d/nova-objectstore {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
1
debian/nova-objectstore.install
vendored
Normal file
1
debian/nova-objectstore.install
vendored
Normal file
@ -0,0 +1 @@
|
||||
bin/nova-objectstore usr/bin
|
69
debian/nova-volume.init
vendored
Normal file
69
debian/nova-volume.init
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nova-volume
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: nova-volume
|
||||
# Description: nova-volume
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
DAEMON=/usr/bin/nova-volume
|
||||
DAEMON_ARGS="--flagfile=/etc/nova.conf"
|
||||
PIDFILE=/var/run/nova-volume.pid
|
||||
|
||||
ENABLED=false
|
||||
|
||||
if test -f /etc/default/nova-volume; then
|
||||
. /etc/default/nova-volume
|
||||
fi
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
log_daemon_msg "Starting nova volume" "nova-volume"
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS start; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
log_daemon_msg "Stopping nova volume" "nova-volume"
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS stop; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
restart|force-reload)
|
||||
test "$ENABLED" = "true" || exit 1
|
||||
cd /var/run
|
||||
if $DAEMON $DAEMON_ARGS restart; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
test "$ENABLED" = "true" || exit 0
|
||||
status_of_proc -p $PIDFILE $DAEMON nova-volume && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
log_action_msg "Usage: /etc/init.d/nova-volume {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
1
debian/nova-volume.install
vendored
Normal file
1
debian/nova-volume.install
vendored
Normal file
@ -0,0 +1 @@
|
||||
bin/nova-volume usr/bin
|
1
debian/pycompat
vendored
Normal file
1
debian/pycompat
vendored
Normal file
@ -0,0 +1 @@
|
||||
2
|
1
debian/pyversions
vendored
Normal file
1
debian/pyversions
vendored
Normal file
@ -0,0 +1 @@
|
||||
2.6-
|
4
debian/rules
vendored
Executable file
4
debian/rules
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@
|
1
docs/.gitignore
vendored
Normal file
1
docs/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
_build/*
|
89
docs/Makefile
Normal file
89
docs/Makefile
Normal file
@ -0,0 +1,89 @@
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
-rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/nova.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/nova.qhc"
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
|
||||
"run these through (pdf)latex."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
1
docs/_build/.gitignore
vendored
Normal file
1
docs/_build/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*
|
0
docs/_static/.gitignore
vendored
Normal file
0
docs/_static/.gitignore
vendored
Normal file
0
docs/_templates/.gitignore
vendored
Normal file
0
docs/_templates/.gitignore
vendored
Normal file
46
docs/architecture.rst
Normal file
46
docs/architecture.rst
Normal file
@ -0,0 +1,46 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
nova System Architecture
|
||||
========================
|
||||
|
||||
Nova is built on a shared-nothing, messaging-based architecture. All of the major nova components can be run on multiple servers. This means that most component to component communication must go via message queue. In order to avoid blocking each component while waiting for a response, we use deferred objects, with a callback that gets triggered when a response is received.
|
||||
|
||||
In order to achieve shared-nothing with multiple copies of the same component (especially when the component is an API server that needs to reply with state information in a timely fashion), we need to keep all of our system state in a distributed data system. Updates to system state are written into this system, using atomic transactions when necessary. Requests for state are read out of this system. In limited cases, these read calls are memoized within controllers for short periods of time. (Such a limited case would be, for instance, the current list of system users.)
|
||||
|
||||
|
||||
Components
|
||||
----------
|
||||
|
||||
Below you will find a helpful explanation.
|
||||
|
||||
::
|
||||
|
||||
[ User Manager ] ---- ( LDAP )
|
||||
|
|
||||
| / [ Storage ] - ( ATAoE )
|
||||
[ API server ] -> [ Cloud ] < AMQP >
|
||||
| \ [ Nodes ] - ( libvirt/kvm )
|
||||
< HTTP >
|
||||
|
|
||||
[ S3 ]
|
||||
|
||||
|
||||
* API: receives http requests from boto, converts commands to/from API format, and sending requests to cloud controller
|
||||
* Cloud Controller: global state of system, talks to ldap, s3, and node/storage workers through a queue
|
||||
* Nodes: worker that spawns instances
|
||||
* S3: tornado based http/s3 server
|
||||
* User Manager: create/manage users, which are stored in ldap
|
||||
* Network Controller: allocate and deallocate IPs and VLANs
|
213
docs/auth.rst
Normal file
213
docs/auth.rst
Normal file
@ -0,0 +1,213 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Auth Documentation
|
||||
==================
|
||||
|
||||
Nova provides RBAC (Role-based access control) of the AWS-type APIs. We define the following roles:
|
||||
|
||||
Roles-Based Access Control of AWS-style APIs using SAML Assertions
|
||||
“Achieving FIPS 199 Moderate certification of a hybrid cloud environment using CloudAudit and declarative C.I.A. classifications”
|
||||
|
||||
Introduction
|
||||
--------------
|
||||
|
||||
We will investigate one method for integrating an AWS-style API with US eAuthentication-compatible federated authentication systems, to achieve access controls and limits based on traditional operational roles.
|
||||
Additionally, we will look at how combining this approach, with an implementation of the CloudAudit APIs, will allow us to achieve a certification under FIPS 199 Moderate classification for a hybrid cloud environment.
|
||||
|
||||
Relationship of US eAuth to RBAC
|
||||
--------------------------------
|
||||
|
||||
Typical implementations of US eAuth authentication systems are structured as follows::
|
||||
|
||||
[ MS Active Directory or other federated LDAP user store ]
|
||||
--> backends to…
|
||||
[ SUN Identity Manager or other SAML Policy Controller ]
|
||||
--> maps URLs to groups…
|
||||
[ Apache Policy Agent in front of eAuth-secured Web Application ]
|
||||
|
||||
In more ideal implementations, the remainder of the application-specific account information is stored either in extended schema on the LDAP server itself, via the use of a translucent LDAP proxy, or in an independent datastore keyed off of the UID provided via SAML assertion.
|
||||
|
||||
Basic AWS API call structure
|
||||
----------------------------
|
||||
|
||||
AWS API calls are traditionally secured via Access and Secret Keys, which are used to sign API calls, along with traditional timestamps to prevent replay attacks. The APIs can be logically grouped into sets that align with five typical roles:
|
||||
|
||||
* System User
|
||||
* System Administrator
|
||||
* Network Administrator
|
||||
* Project Manager
|
||||
* Cloud Administrator
|
||||
* (IT-Sec?)
|
||||
|
||||
There is an additional, conceptual end-user that may or may not have API access:
|
||||
|
||||
* (EXTERNAL) End-user / Third-party User
|
||||
|
||||
Basic operations are available to any System User:
|
||||
|
||||
* Launch Instance
|
||||
* Terminate Instance (their own)
|
||||
* Create keypair
|
||||
* Delete keypair
|
||||
* Create, Upload, Delete: Buckets and Keys (Object Store) – their own
|
||||
* Create, Attach, Delete Volume (Block Store) – their own
|
||||
|
||||
System Administrators:
|
||||
|
||||
* Register/Unregister Machine Image (project-wide)
|
||||
* Change Machine Image properties (public / private)
|
||||
* Request / Review CloudAudit Scans
|
||||
|
||||
Network Administrator:
|
||||
|
||||
* Change Firewall Rules, define Security Groups
|
||||
* Allocate, Associate, Deassociate Public IP addresses
|
||||
|
||||
Project Manager:
|
||||
|
||||
* Launch and Terminate Instances (project-wide)
|
||||
* CRUD of Object and Block store (project-wide)
|
||||
|
||||
Cloud Administrator:
|
||||
|
||||
* Register / Unregister Kernel and Ramdisk Images
|
||||
* Register / Unregister Machine Image (any)
|
||||
|
||||
Enhancements
|
||||
------------
|
||||
|
||||
* SAML Token passing
|
||||
* REST interfaces
|
||||
* SOAP interfaces
|
||||
|
||||
Wrapping the SAML token into the API calls.
|
||||
Then store the UID (fetched via backchannel) into the instance metadata, providing end-to-end auditability of ownership and responsibility, without PII.
|
||||
|
||||
CloudAudit APIs
|
||||
---------------
|
||||
|
||||
* Request formats
|
||||
* Response formats
|
||||
* Stateless asynchronous queries
|
||||
|
||||
CloudAudit queries may spawn long-running processes (similar to launching instances, etc.) They need to return a ReservationId in the same fashion, which can be returned in further queries for updates.
|
||||
RBAC of CloudAudit API calls is critical, since detailed system information is a system vulnerability.
|
||||
|
||||
Type declarations
|
||||
---------------------
|
||||
* Data declarations – Volumes and Objects
|
||||
* System declarations – Instances
|
||||
|
||||
Existing API calls to launch instances specific a single, combined “type” flag. We propose to extend this with three additional type declarations, mapping to the “Confidentiality, Integrity, Availability” classifications of FIPS 199. An example API call would look like::
|
||||
|
||||
RunInstances type=m1.large number=1 secgroup=default key=mykey confidentiality=low integrity=low availability=low
|
||||
|
||||
These additional parameters would also apply to creation of block storage volumes (along with the existing parameter of ‘size’), and creation of object storage ‘buckets’. (C.I.A. classifications on a bucket would be inherited by the keys within this bucket.)
|
||||
|
||||
Request Brokering
|
||||
-----------------
|
||||
|
||||
* Cloud Interop
|
||||
* IMF Registration / PubSub
|
||||
* Digital C&A
|
||||
|
||||
Establishing declarative semantics for individual API calls will allow the cloud environment to seamlessly proxy these API calls to external, third-party vendors – when the requested CIA levels match.
|
||||
|
||||
See related work within the Infrastructure 2.0 working group for more information on how the IMF Metadata specification could be utilized to manage registration of these vendors and their C&A credentials.
|
||||
|
||||
Dirty Cloud – Hybrid Data Centers
|
||||
---------------------------------
|
||||
|
||||
* CloudAudit bridge interfaces
|
||||
* Anything in the ARP table
|
||||
|
||||
A hybrid cloud environment provides dedicated, potentially co-located physical hardware with a network interconnect to the project or users’ cloud virtual network.
|
||||
|
||||
This interconnect is typically a bridged VPN connection. Any machines that can be bridged into a hybrid environment in this fashion (at Layer 2) must implement a minimum version of the CloudAudit spec, such that they can be queried to provide a complete picture of the IT-sec runtime environment.
|
||||
|
||||
Network discovery protocols (ARP, CDP) can be applied in this case, and existing protocols (SNMP location data, DNS LOC records) overloaded to provide CloudAudit information.
|
||||
|
||||
The Details
|
||||
-----------
|
||||
|
||||
* Preliminary Roles Definitions
|
||||
* Categorization of available API calls
|
||||
* SAML assertion vocabulary
|
||||
|
||||
System limits
|
||||
-------------
|
||||
|
||||
The following limits need to be defined and enforced:
|
||||
|
||||
* Total number of instances allowed (user / project)
|
||||
* Total number of instances, per instance type (user / project)
|
||||
* Total number of volumes (user / project)
|
||||
* Maximum size of volume
|
||||
* Cumulative size of all volumes
|
||||
* Total use of object storage (GB)
|
||||
* Total number of Public IPs
|
||||
|
||||
|
||||
Further Challenges
|
||||
------------------
|
||||
* Prioritization of users / jobs in shared computing environments
|
||||
* Incident response planning
|
||||
* Limit launch of instances to specific security groups based on AMI
|
||||
* Store AMIs in LDAP for added property control
|
||||
|
||||
|
||||
|
||||
The :mod:`access` Module
|
||||
--------------------------
|
||||
|
||||
.. automodule:: nova.auth.access
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`signer` Module
|
||||
------------------------
|
||||
|
||||
.. automodule:: nova.auth.signer
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`users` Module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: nova.auth.users
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`users_unittest` Module
|
||||
--------------------------------
|
||||
|
||||
.. automodule:: nova.tests.users_unittest
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`access_unittest` Module
|
||||
---------------------------------
|
||||
|
||||
.. automodule:: nova.tests.access_unittest
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
29
docs/binaries.rst
Normal file
29
docs/binaries.rst
Normal file
@ -0,0 +1,29 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Nova Binaries
|
||||
===============
|
||||
|
||||
* nova-api
|
||||
* nova-compute
|
||||
* nova-manage
|
||||
* nova-objectstore
|
||||
* nova-volume
|
||||
|
||||
The configuration of these binaries relies on "flagfiles" using the google
|
||||
gflags package. If present, the nova.conf file will be used as the flagfile
|
||||
- otherwise, it must be specified on the command line::
|
||||
|
||||
$ python node_worker.py --flagfile flagfile
|
72
docs/compute.rst
Normal file
72
docs/compute.rst
Normal file
@ -0,0 +1,72 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Compute Documentation
|
||||
=====================
|
||||
|
||||
This page contains the Compute Package documentation.
|
||||
|
||||
|
||||
The :mod:`disk` Module
|
||||
----------------------
|
||||
|
||||
.. automodule:: nova.compute.disk
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`exception` Module
|
||||
---------------------------
|
||||
|
||||
.. automodule:: nova.compute.exception
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`model` Module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: nova.compute.model
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`network` Module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: nova.compute.network
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`node` Module
|
||||
----------------------
|
||||
|
||||
.. automodule:: nova.compute.node
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
RELATED TESTS
|
||||
---------------
|
||||
|
||||
The :mod:`node_unittest` Module
|
||||
-------------------------------
|
||||
|
||||
.. automodule:: nova.tests.node_unittest
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
202
docs/conf.py
Normal file
202
docs/conf.py
Normal file
@ -0,0 +1,202 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# nova documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sat May 1 15:17:47 2010.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.append(os.path.abspath('.'))
|
||||
sys.path.append([os.path.abspath('../nova'),os.path.abspath('../'),os.path.abspath('../vendor')])
|
||||
from nova import vendor
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig']
|
||||
#sphinx_to_github = False
|
||||
todo_include_todos = True
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'nova'
|
||||
copyright = u'2010, Anso Labs, LLC'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.42'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.42'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of documents that shouldn't be included in the build.
|
||||
#unused_docs = []
|
||||
|
||||
# List of directories, relative to source directory, that shouldn't be searched
|
||||
# for source files.
|
||||
exclude_trees = ['_build']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
modindex_common_prefix = ['nova.']
|
||||
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. Major themes that come with
|
||||
# Sphinx are currently 'default' and 'sphinxdoc'.
|
||||
html_theme = 'default'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_use_modindex = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = ''
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'novadoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
|
||||
# The paper size ('letter' or 'a4').
|
||||
#latex_paper_size = 'letter'
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#latex_font_size = '10pt'
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'nova.tex', u'nova Documentation',
|
||||
u'Anso Labs, LLC', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#latex_preamble = ''
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_use_modindex = True
|
||||
|
||||
|
||||
# Example configuration for intersphinx: refer to the Python standard library.
|
||||
intersphinx_mapping = {'http://docs.python.org/': None}
|
89
docs/endpoint.rst
Normal file
89
docs/endpoint.rst
Normal file
@ -0,0 +1,89 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Endpoint Documentation
|
||||
======================
|
||||
|
||||
This page contains the Endpoint Package documentation.
|
||||
|
||||
The :mod:`admin` Module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: nova.endpoint.admin
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`api` Module
|
||||
---------------------
|
||||
|
||||
.. automodule:: nova.endpoint.api
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`cloud` Module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: nova.endpoint.cloud
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`images` Module
|
||||
------------------------
|
||||
|
||||
.. automodule:: nova.endpoint.images
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
RELATED TESTS
|
||||
--------------
|
||||
|
||||
The :mod:`api_unittest` Module
|
||||
------------------------------
|
||||
|
||||
.. automodule:: nova.tests.api_unittest
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`api_integration` Module
|
||||
---------------------------------
|
||||
|
||||
.. automodule:: nova.tests.api_integration
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`cloud_unittest` Module
|
||||
--------------------------------
|
||||
|
||||
.. automodule:: nova.tests.cloud_unittest
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`network_unittest` Module
|
||||
----------------------------------
|
||||
|
||||
.. automodule:: nova.tests.network_unittest
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
41
docs/fakes.rst
Normal file
41
docs/fakes.rst
Normal file
@ -0,0 +1,41 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Nova Fakes
|
||||
==========
|
||||
|
||||
The :mod:`fakevirt` Module
|
||||
--------------------------
|
||||
|
||||
.. automodule:: nova.fakevirt
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`fakeldap` Module
|
||||
--------------------------
|
||||
|
||||
.. automodule:: nova.auth.fakeldap
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`fakerabbit` Module
|
||||
----------------------------
|
||||
|
||||
.. automodule:: nova.fakerabbit
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
70
docs/getting.started.rst
Normal file
70
docs/getting.started.rst
Normal file
@ -0,0 +1,70 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Getting Started with Nova
|
||||
=========================
|
||||
|
||||
|
||||
GOTTA HAVE A nova.pth file added or it WONT WORK (will write setup.py file soon)
|
||||
|
||||
DEPENDENCIES
|
||||
------------
|
||||
|
||||
* RabbitMQ: messaging queue, used for all communication between components
|
||||
* OpenLDAP: users, groups (maybe cut)
|
||||
* Tornado: scalable non blocking web server for api requests
|
||||
* Twisted: just for the twisted.internet.defer package
|
||||
* boto: python api for aws api
|
||||
* M2Crypto: python library interface for openssl
|
||||
* IPy: library for managing ip addresses
|
||||
* ReDIS: Remote Dictionary Store (for fast, shared state data)
|
||||
|
||||
Recommended
|
||||
-----------------
|
||||
* euca2ools: python implementation of aws ec2-tools and ami tools
|
||||
* build tornado to use C module for evented section
|
||||
|
||||
|
||||
Installation
|
||||
--------------
|
||||
::
|
||||
|
||||
# ON ALL SYSTEMS
|
||||
apt-get install -y python-libvirt libvirt-bin python-setuptools python-dev python-pycurl python-m2crypto python-twisted
|
||||
apt-get install -y aoetools vlan
|
||||
modprobe aoe
|
||||
|
||||
# ON THE CLOUD CONTROLLER
|
||||
apt-get install -y rabbitmq-server dnsmasq
|
||||
# fix ec2 metadata/userdata uri - where $IP is the IP of the cloud
|
||||
iptables -t nat -A PREROUTING -s 0.0.0.0/0 -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination $IP:8773
|
||||
iptables --table nat --append POSTROUTING --out-interface $PUBLICIFACE -j MASQUERADE
|
||||
# setup ldap (slap.sh as root will remove ldap and reinstall it)
|
||||
auth/slap.sh
|
||||
/etc/init.d/rabbitmq-server start
|
||||
|
||||
# ON VOLUME NODE:
|
||||
apt-get install -y vblade-persist
|
||||
|
||||
# ON THE COMPUTE NODE:
|
||||
apt-get install -y kpartx kvm
|
||||
|
||||
# optional packages
|
||||
apt-get install -y euca2ools
|
||||
|
||||
# Set up flagfiles with the appropriate hostnames, etc.
|
||||
# start api_worker, s3_worker, node_worker, storage_worker
|
||||
# Add yourself to the libvirtd group, log out, and log back in
|
||||
# Make sure the user who will launch the workers has sudo privileges w/o pass (will fix later)
|
53
docs/index.rst
Normal file
53
docs/index.rst
Normal file
@ -0,0 +1,53 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
Welcome to nova's documentation!
|
||||
================================
|
||||
|
||||
Nova is a cloud computing fabric controller (the main part of an IaaS system) built to match the popular AWS EC2 and S3 APIs.
|
||||
It is written in Python, using the Tornado and Twisted frameworks, and relies on the standard AMQP messaging protocol,
|
||||
and the Redis distributed KVS.
|
||||
Nova is intended to be easy to extend, and adapt. For example, it currently uses
|
||||
an LDAP server for users and groups, but also includes a fake LDAP server,
|
||||
that stores data in Redis. It has extensive test coverage, and uses the
|
||||
Sphinx toolkit (the same as Python itself) for code and user documentation.
|
||||
While Nova is currently in Beta use within several organizations, the codebase
|
||||
is very much under active development - there are bugs!
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
getting.started
|
||||
architecture
|
||||
network
|
||||
storage
|
||||
auth
|
||||
compute
|
||||
endpoint
|
||||
nova
|
||||
fakes
|
||||
binaries
|
||||
todo
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
32
docs/modules.rst
Normal file
32
docs/modules.rst
Normal file
@ -0,0 +1,32 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Nova Documentation
|
||||
==================
|
||||
|
||||
This page contains the Nova Modules documentation.
|
||||
|
||||
Modules:
|
||||
--------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
auth
|
||||
compute
|
||||
endpoint
|
||||
fakes
|
||||
nova
|
||||
volume
|
86
docs/network.rst
Normal file
86
docs/network.rst
Normal file
@ -0,0 +1,86 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
nova Networking
|
||||
================
|
||||
|
||||
The nova networking components manage private networks, public IP addressing, VPN connectivity, and firewall rules.
|
||||
|
||||
Components
|
||||
----------
|
||||
There are several key components:
|
||||
|
||||
* NetworkController (Manages address and vlan allocation)
|
||||
* RoutingNode (NATs public IPs to private IPs, and enforces firewall rules)
|
||||
* AddressingNode (runs DHCP services for private networks)
|
||||
* BridgingNode (a subclass of the basic nova ComputeNode)
|
||||
* TunnelingNode (provides VPN connectivity)
|
||||
|
||||
Component Diagram
|
||||
-----------------
|
||||
|
||||
Overview::
|
||||
|
||||
(PUBLIC INTERNET)
|
||||
| \
|
||||
/ \ / \
|
||||
[RoutingNode] ... [RN] [TunnelingNode] ... [TN]
|
||||
| \ / | |
|
||||
| < AMQP > | |
|
||||
[AddressingNode]-- (VLAN) ... | (VLAN)... (VLAN) --- [AddressingNode]
|
||||
\ | \ /
|
||||
/ \ / \ / \ / \
|
||||
[BridgingNode] ... [BridgingNode]
|
||||
|
||||
|
||||
[NetworkController] ... [NetworkController]
|
||||
\ /
|
||||
< AMQP >
|
||||
|
|
||||
/ \
|
||||
[CloudController]...[CloudController]
|
||||
|
||||
While this diagram may not make this entirely clear, nodes and controllers communicate exclusively across the message bus (AMQP, currently).
|
||||
|
||||
State Model
|
||||
-----------
|
||||
Network State consists of the following facts:
|
||||
|
||||
* VLAN assignment (to a project)
|
||||
* Private Subnet assignment (to a security group) in a VLAN
|
||||
* Private IP assignments (to running instances)
|
||||
* Public IP allocations (to a project)
|
||||
* Public IP associations (to a private IP / running instance)
|
||||
|
||||
While copies of this state exist in many places (expressed in IPTables rule chains, DHCP hosts files, etc), the controllers rely only on the distributed "fact engine" for state, queried over RPC (currently AMQP). The NetworkController inserts most records into this datastore (allocating addresses, etc) - however, individual nodes update state e.g. when running instances crash.
|
||||
|
||||
The Public Traffic Path
|
||||
-----------------------
|
||||
|
||||
Public Traffic::
|
||||
|
||||
(PUBLIC INTERNET)
|
||||
|
|
||||
<NAT> <-- [RoutingNode]
|
||||
|
|
||||
[AddressingNode] --> |
|
||||
( VLAN )
|
||||
| <-- [BridgingNode]
|
||||
|
|
||||
<RUNNING INSTANCE>
|
||||
|
||||
The RoutingNode is currently implemented using IPTables rules, which implement both NATing of public IP addresses, and the appropriate firewall chains. We are also looking at using Netomata / Clusto to manage NATting within a switch or router, and/or to manage firewall rules within a hardware firewall appliance.
|
||||
|
||||
Similarly, the AddressingNode currently manages running DNSMasq instances for DHCP services. However, we could run an internal DHCP server (using Scapy ala Clusto), or even switch to static addressing by inserting the private address into the disk image the same way we insert the SSH keys. (See compute for more details).
|
89
docs/nova.rst
Normal file
89
docs/nova.rst
Normal file
@ -0,0 +1,89 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
NOVA Libraries
|
||||
===============
|
||||
|
||||
The :mod:`crypto` Module
|
||||
------------------------
|
||||
|
||||
.. automodule:: nova.crypto
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`adminclient` Module
|
||||
-----------------------------
|
||||
|
||||
.. automodule:: nova.adminclient
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`datastore` Module
|
||||
---------------------------
|
||||
|
||||
.. automodule:: nova.datastore
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`exception` Module
|
||||
---------------------------
|
||||
|
||||
.. automodule:: nova.exception
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`flags` Module
|
||||
---------------------------
|
||||
|
||||
.. automodule:: nova.flags
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`rpc` Module
|
||||
---------------------------
|
||||
|
||||
.. automodule:: nova.rpc
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`server` Module
|
||||
---------------------------
|
||||
|
||||
.. automodule:: nova.server
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`test` Module
|
||||
---------------------------
|
||||
|
||||
.. automodule:: nova.test
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`utils` Module
|
||||
---------------------------
|
||||
|
||||
.. automodule:: nova.utils
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
64
docs/objectstore.rst
Normal file
64
docs/objectstore.rst
Normal file
@ -0,0 +1,64 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Objectstore Documentation
|
||||
=========================
|
||||
|
||||
This page contains the Objectstore Package documentation.
|
||||
|
||||
|
||||
The :mod:`bucket` Module
|
||||
------------------------
|
||||
|
||||
.. automodule:: nova.objectstore.bucket
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`handler` Module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: nova.objectstore.handler
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`image` Module
|
||||
-----------------------
|
||||
|
||||
.. automodule:: nova.objectstore.image
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`stored` Module
|
||||
------------------------
|
||||
|
||||
.. automodule:: nova.objectstore.stored
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
RELATED TESTS
|
||||
-------------
|
||||
|
||||
The :mod:`objectstore_unittest` Module
|
||||
--------------------------------------
|
||||
|
||||
.. automodule:: nova.tests.objectstore_unittest
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
27
docs/packages.rst
Normal file
27
docs/packages.rst
Normal file
@ -0,0 +1,27 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
nova Packages & Dependencies
|
||||
============================
|
||||
|
||||
Nova is being built on Ubuntu Lucid.
|
||||
|
||||
The following packages are required:
|
||||
|
||||
apt-get install python-ipy, python-libvirt, python-boto, python-pycurl, python-twisted, python-daemon, python-redis, python-carrot, python-lockfile
|
||||
|
||||
In addition you need to install python:
|
||||
|
||||
* python-gflags - http://code.google.com/p/python-gflags/
|
29
docs/storage.rst
Normal file
29
docs/storage.rst
Normal file
@ -0,0 +1,29 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Storage in the Nova Cloud
|
||||
=========================
|
||||
|
||||
There are three primary classes of storage in a nova cloud environment:
|
||||
|
||||
* Ephemeral Storage (local disk within an instance)
|
||||
* Volume Storage (network-attached FS)
|
||||
* Object Storage (redundant KVS with locality and MR)
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
volume
|
||||
objectstore
|
43
docs/volume.rst
Normal file
43
docs/volume.rst
Normal file
@ -0,0 +1,43 @@
|
||||
..
|
||||
Copyright [2010] [Anso Labs, LLC]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Volume Documentation
|
||||
====================
|
||||
|
||||
Nova uses ata-over-ethernet (AoE) to export storage volumes from multiple storage nodes. These AoE exports are attached (using libvirt) directly to running instances.
|
||||
|
||||
Nova volumes are exported over the primary system VLAN (usually VLAN 1), and not over individual VLANs.
|
||||
|
||||
AoE exports are numbered according to a "shelf and blade" syntax. In order to avoid collisions, we currently perform an AoE-discover of existing exports, and then grab the next unused number. (This obviously has race condition problems, and should be replaced by allocating a shelf-id to each storage node.)
|
||||
|
||||
The underlying volumes are LVM logical volumes, created on demand within a single large volume group.
|
||||
|
||||
|
||||
The :mod:`storage` Module
|
||||
-------------------------
|
||||
|
||||
.. automodule:: nova.volume.storage
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
The :mod:`storage_unittest` Module
|
||||
----------------------------------
|
||||
|
||||
.. automodule:: nova.tests.storage_unittest
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
99
run_tests.py
Normal file
99
run_tests.py
Normal file
@ -0,0 +1,99 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
# Copyright [2010] [Anso Labs, LLC]
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
This is our basic test running framework based on Twisted's Trial.
|
||||
|
||||
Usage Examples:
|
||||
|
||||
# to run all the tests
|
||||
python run_tests.py
|
||||
|
||||
# to run a specific test suite imported here
|
||||
python run_tests.py NodeConnectionTestCase
|
||||
|
||||
# to run a specific test imported here
|
||||
python run_tests.py NodeConnectionTestCase.test_reboot
|
||||
|
||||
# to run some test suites elsewhere
|
||||
python run_tests.py nova.tests.node_unittest
|
||||
python run_tests.py nova.tests.node_unittest.NodeConnectionTestCase
|
||||
|
||||
Due to our use of multiprocessing it we frequently get some ignorable
|
||||
'Interrupted system call' exceptions after test completion.
|
||||
|
||||
"""
|
||||
import __main__
|
||||
import sys
|
||||
|
||||
from nova import vendor
|
||||
from twisted.scripts import trial as trial_script
|
||||
|
||||
from nova import flags
|
||||
from nova import twistd
|
||||
|
||||
from nova.tests.access_unittest import *
|
||||
from nova.tests.api_unittest import *
|
||||
from nova.tests.cloud_unittest import *
|
||||
from nova.tests.keeper_unittest import *
|
||||
from nova.tests.network_unittest import *
|
||||
from nova.tests.node_unittest import *
|
||||
from nova.tests.objectstore_unittest import *
|
||||
from nova.tests.storage_unittest import *
|
||||
from nova.tests.users_unittest import *
|
||||
from nova.tests.datastore_unittest import *
|
||||
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
OptionsClass = twistd.WrapTwistedOptions(trial_script.Options)
|
||||
config = OptionsClass()
|
||||
argv = config.parseOptions()
|
||||
|
||||
FLAGS.verbose = True
|
||||
|
||||
# TODO(termie): these should make a call instead of doing work on import
|
||||
if FLAGS.fake_tests:
|
||||
from nova.tests.fake_flags import *
|
||||
else:
|
||||
from nova.tests.real_flags import *
|
||||
|
||||
if len(argv) == 1 and len(config['tests']) == 0:
|
||||
# If no tests were specified run the ones imported in this file
|
||||
# NOTE(termie): "tests" is not a flag, just some Trial related stuff
|
||||
config['tests'].update(['__main__'])
|
||||
elif len(config['tests']):
|
||||
# If we specified tests check first whether they are in __main__
|
||||
for arg in config['tests']:
|
||||
key = arg.split('.')[0]
|
||||
if hasattr(__main__, key):
|
||||
config['tests'].remove(arg)
|
||||
config['tests'].add('__main__.%s' % arg)
|
||||
|
||||
trial_script._initialDebugSetup(config)
|
||||
trialRunner = trial_script._makeRunner(config)
|
||||
suite = trial_script._getSuite(config)
|
||||
if config['until-failure']:
|
||||
test_result = trialRunner.runUntilFailure(suite)
|
||||
else:
|
||||
test_result = trialRunner.run(suite)
|
||||
if config.tracer:
|
||||
sys.settrace(None)
|
||||
results = config.tracer.results()
|
||||
results.write_results(show_missing=1, summary=False,
|
||||
coverdir=config.coverdir)
|
||||
sys.exit(not test_result.wasSuccessful())
|
32
setup.py
Normal file
32
setup.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright [2010] [Anso Labs, LLC]
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
srcdir = os.path.join(os.path.dirname(sys.argv[0]), 'src')
|
||||
|
||||
setup(name='nova',
|
||||
version='0.3.0',
|
||||
description='None Other, Vaguely Awesome',
|
||||
author='nova-core',
|
||||
author_email='nova-core@googlegroups.com',
|
||||
url='http://novacc.org/',
|
||||
packages = find_packages(),
|
||||
|
||||
)
|
1304
vendor/IPy.py
vendored
Normal file
1304
vendor/IPy.py
vendored
Normal file
File diff suppressed because it is too large
Load Diff
32
vendor/Twisted-10.0.0/INSTALL
vendored
Normal file
32
vendor/Twisted-10.0.0/INSTALL
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
Requirements
|
||||
|
||||
Python 2.4, 2.5 or 2.6.
|
||||
|
||||
Zope Interfaces 3.0.1 (http://zope.org/Products/ZopeInterface) - if
|
||||
you have ZopeX3 (at least version 3.0.0c1) installed that should
|
||||
work too.
|
||||
|
||||
On Windows pywin32 is recommended (this is built in to ActivePython,
|
||||
so no need to reinstall if you use it instead of standard Python)
|
||||
http://sourceforge.net/project/showfiles.php?group_id=78018
|
||||
The Windows IOCP reactor requires pywin32 build 205 or later.
|
||||
|
||||
If you would like to use Trial's subunit reporter, then you will need to
|
||||
install Subunit 0.0.2 or later (https://launchpad.net/subunit).
|
||||
|
||||
Installation
|
||||
|
||||
* Debian and Ubuntu
|
||||
Packages are included in the main distribution.
|
||||
|
||||
* FreeBSD, Gentoo
|
||||
Twisted is in their package repositories.
|
||||
|
||||
* Win32
|
||||
EXEs are available from http://twistedmatrix.com/
|
||||
|
||||
* Other
|
||||
As with other Python packages, the standard way of installing from source
|
||||
is:
|
||||
|
||||
python setup.py install
|
57
vendor/Twisted-10.0.0/LICENSE
vendored
Normal file
57
vendor/Twisted-10.0.0/LICENSE
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
Copyright (c) 2001-2010
|
||||
Allen Short
|
||||
Andy Gayton
|
||||
Andrew Bennetts
|
||||
Antoine Pitrou
|
||||
Apple Computer, Inc.
|
||||
Benjamin Bruheim
|
||||
Bob Ippolito
|
||||
Canonical Limited
|
||||
Christopher Armstrong
|
||||
David Reid
|
||||
Donovan Preston
|
||||
Eric Mangold
|
||||
Eyal Lotem
|
||||
Itamar Shtull-Trauring
|
||||
James Knight
|
||||
Jason A. Mobarak
|
||||
Jean-Paul Calderone
|
||||
Jessica McKellar
|
||||
Jonathan Jacobs
|
||||
Jonathan Lange
|
||||
Jonathan D. Simms
|
||||
Jürgen Hermann
|
||||
Kevin Horn
|
||||
Kevin Turner
|
||||
Mary Gardiner
|
||||
Matthew Lefkowitz
|
||||
Massachusetts Institute of Technology
|
||||
Moshe Zadka
|
||||
Paul Swartz
|
||||
Pavel Pergamenshchik
|
||||
Ralph Meijer
|
||||
Sean Riley
|
||||
Software Freedom Conservancy
|
||||
Travis B. Hartwell
|
||||
Thijs Triemstra
|
||||
Thomas Herve
|
||||
Timothy Allen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1416
vendor/Twisted-10.0.0/NEWS
vendored
Normal file
1416
vendor/Twisted-10.0.0/NEWS
vendored
Normal file
File diff suppressed because it is too large
Load Diff
118
vendor/Twisted-10.0.0/README
vendored
Normal file
118
vendor/Twisted-10.0.0/README
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
Twisted 10.0.0
|
||||
|
||||
Quote of the Release:
|
||||
|
||||
[on picking the quote of the release]
|
||||
<glyph> Man, we're going to have to get a lot funnier if we're going
|
||||
to do time-based releases
|
||||
|
||||
|
||||
For information on what's new in Twisted 10.0.0, see the NEWS file that comes
|
||||
with the distribution.
|
||||
|
||||
What is this?
|
||||
=============
|
||||
|
||||
Twisted is an event-based framework for internet applications which works on
|
||||
Python 2.4 through 2.6. The following are some of the modules included
|
||||
with Twisted::
|
||||
|
||||
- twisted.application
|
||||
A "Service" system that allows you to organize your application in
|
||||
hierarchies with well-defined startup and dependency semantics,
|
||||
- twisted.cred
|
||||
A general credentials and authentication system that facilitates
|
||||
pluggable authentication backends,
|
||||
- twisted.enterprise
|
||||
Asynchronous database access, compatible with any Python DBAPI2.0
|
||||
modules,
|
||||
- twisted.internet
|
||||
Low-level asynchronous networking APIs that allow you to define
|
||||
your own protocols that run over certain transports,
|
||||
- twisted.manhole
|
||||
A tool for remote debugging of your services which gives you a
|
||||
Python interactive interpreter,
|
||||
- twisted.protocols
|
||||
Basic protocol implementations and helpers for your own protocol
|
||||
implementations,
|
||||
- twisted.python
|
||||
A large set of utilities for Python tricks, reflection, text
|
||||
processing, and anything else,
|
||||
- twisted.spread
|
||||
A secure, fast remote object system,
|
||||
- twisted.trial
|
||||
A unit testing framework that integrates well with Twisted-based code.
|
||||
|
||||
Twisted supports integration of the Tk, GTK+, GTK+ 2, Qt, Mac OS X,
|
||||
or wxPython event loop with its main event loop. The Win32 event
|
||||
loop is also supported.
|
||||
|
||||
For more information, visit http://www.twistedmatrix.com, or join the list
|
||||
at http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
|
||||
|
||||
There are many official Twisted subprojects, including clients and
|
||||
servers for web, mail, DNS, and more. You can find out more about
|
||||
these projects at http://twistedmatrix.com/trac/wiki/TwistedProjects
|
||||
|
||||
|
||||
Installing
|
||||
==========
|
||||
|
||||
Instructions for installing this software are in INSTALL.
|
||||
|
||||
Unit Tests
|
||||
==========
|
||||
|
||||
|
||||
See our unit tests run proving that the software is BugFree(TM)::
|
||||
|
||||
% trial twisted
|
||||
|
||||
Some of these tests may fail if you
|
||||
* don't have the dependancies required for a particular subsystem installed,
|
||||
* have a firewall blocking some ports (or things like Multicast, which Linux
|
||||
NAT has shown itself to do), or
|
||||
* run them as root.
|
||||
|
||||
|
||||
Documentation and Support
|
||||
=========================
|
||||
|
||||
Examples on how to use Twisted APIs are located in doc/examples;
|
||||
this might ease the learning curve a little bit, since all these
|
||||
files are kept as short as possible. The file doc/howto/index.xhtml
|
||||
contains an index of all the HOWTOs: this should be your starting
|
||||
point when looking for documentation.
|
||||
|
||||
Help is available on the Twisted mailing list::
|
||||
|
||||
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
|
||||
|
||||
There is also a very lively IRC channel, #twisted, on
|
||||
irc.freenode.net.
|
||||
|
||||
|
||||
Copyright
|
||||
=========
|
||||
|
||||
All of the code in this distribution is Copyright (c) 2001-2010
|
||||
Twisted Matrix Laboratories.
|
||||
|
||||
Twisted is made available under the MIT license. The included
|
||||
LICENSE file describes this in detail.
|
||||
|
||||
|
||||
Warranty
|
||||
========
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE USE OF THIS SOFTWARE IS WITH YOU.
|
||||
|
||||
IN NO EVENT WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY, BE LIABLE TO YOU FOR ANY DAMAGES, EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
Again, see the included LICENSE file for specific legal details.
|
BIN
vendor/Twisted-10.0.0/bin/.twistd.swp
vendored
Normal file
BIN
vendor/Twisted-10.0.0/bin/.twistd.swp
vendored
Normal file
Binary file not shown.
20
vendor/Twisted-10.0.0/bin/conch/cftp
vendored
Executable file
20
vendor/Twisted-10.0.0/bin/conch/cftp
vendored
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os
|
||||
path = os.path.abspath(sys.argv[0])
|
||||
while os.path.dirname(path) != path:
|
||||
if os.path.basename(path).startswith('Twisted'):
|
||||
sys.path.insert(0, path)
|
||||
break
|
||||
path = os.path.dirname(path)
|
||||
### end of preamble
|
||||
|
||||
from twisted.conch.scripts.cftp import run
|
||||
run()
|
20
vendor/Twisted-10.0.0/bin/conch/ckeygen
vendored
Executable file
20
vendor/Twisted-10.0.0/bin/conch/ckeygen
vendored
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os
|
||||
path = os.path.abspath(sys.argv[0])
|
||||
while os.path.dirname(path) != path:
|
||||
if os.path.basename(path).startswith('Twisted'):
|
||||
sys.path.insert(0, path)
|
||||
break
|
||||
path = os.path.dirname(path)
|
||||
### end of preamble
|
||||
|
||||
from twisted.conch.scripts.ckeygen import run
|
||||
run()
|
20
vendor/Twisted-10.0.0/bin/conch/conch
vendored
Executable file
20
vendor/Twisted-10.0.0/bin/conch/conch
vendored
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os
|
||||
path = os.path.abspath(sys.argv[0])
|
||||
while os.path.dirname(path) != path:
|
||||
if os.path.basename(path).startswith('Twisted'):
|
||||
sys.path.insert(0, path)
|
||||
break
|
||||
path = os.path.dirname(path)
|
||||
### end of preamble
|
||||
|
||||
from twisted.conch.scripts.conch import run
|
||||
run()
|
20
vendor/Twisted-10.0.0/bin/conch/tkconch
vendored
Executable file
20
vendor/Twisted-10.0.0/bin/conch/tkconch
vendored
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os
|
||||
path = os.path.abspath(sys.argv[0])
|
||||
while os.path.dirname(path) != path:
|
||||
if os.path.basename(path).startswith('Twisted'):
|
||||
sys.path.insert(0, path)
|
||||
break
|
||||
path = os.path.dirname(path)
|
||||
### end of preamble
|
||||
|
||||
from twisted.conch.scripts.tkconch import run
|
||||
run()
|
21
vendor/Twisted-10.0.0/bin/lore/lore
vendored
Executable file
21
vendor/Twisted-10.0.0/bin/lore/lore
vendored
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os
|
||||
path = os.path.abspath(sys.argv[0])
|
||||
while os.path.dirname(path) != path:
|
||||
if os.path.basename(path).startswith('Twisted'):
|
||||
sys.path.insert(0, path)
|
||||
break
|
||||
path = os.path.dirname(path)
|
||||
### end of preamble
|
||||
|
||||
from twisted.lore.scripts.lore import run
|
||||
run()
|
||||
|
25
vendor/Twisted-10.0.0/bin/mail/mailmail
vendored
Executable file
25
vendor/Twisted-10.0.0/bin/mail/mailmail
vendored
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
"""
|
||||
This script attempts to send some email.
|
||||
"""
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os
|
||||
path = os.path.abspath(sys.argv[0])
|
||||
while os.path.dirname(path) != path:
|
||||
if os.path.basename(path).startswith('Twisted'):
|
||||
sys.path.insert(0, path)
|
||||
break
|
||||
path = os.path.dirname(path)
|
||||
### end of preamble
|
||||
|
||||
from twisted.mail.scripts import mailmail
|
||||
mailmail.run()
|
||||
|
21
vendor/Twisted-10.0.0/bin/manhole
vendored
Executable file
21
vendor/Twisted-10.0.0/bin/manhole
vendored
Executable file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
"""
|
||||
This script runs GtkManhole, a client for Twisted.Manhole
|
||||
"""
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os, string
|
||||
if string.find(os.path.abspath(sys.argv[0]), os.sep+'Twisted') != -1:
|
||||
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)))
|
||||
### end of preamble
|
||||
|
||||
|
||||
from twisted.scripts import manhole
|
||||
manhole.run()
|
18
vendor/Twisted-10.0.0/bin/mktap
vendored
Executable file
18
vendor/Twisted-10.0.0/bin/mktap
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os, string
|
||||
if string.find(os.path.abspath(sys.argv[0]), os.sep+'Twisted') != -1:
|
||||
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)))
|
||||
if not hasattr(os, "getuid") or os.getuid() != 0:
|
||||
sys.path.insert(0, os.getcwd())
|
||||
### end of preamble
|
||||
|
||||
from twisted.scripts.mktap import run
|
||||
run()
|
||||
|
17
vendor/Twisted-10.0.0/bin/pyhtmlizer
vendored
Executable file
17
vendor/Twisted-10.0.0/bin/pyhtmlizer
vendored
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os, string
|
||||
if string.find(os.path.abspath(sys.argv[0]), os.sep+'Twisted') != -1:
|
||||
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)))
|
||||
sys.path.insert(0, os.curdir)
|
||||
### end of preamble
|
||||
|
||||
from twisted.scripts.htmlizer import run
|
||||
run()
|
20
vendor/Twisted-10.0.0/bin/tap2deb
vendored
Executable file
20
vendor/Twisted-10.0.0/bin/tap2deb
vendored
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
"""
|
||||
tap2deb
|
||||
"""
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os, string
|
||||
if string.find(os.path.abspath(sys.argv[0]), os.sep+'Twisted') != -1:
|
||||
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)))
|
||||
### end of preamble
|
||||
|
||||
from twisted.scripts import tap2deb
|
||||
tap2deb.run()
|
22
vendor/Twisted-10.0.0/bin/tap2rpm
vendored
Executable file
22
vendor/Twisted-10.0.0/bin/tap2rpm
vendored
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
# based off the tap2deb code
|
||||
# tap2rpm built by Sean Reifschneider, <jafo@tummy.com>
|
||||
|
||||
"""
|
||||
tap2rpm
|
||||
"""
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os, string
|
||||
if string.find(os.path.abspath(sys.argv[0]), os.sep+'Twisted') != -1:
|
||||
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)))
|
||||
### end of preamble
|
||||
|
||||
from twisted.scripts import tap2rpm
|
||||
tap2rpm.run()
|
18
vendor/Twisted-10.0.0/bin/tapconvert
vendored
Executable file
18
vendor/Twisted-10.0.0/bin/tapconvert
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os, string
|
||||
if string.find(os.path.abspath(sys.argv[0]), os.sep+'Twisted') != -1:
|
||||
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)))
|
||||
if not hasattr(os, "getuid") or os.getuid() != 0:
|
||||
sys.path.insert(0, os.getcwd())
|
||||
### end of preamble
|
||||
|
||||
from twisted.scripts.tapconvert import run
|
||||
run()
|
22
vendor/Twisted-10.0.0/bin/trial
vendored
Executable file
22
vendor/Twisted-10.0.0/bin/trial
vendored
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os, string
|
||||
if string.find(os.path.abspath(sys.argv[0]), os.sep+'Twisted') != -1:
|
||||
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)))
|
||||
if hasattr(os, "getuid") and os.getuid() != 0:
|
||||
sys.path.insert(0, os.curdir)
|
||||
### end of preamble
|
||||
|
||||
# begin chdir armor
|
||||
sys.path[:] = map(os.path.abspath, sys.path)
|
||||
# end chdir armor
|
||||
|
||||
from twisted.scripts.trial import run
|
||||
run()
|
19
vendor/Twisted-10.0.0/bin/twistd
vendored
Executable file
19
vendor/Twisted-10.0.0/bin/twistd
vendored
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
|
||||
### Twisted Preamble
|
||||
# This makes sure that users don't have to set up their environment
|
||||
# specially in order to run these programs from bin/.
|
||||
import sys, os, string
|
||||
if string.find(os.path.abspath(sys.argv[0]), os.sep+'Twisted') != -1:
|
||||
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)))
|
||||
if hasattr(os, "getuid") and os.getuid() != 0:
|
||||
sys.path.insert(0, os.path.abspath(os.getcwd()))
|
||||
### end of preamble
|
||||
|
||||
|
||||
from twisted.scripts.twistd import run
|
||||
run()
|
15
vendor/Twisted-10.0.0/doc/conch/benchmarks/README
vendored
Normal file
15
vendor/Twisted-10.0.0/doc/conch/benchmarks/README
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
This directory contains various simple programs intended to exercise various
|
||||
features of Twisted Conch as a way to learn about and track their
|
||||
performance characteristics. As there is currently no record of past
|
||||
benchmark results, the tracking aspect of this is currently somewhat
|
||||
fantastic. However, the intent is for this to change at some future point.
|
||||
|
||||
All (one) of the programs in this directory are currently intended to be
|
||||
invoked directly and to report some timing information on standard out.
|
||||
|
||||
The following benchmarks are currently available:
|
||||
|
||||
buffering_mixin.py:
|
||||
|
||||
This deals with twisted.conch.mixin.BufferingMixin which provides
|
||||
Nagle-like write coalescing for Protocol classes.
|
182
vendor/Twisted-10.0.0/doc/conch/benchmarks/buffering_mixin.py
vendored
Executable file
182
vendor/Twisted-10.0.0/doc/conch/benchmarks/buffering_mixin.py
vendored
Executable file
@ -0,0 +1,182 @@
|
||||
# Copyright (c) 2006 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
"""
|
||||
Benchmarks comparing the write performance of a "normal" Protocol instance
|
||||
and an instance of a Protocol class which has had L{twisted.conch.mixin}'s
|
||||
L{BufferingMixin<twisted.conch.mixin.BufferingMixin>} mixed in to perform
|
||||
Nagle-like write coalescing.
|
||||
"""
|
||||
|
||||
from sys import stdout
|
||||
from pprint import pprint
|
||||
from time import time
|
||||
|
||||
from twisted.python.usage import Options
|
||||
from twisted.python.log import startLogging
|
||||
|
||||
from twisted.internet.protocol import ServerFactory, Protocol, ClientCreator
|
||||
from twisted.internet.defer import Deferred
|
||||
from twisted.internet import reactor
|
||||
|
||||
from twisted.conch.mixin import BufferingMixin
|
||||
|
||||
|
||||
class BufferingBenchmark(Options):
|
||||
"""
|
||||
Options for configuring the execution parameters of a benchmark run.
|
||||
"""
|
||||
|
||||
optParameters = [
|
||||
('scale', 's', '1',
|
||||
'Work multiplier (bigger takes longer, might resist noise better)')]
|
||||
|
||||
def postOptions(self):
|
||||
self['scale'] = int(self['scale'])
|
||||
|
||||
|
||||
|
||||
class ServerProtocol(Protocol):
|
||||
"""
|
||||
A silent protocol which only waits for a particular amount of input and
|
||||
then fires a Deferred.
|
||||
"""
|
||||
def __init__(self, expected, finished):
|
||||
self.expected = expected
|
||||
self.finished = finished
|
||||
|
||||
|
||||
def dataReceived(self, bytes):
|
||||
self.expected -= len(bytes)
|
||||
if self.expected == 0:
|
||||
finished, self.finished = self.finished, None
|
||||
finished.callback(None)
|
||||
|
||||
|
||||
|
||||
class BufferingProtocol(Protocol, BufferingMixin):
|
||||
"""
|
||||
A protocol which uses the buffering mixin to provide a write method.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
class UnbufferingProtocol(Protocol):
|
||||
"""
|
||||
A protocol which provides a naive write method which simply passes through
|
||||
to the transport.
|
||||
"""
|
||||
|
||||
def connectionMade(self):
|
||||
"""
|
||||
Bind write to the transport's write method and flush to a no-op
|
||||
function in order to provide the same API as is provided by
|
||||
BufferingProtocol.
|
||||
"""
|
||||
self.write = self.transport.write
|
||||
self.flush = lambda: None
|
||||
|
||||
|
||||
|
||||
def _write(proto, byteCount):
|
||||
write = proto.write
|
||||
flush = proto.flush
|
||||
|
||||
for i in range(byteCount):
|
||||
write('x')
|
||||
flush()
|
||||
|
||||
|
||||
|
||||
def _benchmark(byteCount, clientProtocol):
|
||||
result = {}
|
||||
finished = Deferred()
|
||||
def cbFinished(ignored):
|
||||
result[u'disconnected'] = time()
|
||||
result[u'duration'] = result[u'disconnected'] - result[u'connected']
|
||||
return result
|
||||
finished.addCallback(cbFinished)
|
||||
|
||||
f = ServerFactory()
|
||||
f.protocol = lambda: ServerProtocol(byteCount, finished)
|
||||
server = reactor.listenTCP(0, f)
|
||||
|
||||
f2 = ClientCreator(reactor, clientProtocol)
|
||||
proto = f2.connectTCP('127.0.0.1', server.getHost().port)
|
||||
def connected(proto):
|
||||
result[u'connected'] = time()
|
||||
return proto
|
||||
proto.addCallback(connected)
|
||||
proto.addCallback(_write, byteCount)
|
||||
return finished
|
||||
|
||||
|
||||
|
||||
def _benchmarkBuffered(byteCount):
|
||||
return _benchmark(byteCount, BufferingProtocol)
|
||||
|
||||
|
||||
|
||||
def _benchmarkUnbuffered(byteCount):
|
||||
return _benchmark(byteCount, UnbufferingProtocol)
|
||||
|
||||
|
||||
|
||||
def benchmark(scale=1):
|
||||
"""
|
||||
Benchmark and return information regarding the relative performance of a
|
||||
protocol which does not use the buffering mixin and a protocol which
|
||||
does.
|
||||
|
||||
@type scale: C{int}
|
||||
@param scale: A multipler to the amount of work to perform
|
||||
|
||||
@return: A Deferred which will fire with a dictionary mapping each of
|
||||
the two unicode strings C{u'buffered'} and C{u'unbuffered'} to
|
||||
dictionaries describing the performance of a protocol of each type.
|
||||
These value dictionaries will map the unicode strings C{u'connected'}
|
||||
and C{u'disconnected'} to the times at which each of those events
|
||||
occurred and C{u'duration'} two the difference between these two values.
|
||||
"""
|
||||
overallResult = {}
|
||||
|
||||
byteCount = 1024
|
||||
|
||||
bufferedDeferred = _benchmarkBuffered(byteCount * scale)
|
||||
def didBuffered(bufferedResult):
|
||||
overallResult[u'buffered'] = bufferedResult
|
||||
unbufferedDeferred = _benchmarkUnbuffered(byteCount * scale)
|
||||
def didUnbuffered(unbufferedResult):
|
||||
overallResult[u'unbuffered'] = unbufferedResult
|
||||
return overallResult
|
||||
unbufferedDeferred.addCallback(didUnbuffered)
|
||||
return unbufferedDeferred
|
||||
bufferedDeferred.addCallback(didBuffered)
|
||||
return bufferedDeferred
|
||||
|
||||
|
||||
|
||||
def main(args=None):
|
||||
"""
|
||||
Perform a single benchmark run, starting and stopping the reactor and
|
||||
logging system as necessary.
|
||||
"""
|
||||
startLogging(stdout)
|
||||
|
||||
options = BufferingBenchmark()
|
||||
options.parseOptions(args)
|
||||
|
||||
d = benchmark(options['scale'])
|
||||
def cbBenchmark(result):
|
||||
pprint(result)
|
||||
def ebBenchmark(err):
|
||||
print err.getTraceback()
|
||||
d.addCallbacks(cbBenchmark, ebBenchmark)
|
||||
def stopReactor(ign):
|
||||
reactor.stop()
|
||||
d.addBoth(stopReactor)
|
||||
reactor.run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
25
vendor/Twisted-10.0.0/doc/conch/examples/demo.tac
vendored
Normal file
25
vendor/Twisted-10.0.0/doc/conch/examples/demo.tac
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
# You can run this .tac file directly with:
|
||||
# twistd -ny demo.tac
|
||||
|
||||
"""Nearly pointless demonstration of the manhole interactive interpreter.
|
||||
|
||||
This does about the same thing as demo_manhole, but uses the tap
|
||||
module's makeService method instead. The only interesting difference
|
||||
is that in this version, the telnet server also requires
|
||||
authentication.
|
||||
|
||||
Note, you will have to create a file named \"passwd\" and populate it
|
||||
with credentials (in the format of passwd(5)) to use this demo.
|
||||
"""
|
||||
|
||||
from twisted.application import service
|
||||
application = service.Application("TAC Demo")
|
||||
|
||||
from twisted.conch import manhole_tap
|
||||
manhole_tap.makeService({"telnetPort": "tcp:6023",
|
||||
"sshPort": "tcp:6022",
|
||||
"namespace": {"foo": "bar"},
|
||||
"passwd": "passwd"}).setServiceParent(application)
|
80
vendor/Twisted-10.0.0/doc/conch/examples/demo_draw.tac
vendored
Normal file
80
vendor/Twisted-10.0.0/doc/conch/examples/demo_draw.tac
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
# You can run this .tac file directly with:
|
||||
# twistd -ny demo_draw.tac
|
||||
|
||||
"""A trivial drawing application.
|
||||
|
||||
Clients are allowed to connect and spew various characters out over
|
||||
the terminal. Spacebar changes the drawing character, while the arrow
|
||||
keys move the cursor.
|
||||
"""
|
||||
|
||||
from twisted.conch.insults import insults
|
||||
from twisted.conch.telnet import TelnetTransport, TelnetBootstrapProtocol
|
||||
from twisted.conch.manhole_ssh import ConchFactory, TerminalRealm
|
||||
|
||||
from twisted.internet import protocol
|
||||
from twisted.application import internet, service
|
||||
from twisted.cred import checkers, portal
|
||||
|
||||
class Draw(insults.TerminalProtocol):
|
||||
"""Protocol which accepts arrow key and spacebar input and places
|
||||
the requested characters onto the terminal.
|
||||
"""
|
||||
cursors = list('!@#$%^&*()_+-=')
|
||||
|
||||
def connectionMade(self):
|
||||
self.terminal.eraseDisplay()
|
||||
self.terminal.resetModes([insults.IRM])
|
||||
self.cursor = self.cursors[0]
|
||||
|
||||
def keystrokeReceived(self, keyID, modifier):
|
||||
if keyID == self.terminal.UP_ARROW:
|
||||
self.terminal.cursorUp()
|
||||
elif keyID == self.terminal.DOWN_ARROW:
|
||||
self.terminal.cursorDown()
|
||||
elif keyID == self.terminal.LEFT_ARROW:
|
||||
self.terminal.cursorBackward()
|
||||
elif keyID == self.terminal.RIGHT_ARROW:
|
||||
self.terminal.cursorForward()
|
||||
elif keyID == ' ':
|
||||
self.cursor = self.cursors[(self.cursors.index(self.cursor) + 1) % len(self.cursors)]
|
||||
else:
|
||||
return
|
||||
self.terminal.write(self.cursor)
|
||||
self.terminal.cursorBackward()
|
||||
|
||||
def makeService(args):
|
||||
checker = checkers.InMemoryUsernamePasswordDatabaseDontUse(username="password")
|
||||
|
||||
f = protocol.ServerFactory()
|
||||
f.protocol = lambda: TelnetTransport(TelnetBootstrapProtocol,
|
||||
insults.ServerProtocol,
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
tsvc = internet.TCPServer(args['telnet'], f)
|
||||
|
||||
def chainProtocolFactory():
|
||||
return insults.ServerProtocol(
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
|
||||
rlm = TerminalRealm()
|
||||
rlm.chainedProtocolFactory = chainProtocolFactory
|
||||
ptl = portal.Portal(rlm, [checker])
|
||||
f = ConchFactory(ptl)
|
||||
csvc = internet.TCPServer(args['ssh'], f)
|
||||
|
||||
m = service.MultiService()
|
||||
tsvc.setServiceParent(m)
|
||||
csvc.setServiceParent(m)
|
||||
return m
|
||||
|
||||
application = service.Application("Insults Demo App")
|
||||
makeService({'protocolFactory': Draw,
|
||||
'telnet': 6023,
|
||||
'ssh': 6022}).setServiceParent(application)
|
252
vendor/Twisted-10.0.0/doc/conch/examples/demo_insults.tac
vendored
Normal file
252
vendor/Twisted-10.0.0/doc/conch/examples/demo_insults.tac
vendored
Normal file
@ -0,0 +1,252 @@
|
||||
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
# You can run this .tac file directly with:
|
||||
# twistd -ny demo_insults.tac
|
||||
|
||||
"""Various simple terminal manipulations using the insults module.
|
||||
|
||||
This demo sets up two listening ports: one on 6022 which accepts ssh
|
||||
connections; one on 6023 which accepts telnet connections. No login
|
||||
for the telnet server is required; for the ssh server, \"username\" is
|
||||
the username and \"password\" is the password.
|
||||
|
||||
The TerminalProtocol subclass defined here ignores most user input
|
||||
(except to print it out to the server log) and spends the duration of
|
||||
the connection drawing (the author's humble approximation of)
|
||||
raindrops at random locations on the client's terminal. +, -, *, and
|
||||
/ are respected and each adjusts an aspect of the timing of the
|
||||
animation process.
|
||||
"""
|
||||
|
||||
import random, string
|
||||
|
||||
from twisted.python import log
|
||||
from twisted.internet import protocol, task
|
||||
from twisted.application import internet, service
|
||||
from twisted.cred import checkers, portal
|
||||
|
||||
from twisted.conch.insults import insults
|
||||
from twisted.conch.telnet import TelnetTransport, TelnetBootstrapProtocol
|
||||
from twisted.conch.manhole_ssh import ConchFactory, TerminalRealm
|
||||
|
||||
class DrawingFinished(Exception):
|
||||
"""Sentinel exception, raised when no \"frames\" for a particular
|
||||
\"animation\" remain to be drawn.
|
||||
"""
|
||||
|
||||
class Drawable:
|
||||
"""Representation of an animation.
|
||||
|
||||
Constructed with a protocol instance and a coordinate on the
|
||||
screen, waits for invocations of iterate() at which point it
|
||||
erases the previous frame of the animation and draws the next one,
|
||||
using its protocol instance and always placing the upper left hand
|
||||
corner of the frame at the given coordinates.
|
||||
|
||||
Frames are defined with draw_ prefixed methods. Erasure is
|
||||
performed by erase_ prefixed methods.
|
||||
"""
|
||||
n = 0
|
||||
|
||||
def __init__(self, proto, col, line):
|
||||
self.proto = proto
|
||||
self.col = col
|
||||
self.line = line
|
||||
|
||||
def drawLines(self, s):
|
||||
lines = s.splitlines()
|
||||
c = self.col
|
||||
line = self.line
|
||||
for l in lines:
|
||||
self.proto.cursorPosition(c - len(lines) / 2, line)
|
||||
self.proto.write(l)
|
||||
line += 1
|
||||
|
||||
def iterate(self):
|
||||
getattr(self, 'erase_' + str(self.n))()
|
||||
self.n += 1
|
||||
f = getattr(self, 'draw_' + str(self.n), None)
|
||||
if f is None:
|
||||
raise DrawingFinished()
|
||||
f()
|
||||
|
||||
def erase_0(self):
|
||||
pass
|
||||
|
||||
|
||||
class Splat(Drawable):
|
||||
HEIGHT = 5
|
||||
WIDTH = 11
|
||||
|
||||
def draw_1(self):
|
||||
# . .
|
||||
#. . .
|
||||
# . .
|
||||
self.drawLines(' . .\n. . .\n . .')
|
||||
|
||||
def erase_1(self):
|
||||
self.drawLines(' \n \n ')
|
||||
|
||||
def draw_2(self):
|
||||
# . . . .
|
||||
# . o o o .
|
||||
#. o o o o .
|
||||
# . o o o .
|
||||
# . . . .
|
||||
self.drawLines(' . . . .\n . o o o .\n. o o o o .\n . o o o .\n . . . .')
|
||||
|
||||
def erase_2(self):
|
||||
self.drawLines(' \n \n \n \n ')
|
||||
|
||||
def draw_3(self):
|
||||
# o o o o
|
||||
# o O O O o
|
||||
#o O O O O o
|
||||
# o O O O o
|
||||
# o o o o
|
||||
self.drawLines(' o o o o\n o O O O o\no O O O O o\n o O O O o\n o o o o')
|
||||
|
||||
erase_3 = erase_2
|
||||
|
||||
def draw_4(self):
|
||||
# O O O O
|
||||
# O . . . O
|
||||
#O . . . . O
|
||||
# O . . . O
|
||||
# O O O O
|
||||
self.drawLines(' O O O O\n O . . . O\nO . . . . O\n O . . . O\n O O O O')
|
||||
|
||||
erase_4 = erase_3
|
||||
|
||||
def draw_5(self):
|
||||
# . . . .
|
||||
# . .
|
||||
#. .
|
||||
# . .
|
||||
# . . . .
|
||||
self.drawLines(' . . . .\n . .\n. .\n . .\n . . . .')
|
||||
|
||||
erase_5 = erase_4
|
||||
|
||||
class Drop(Drawable):
|
||||
WIDTH = 3
|
||||
HEIGHT = 4
|
||||
|
||||
def draw_1(self):
|
||||
# o
|
||||
self.drawLines(' o')
|
||||
|
||||
def erase_1(self):
|
||||
self.drawLines(' ')
|
||||
|
||||
def draw_2(self):
|
||||
# _
|
||||
#/ \
|
||||
#\./
|
||||
self.drawLines(' _ \n/ \\\n\\./')
|
||||
|
||||
def erase_2(self):
|
||||
self.drawLines(' \n \n ')
|
||||
|
||||
def draw_3(self):
|
||||
# O
|
||||
self.drawLines(' O')
|
||||
|
||||
def erase_3(self):
|
||||
self.drawLines(' ')
|
||||
|
||||
class DemoProtocol(insults.TerminalProtocol):
|
||||
"""Draws random things at random places on the screen.
|
||||
"""
|
||||
width = 80
|
||||
height = 24
|
||||
|
||||
interval = 0.1
|
||||
rate = 0.05
|
||||
|
||||
def connectionMade(self):
|
||||
self.run()
|
||||
|
||||
def connectionLost(self, reason):
|
||||
self._call.stop()
|
||||
del self._call
|
||||
|
||||
def run(self):
|
||||
# Clear the screen, matey
|
||||
self.terminal.eraseDisplay()
|
||||
|
||||
self._call = task.LoopingCall(self._iterate)
|
||||
self._call.start(self.interval)
|
||||
|
||||
def _iterate(self):
|
||||
cls = random.choice((Splat, Drop))
|
||||
|
||||
# Move to a random location on the screen
|
||||
col = random.randrange(self.width - cls.WIDTH) + cls.WIDTH
|
||||
line = random.randrange(self.height - cls.HEIGHT) + cls.HEIGHT
|
||||
|
||||
s = cls(self.terminal, col, line)
|
||||
|
||||
c = task.LoopingCall(s.iterate)
|
||||
c.start(self.rate).addErrback(lambda f: f.trap(DrawingFinished)).addErrback(log.err)
|
||||
|
||||
# ITerminalListener
|
||||
def terminalSize(self, width, height):
|
||||
self.width = width
|
||||
self.height = height
|
||||
|
||||
def unhandledControlSequence(self, seq):
|
||||
log.msg("Client sent something weird: %r" % (seq,))
|
||||
|
||||
def keystrokeReceived(self, keyID, modifier):
|
||||
if keyID == '+':
|
||||
self.interval /= 1.1
|
||||
elif keyID == '-':
|
||||
self.interval *= 1.1
|
||||
elif keyID == '*':
|
||||
self.rate /= 1.1
|
||||
elif keyID == '/':
|
||||
self.rate *= 1.1
|
||||
else:
|
||||
log.msg("Client sent: %r" % (keyID,))
|
||||
return
|
||||
|
||||
self._call.stop()
|
||||
self._call = task.LoopingCall(self._iterate)
|
||||
self._call.start(self.interval)
|
||||
|
||||
|
||||
def makeService(args):
|
||||
checker = checkers.InMemoryUsernamePasswordDatabaseDontUse(username="password")
|
||||
|
||||
f = protocol.ServerFactory()
|
||||
f.protocol = lambda: TelnetTransport(TelnetBootstrapProtocol,
|
||||
insults.ServerProtocol,
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
tsvc = internet.TCPServer(args['telnet'], f)
|
||||
|
||||
def chainProtocolFactory():
|
||||
return insults.ServerProtocol(
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
|
||||
rlm = TerminalRealm()
|
||||
rlm.chainedProtocolFactory = chainProtocolFactory
|
||||
ptl = portal.Portal(rlm, [checker])
|
||||
f = ConchFactory(ptl)
|
||||
csvc = internet.TCPServer(args['ssh'], f)
|
||||
|
||||
m = service.MultiService()
|
||||
tsvc.setServiceParent(m)
|
||||
csvc.setServiceParent(m)
|
||||
return m
|
||||
|
||||
application = service.Application("Insults Demo App")
|
||||
|
||||
makeService({'protocolFactory': DemoProtocol,
|
||||
'telnet': 6023,
|
||||
'ssh': 6022}).setServiceParent(application)
|
56
vendor/Twisted-10.0.0/doc/conch/examples/demo_manhole.tac
vendored
Normal file
56
vendor/Twisted-10.0.0/doc/conch/examples/demo_manhole.tac
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
# You can run this .tac file directly with:
|
||||
# twistd -ny demo_manhole.tac
|
||||
|
||||
"""An interactive Python interpreter with syntax coloring.
|
||||
|
||||
Nothing interesting is actually defined here. Two listening ports are
|
||||
set up and attached to protocols which know how to properly set up a
|
||||
ColoredManhole instance.
|
||||
"""
|
||||
|
||||
from twisted.conch.manhole import ColoredManhole
|
||||
from twisted.conch.insults import insults
|
||||
from twisted.conch.telnet import TelnetTransport, TelnetBootstrapProtocol
|
||||
from twisted.conch.manhole_ssh import ConchFactory, TerminalRealm
|
||||
|
||||
from twisted.internet import protocol
|
||||
from twisted.application import internet, service
|
||||
from twisted.cred import checkers, portal
|
||||
|
||||
def makeService(args):
|
||||
checker = checkers.InMemoryUsernamePasswordDatabaseDontUse(username="password")
|
||||
|
||||
f = protocol.ServerFactory()
|
||||
f.protocol = lambda: TelnetTransport(TelnetBootstrapProtocol,
|
||||
insults.ServerProtocol,
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
tsvc = internet.TCPServer(args['telnet'], f)
|
||||
|
||||
def chainProtocolFactory():
|
||||
return insults.ServerProtocol(
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
|
||||
rlm = TerminalRealm()
|
||||
rlm.chainedProtocolFactory = chainProtocolFactory
|
||||
ptl = portal.Portal(rlm, [checker])
|
||||
f = ConchFactory(ptl)
|
||||
csvc = internet.TCPServer(args['ssh'], f)
|
||||
|
||||
m = service.MultiService()
|
||||
tsvc.setServiceParent(m)
|
||||
csvc.setServiceParent(m)
|
||||
return m
|
||||
|
||||
application = service.Application("Interactive Python Interpreter")
|
||||
|
||||
makeService({'protocolFactory': ColoredManhole,
|
||||
'protocolArgs': (None,),
|
||||
'telnet': 6023,
|
||||
'ssh': 6022}).setServiceParent(application)
|
77
vendor/Twisted-10.0.0/doc/conch/examples/demo_recvline.tac
vendored
Normal file
77
vendor/Twisted-10.0.0/doc/conch/examples/demo_recvline.tac
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
# You can run this .tac file directly with:
|
||||
# twistd -ny demo_recvline.tac
|
||||
|
||||
"""Demonstrates line-at-a-time handling with basic line-editing support.
|
||||
|
||||
This is a variation on the echo server. It sets up two listening
|
||||
ports: one on 6022 which accepts ssh connections; one on 6023 which
|
||||
accepts telnet connections. No login for the telnet server is
|
||||
required; for the ssh server, \"username\" is the username and
|
||||
\"password\" is the password.
|
||||
|
||||
The demo protocol defined in this module is handed a line of input at
|
||||
a time, which it simply writes back to the connection.
|
||||
HistoricRecvline, which the demo protocol subclasses, provides basic
|
||||
line editing and input history features.
|
||||
"""
|
||||
|
||||
from twisted.conch import recvline
|
||||
from twisted.conch.insults import insults
|
||||
from twisted.conch.telnet import TelnetTransport, TelnetBootstrapProtocol
|
||||
from twisted.conch.manhole_ssh import ConchFactory, TerminalRealm
|
||||
|
||||
from twisted.internet import protocol
|
||||
from twisted.application import internet, service
|
||||
from twisted.cred import checkers, portal
|
||||
|
||||
class DemoRecvLine(recvline.HistoricRecvLine):
|
||||
"""Simple echo protocol.
|
||||
|
||||
Accepts lines of input and writes them back to its connection. If
|
||||
a line consisting solely of \"quit\" is received, the connection
|
||||
is dropped.
|
||||
"""
|
||||
|
||||
def lineReceived(self, line):
|
||||
if line == "quit":
|
||||
self.terminal.loseConnection()
|
||||
self.terminal.write(line)
|
||||
self.terminal.nextLine()
|
||||
self.terminal.write(self.ps[self.pn])
|
||||
|
||||
def makeService(args):
|
||||
checker = checkers.InMemoryUsernamePasswordDatabaseDontUse(username="password")
|
||||
|
||||
f = protocol.ServerFactory()
|
||||
f.protocol = lambda: TelnetTransport(TelnetBootstrapProtocol,
|
||||
insults.ServerProtocol,
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
tsvc = internet.TCPServer(args['telnet'], f)
|
||||
|
||||
def chainProtocolFactory():
|
||||
return insults.ServerProtocol(
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
|
||||
rlm = TerminalRealm()
|
||||
rlm.chainedProtocolFactory = chainProtocolFactory
|
||||
ptl = portal.Portal(rlm, [checker])
|
||||
f = ConchFactory(ptl)
|
||||
csvc = internet.TCPServer(args['ssh'], f)
|
||||
|
||||
m = service.MultiService()
|
||||
tsvc.setServiceParent(m)
|
||||
csvc.setServiceParent(m)
|
||||
return m
|
||||
|
||||
application = service.Application("Insults RecvLine Demo")
|
||||
|
||||
makeService({'protocolFactory': DemoRecvLine,
|
||||
'telnet': 6023,
|
||||
'ssh': 6022}).setServiceParent(application)
|
100
vendor/Twisted-10.0.0/doc/conch/examples/demo_scroll.tac
vendored
Normal file
100
vendor/Twisted-10.0.0/doc/conch/examples/demo_scroll.tac
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
# You can run this .tac file directly with:
|
||||
# twistd -ny demo_scroll.tac
|
||||
|
||||
"""Simple echo-ish server that uses the scroll-region.
|
||||
|
||||
This demo sets up two listening ports: one on 6022 which accepts ssh
|
||||
connections; one on 6023 which accepts telnet connections. No login
|
||||
for the telnet server is required; for the ssh server, \"username\" is
|
||||
the username and \"password\" is the password.
|
||||
|
||||
The TerminalProtocol subclass defined here sets up a scroll-region occupying
|
||||
most of the screen. It positions the cursor at the bottom of the screen and
|
||||
then echos back printable input. When return is received, the line is
|
||||
copied to the upper area of the screen (scrolling anything older up) and
|
||||
clears the input line.
|
||||
"""
|
||||
|
||||
import string
|
||||
|
||||
from twisted.python import log
|
||||
from twisted.internet import protocol
|
||||
from twisted.application import internet, service
|
||||
from twisted.cred import checkers, portal
|
||||
|
||||
from twisted.conch.insults import insults
|
||||
from twisted.conch.telnet import TelnetTransport, TelnetBootstrapProtocol
|
||||
from twisted.conch.manhole_ssh import ConchFactory, TerminalRealm
|
||||
|
||||
class DemoProtocol(insults.TerminalProtocol):
|
||||
"""Copies input to an upwards scrolling region.
|
||||
"""
|
||||
width = 80
|
||||
height = 24
|
||||
|
||||
def connectionMade(self):
|
||||
self.buffer = []
|
||||
self.terminalSize(self.width, self.height)
|
||||
|
||||
# ITerminalListener
|
||||
def terminalSize(self, width, height):
|
||||
self.width = width
|
||||
self.height = height
|
||||
|
||||
self.terminal.setScrollRegion(0, height - 1)
|
||||
self.terminal.cursorPosition(0, height)
|
||||
self.terminal.write('> ')
|
||||
|
||||
def unhandledControlSequence(self, seq):
|
||||
log.msg("Client sent something weird: %r" % (seq,))
|
||||
|
||||
def keystrokeReceived(self, keyID, modifier):
|
||||
if keyID == '\r':
|
||||
self.terminal.cursorPosition(0, self.height - 2)
|
||||
self.terminal.nextLine()
|
||||
self.terminal.write(''.join(self.buffer))
|
||||
self.terminal.cursorPosition(0, self.height - 1)
|
||||
self.terminal.eraseToLineEnd()
|
||||
self.terminal.write('> ')
|
||||
self.buffer = []
|
||||
elif keyID in list(string.printable):
|
||||
self.terminal.write(keyID)
|
||||
self.buffer.append(keyID)
|
||||
|
||||
|
||||
def makeService(args):
|
||||
checker = checkers.InMemoryUsernamePasswordDatabaseDontUse(username="password")
|
||||
|
||||
f = protocol.ServerFactory()
|
||||
f.protocol = lambda: TelnetTransport(TelnetBootstrapProtocol,
|
||||
insults.ServerProtocol,
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
tsvc = internet.TCPServer(args['telnet'], f)
|
||||
|
||||
def chainProtocolFactory():
|
||||
return insults.ServerProtocol(
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
|
||||
rlm = TerminalRealm()
|
||||
rlm.chainedProtocolFactory = chainProtocolFactory
|
||||
ptl = portal.Portal(rlm, [checker])
|
||||
f = ConchFactory(ptl)
|
||||
csvc = internet.TCPServer(args['ssh'], f)
|
||||
|
||||
m = service.MultiService()
|
||||
tsvc.setServiceParent(m)
|
||||
csvc.setServiceParent(m)
|
||||
return m
|
||||
|
||||
application = service.Application("Scroll Region Demo App")
|
||||
|
||||
makeService({'protocolFactory': DemoProtocol,
|
||||
'telnet': 6023,
|
||||
'ssh': 6022}).setServiceParent(application)
|
40
vendor/Twisted-10.0.0/doc/conch/examples/index.html
vendored
Normal file
40
vendor/Twisted-10.0.0/doc/conch/examples/index.html
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Twisted Documentation: Twisted.Conch code examples</title>
|
||||
<link href="../howto/stylesheet.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h1 class="title">Twisted.Conch code examples</h1>
|
||||
<div class="toc"><ol><li><a href="#auto0">Simple SSH server and client</a></li><li><a href="#auto1">Simple telnet server</a></li><li><a href="#auto2">twisted.conch.insults examples</a></li></ol></div>
|
||||
<div class="content">
|
||||
<span/>
|
||||
|
||||
<h2>Simple SSH server and client<a name="auto0"/></h2>
|
||||
<ul>
|
||||
<li><a href="sshsimpleclient.py" shape="rect">sshsimpleclient.py</a></li>
|
||||
<li><a href="sshsimpleserver.py" shape="rect">sshsimpleserver.py</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Simple telnet server<a name="auto1"/></h2>
|
||||
<ul>
|
||||
<li><a href="telnet_echo.tac" shape="rect">A telnet server which echoes data and events back to the client</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>twisted.conch.insults examples<a name="auto2"/></h2>
|
||||
<ul>
|
||||
<li><a href="demo.tac" shape="rect">demo.tac</a> Nearly pointless demonstration of the manhole interactive interpreter</li>
|
||||
<li><a href="demo_draw.tac" shape="rect">demo_draw.tac</a> A trivial drawing application</li>
|
||||
<li><a href="demo_insults.tac" shape="rect">demo_insults.tac</a> Various simple terminal manipulations using the insults module</li>
|
||||
<li><a href="demo_recvline.tac" shape="rect">demo_recvline.tac</a> Demonstrates line-at-a-time handling with basic line-editing support</li>
|
||||
<li><a href="demo_scroll.tac" shape="rect">demo_scroll.tac</a> Simple echo-ish server that uses the scroll-region</li>
|
||||
<li><a href="demo_manhole.tac" shape="rect">demo_manhole.tac</a> An interactive Python interpreter with syntax coloring</li>
|
||||
<li><a href="window.tac" shape="rect">window.tac</a> An example of various widgets</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p><a href="../howto/index.html">Index</a></p>
|
||||
<span class="version">Version: 10.0.0</span>
|
||||
</body>
|
||||
</html>
|
111
vendor/Twisted-10.0.0/doc/conch/examples/sshsimpleclient.py
vendored
Normal file
111
vendor/Twisted-10.0.0/doc/conch/examples/sshsimpleclient.py
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
from twisted.conch.ssh import transport, userauth, connection, common, keys, channel
|
||||
from twisted.internet import defer, protocol, reactor
|
||||
from twisted.python import log
|
||||
import struct, sys, getpass, os
|
||||
|
||||
USER = 'z3p' # replace this with a valid username
|
||||
HOST = 'localhost' # and a valid host
|
||||
|
||||
class SimpleTransport(transport.SSHClientTransport):
|
||||
def verifyHostKey(self, hostKey, fingerprint):
|
||||
print 'host key fingerprint: %s' % fingerprint
|
||||
return defer.succeed(1)
|
||||
|
||||
def connectionSecure(self):
|
||||
self.requestService(
|
||||
SimpleUserAuth(USER,
|
||||
SimpleConnection()))
|
||||
|
||||
class SimpleUserAuth(userauth.SSHUserAuthClient):
|
||||
def getPassword(self):
|
||||
return defer.succeed(getpass.getpass("%s@%s's password: " % (USER, HOST)))
|
||||
|
||||
def getGenericAnswers(self, name, instruction, questions):
|
||||
print name
|
||||
print instruction
|
||||
answers = []
|
||||
for prompt, echo in questions:
|
||||
if echo:
|
||||
answer = raw_input(prompt)
|
||||
else:
|
||||
answer = getpass.getpass(prompt)
|
||||
answers.append(answer)
|
||||
return defer.succeed(answers)
|
||||
|
||||
def getPublicKey(self):
|
||||
path = os.path.expanduser('~/.ssh/id_dsa')
|
||||
# this works with rsa too
|
||||
# just change the name here and in getPrivateKey
|
||||
if not os.path.exists(path) or self.lastPublicKey:
|
||||
# the file doesn't exist, or we've tried a public key
|
||||
return
|
||||
return keys.getPublicKeyString(path+'.pub')
|
||||
|
||||
def getPrivateKey(self):
|
||||
path = os.path.expanduser('~/.ssh/id_dsa')
|
||||
return defer.succeed(keys.getPrivateKeyObject(path))
|
||||
|
||||
class SimpleConnection(connection.SSHConnection):
|
||||
def serviceStarted(self):
|
||||
self.openChannel(TrueChannel(2**16, 2**15, self))
|
||||
self.openChannel(FalseChannel(2**16, 2**15, self))
|
||||
self.openChannel(CatChannel(2**16, 2**15, self))
|
||||
|
||||
class TrueChannel(channel.SSHChannel):
|
||||
name = 'session' # needed for commands
|
||||
|
||||
def openFailed(self, reason):
|
||||
print 'true failed', reason
|
||||
|
||||
def channelOpen(self, ignoredData):
|
||||
self.conn.sendRequest(self, 'exec', common.NS('true'))
|
||||
|
||||
def request_exit_status(self, data):
|
||||
status = struct.unpack('>L', data)[0]
|
||||
print 'true status was: %s' % status
|
||||
self.loseConnection()
|
||||
|
||||
class FalseChannel(channel.SSHChannel):
|
||||
name = 'session'
|
||||
|
||||
def openFailed(self, reason):
|
||||
print 'false failed', reason
|
||||
|
||||
def channelOpen(self, ignoredData):
|
||||
self.conn.sendRequest(self, 'exec', common.NS('false'))
|
||||
|
||||
def request_exit_status(self, data):
|
||||
status = struct.unpack('>L', data)[0]
|
||||
print 'false status was: %s' % status
|
||||
self.loseConnection()
|
||||
|
||||
class CatChannel(channel.SSHChannel):
|
||||
name = 'session'
|
||||
|
||||
def openFailed(self, reason):
|
||||
print 'echo failed', reason
|
||||
|
||||
def channelOpen(self, ignoredData):
|
||||
self.data = ''
|
||||
d = self.conn.sendRequest(self, 'exec', common.NS('cat'), wantReply = 1)
|
||||
d.addCallback(self._cbRequest)
|
||||
|
||||
def _cbRequest(self, ignored):
|
||||
self.write('hello conch\n')
|
||||
self.conn.sendEOF(self)
|
||||
|
||||
def dataReceived(self, data):
|
||||
self.data += data
|
||||
|
||||
def closed(self):
|
||||
print 'got data from cat: %s' % repr(self.data)
|
||||
self.loseConnection()
|
||||
reactor.stop()
|
||||
|
||||
protocol.ClientCreator(reactor, SimpleTransport).connectTCP(HOST, 22)
|
||||
reactor.run()
|
117
vendor/Twisted-10.0.0/doc/conch/examples/sshsimpleserver.py
vendored
Executable file
117
vendor/Twisted-10.0.0/doc/conch/examples/sshsimpleserver.py
vendored
Executable file
@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
from twisted.cred import portal, checkers
|
||||
from twisted.conch import error, avatar
|
||||
from twisted.conch.checkers import SSHPublicKeyDatabase
|
||||
from twisted.conch.ssh import factory, userauth, connection, keys, session
|
||||
from twisted.internet import reactor, protocol, defer
|
||||
from twisted.python import log
|
||||
from zope.interface import implements
|
||||
import sys
|
||||
log.startLogging(sys.stderr)
|
||||
|
||||
"""
|
||||
Example of running another protocol over an SSH channel.
|
||||
log in with username "user" and password "password".
|
||||
"""
|
||||
|
||||
class ExampleAvatar(avatar.ConchUser):
|
||||
|
||||
def __init__(self, username):
|
||||
avatar.ConchUser.__init__(self)
|
||||
self.username = username
|
||||
self.channelLookup.update({'session':session.SSHSession})
|
||||
|
||||
class ExampleRealm:
|
||||
implements(portal.IRealm)
|
||||
|
||||
def requestAvatar(self, avatarId, mind, *interfaces):
|
||||
return interfaces[0], ExampleAvatar(avatarId), lambda: None
|
||||
|
||||
class EchoProtocol(protocol.Protocol):
|
||||
"""this is our example protocol that we will run over SSH
|
||||
"""
|
||||
def dataReceived(self, data):
|
||||
if data == '\r':
|
||||
data = '\r\n'
|
||||
elif data == '\x03': #^C
|
||||
self.transport.loseConnection()
|
||||
return
|
||||
self.transport.write(data)
|
||||
|
||||
publicKey = 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAGEArzJx8OYOnJmzf4tfBEvLi8DVPrJ3/c9k2I/Az64fxjHf9imyRJbixtQhlH9lfNjUIx+4LmrJH5QNRsFporcHDKOTwTTYLh5KmRpslkYHRivcJSkbh/C+BR3utDS555mV'
|
||||
|
||||
privateKey = """-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIByAIBAAJhAK8ycfDmDpyZs3+LXwRLy4vA1T6yd/3PZNiPwM+uH8Yx3/YpskSW
|
||||
4sbUIZR/ZXzY1CMfuC5qyR+UDUbBaaK3Bwyjk8E02C4eSpkabJZGB0Yr3CUpG4fw
|
||||
vgUd7rQ0ueeZlQIBIwJgbh+1VZfr7WftK5lu7MHtqE1S1vPWZQYE3+VUn8yJADyb
|
||||
Z4fsZaCrzW9lkIqXkE3GIY+ojdhZhkO1gbG0118sIgphwSWKRxK0mvh6ERxKqIt1
|
||||
xJEJO74EykXZV4oNJ8sjAjEA3J9r2ZghVhGN6V8DnQrTk24Td0E8hU8AcP0FVP+8
|
||||
PQm/g/aXf2QQkQT+omdHVEJrAjEAy0pL0EBH6EVS98evDCBtQw22OZT52qXlAwZ2
|
||||
gyTriKFVoqjeEjt3SZKKqXHSApP/AjBLpF99zcJJZRq2abgYlf9lv1chkrWqDHUu
|
||||
DZttmYJeEfiFBBavVYIF1dOlZT0G8jMCMBc7sOSZodFnAiryP+Qg9otSBjJ3bQML
|
||||
pSTqy7c3a2AScC/YyOwkDaICHnnD3XyjMwIxALRzl0tQEKMXs6hH8ToUdlLROCrP
|
||||
EhQ0wahUTCk1gKA4uPD6TMTChavbh4K63OvbKg==
|
||||
-----END RSA PRIVATE KEY-----"""
|
||||
|
||||
|
||||
class InMemoryPublicKeyChecker(SSHPublicKeyDatabase):
|
||||
|
||||
def checkKey(self, credentials):
|
||||
return credentials.username == 'user' and \
|
||||
keys.getPublicKeyString(data=publicKey) == credentials.blob
|
||||
|
||||
class ExampleSession:
|
||||
|
||||
def __init__(self, avatar):
|
||||
"""
|
||||
We don't use it, but the adapter is passed the avatar as its first
|
||||
argument.
|
||||
"""
|
||||
|
||||
def getPty(self, term, windowSize, attrs):
|
||||
pass
|
||||
|
||||
def execCommand(self, proto, cmd):
|
||||
raise Exception("no executing commands")
|
||||
|
||||
def openShell(self, trans):
|
||||
ep = EchoProtocol()
|
||||
ep.makeConnection(trans)
|
||||
trans.makeConnection(session.wrapProtocol(ep))
|
||||
|
||||
def eofReceived(self):
|
||||
pass
|
||||
|
||||
def closed(self):
|
||||
pass
|
||||
|
||||
from twisted.python import components
|
||||
components.registerAdapter(ExampleSession, ExampleAvatar, session.ISession)
|
||||
|
||||
class ExampleFactory(factory.SSHFactory):
|
||||
publicKeys = {
|
||||
'ssh-rsa': keys.Key.fromString(data=publicKey)
|
||||
}
|
||||
privateKeys = {
|
||||
'ssh-rsa': keys.Key.fromString(data=privateKey)
|
||||
}
|
||||
services = {
|
||||
'ssh-userauth': userauth.SSHUserAuthServer,
|
||||
'ssh-connection': connection.SSHConnection
|
||||
}
|
||||
|
||||
|
||||
portal = portal.Portal(ExampleRealm())
|
||||
passwdDB = checkers.InMemoryUsernamePasswordDatabaseDontUse()
|
||||
passwdDB.addUser('user', 'password')
|
||||
portal.registerChecker(passwdDB)
|
||||
portal.registerChecker(InMemoryPublicKeyChecker())
|
||||
ExampleFactory.portal = portal
|
||||
|
||||
if __name__ == '__main__':
|
||||
reactor.listenTCP(5022, ExampleFactory())
|
||||
reactor.run()
|
37
vendor/Twisted-10.0.0/doc/conch/examples/telnet_echo.tac
vendored
Normal file
37
vendor/Twisted-10.0.0/doc/conch/examples/telnet_echo.tac
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright (c) 2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
from twisted.conch.telnet import TelnetTransport, TelnetProtocol
|
||||
from twisted.internet.protocol import ServerFactory
|
||||
from twisted.application.internet import TCPServer
|
||||
from twisted.application.service import Application
|
||||
|
||||
class TelnetEcho(TelnetProtocol):
|
||||
def enableRemote(self, option):
|
||||
self.transport.write("You tried to enable %r (I rejected it)\r\n" % (option,))
|
||||
return False
|
||||
|
||||
|
||||
def disableRemote(self, option):
|
||||
self.transport.write("You disabled %r\r\n" % (option,))
|
||||
|
||||
|
||||
def enableLocal(self, option):
|
||||
self.transport.write("You tried to make me enable %r (I rejected it)\r\n" % (option,))
|
||||
return False
|
||||
|
||||
|
||||
def disableLocal(self, option):
|
||||
self.transport.write("You asked me to disable %r\r\n" % (option,))
|
||||
|
||||
|
||||
def dataReceived(self, data):
|
||||
self.transport.write("I received %r from you\r\n" % (data,))
|
||||
|
||||
|
||||
factory = ServerFactory()
|
||||
factory.protocol = lambda: TelnetTransport(TelnetEcho)
|
||||
service = TCPServer(8023, factory)
|
||||
|
||||
application = Application("Telnet Echo Server")
|
||||
service.setServiceParent(application)
|
190
vendor/Twisted-10.0.0/doc/conch/examples/window.tac
vendored
Normal file
190
vendor/Twisted-10.0.0/doc/conch/examples/window.tac
vendored
Normal file
@ -0,0 +1,190 @@
|
||||
# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
# You can run this .tac file directly with:
|
||||
# twistd -ny window.tac
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import string, random
|
||||
|
||||
from twisted.python import log
|
||||
from twisted.internet import protocol, task
|
||||
from twisted.application import internet, service
|
||||
from twisted.cred import checkers, portal
|
||||
|
||||
from twisted.conch.insults import insults, window
|
||||
from twisted.conch.telnet import TelnetTransport, TelnetBootstrapProtocol
|
||||
from twisted.conch.manhole_ssh import ConchFactory, TerminalRealm
|
||||
|
||||
from twisted.internet import reactor
|
||||
|
||||
class DrawableCanvas(window.Canvas):
|
||||
x = 0
|
||||
y = 0
|
||||
|
||||
def func_LEFT_ARROW(self, modifier):
|
||||
self.x -= 1
|
||||
self.repaint()
|
||||
|
||||
def func_RIGHT_ARROW(self, modifier):
|
||||
self.x += 1
|
||||
self.repaint()
|
||||
|
||||
def func_UP_ARROW(self, modifier):
|
||||
self.y -= 1
|
||||
self.repaint()
|
||||
|
||||
def func_DOWN_ARROW(self, modifier):
|
||||
self.y += 1
|
||||
self.repaint()
|
||||
|
||||
def characterReceived(self, keyID, modifier):
|
||||
self[self.x, self.y] = keyID
|
||||
self.x += 1
|
||||
self.repaint()
|
||||
|
||||
def keystrokeReceived(self, keyID, modifier):
|
||||
if keyID == '\r' or keyID == '\v':
|
||||
return
|
||||
window.Canvas.keystrokeReceived(self, keyID, modifier)
|
||||
if self.x >= self.width:
|
||||
self.x = 0
|
||||
elif self.x < 0:
|
||||
self.x = self.width - 1
|
||||
|
||||
if self.y >= self.height:
|
||||
self.y = 0
|
||||
elif self.y < 0:
|
||||
self.y = self.height - 1
|
||||
self.repaint()
|
||||
|
||||
def render(self, width, height, terminal):
|
||||
window.Canvas.render(self, width, height, terminal)
|
||||
if self.focused:
|
||||
terminal.cursorPosition(self.x, self.y)
|
||||
window.cursor(terminal, self[self.x, self.y])
|
||||
|
||||
|
||||
class ButtonDemo(insults.TerminalProtocol):
|
||||
width = 80
|
||||
height = 24
|
||||
|
||||
def _draw(self):
|
||||
self.window.draw(self.width, self.height, self.terminal)
|
||||
|
||||
def _redraw(self):
|
||||
self.window.filthy()
|
||||
self._draw()
|
||||
|
||||
def _schedule(self, f):
|
||||
reactor.callLater(0, f)
|
||||
|
||||
def connectionMade(self):
|
||||
self.terminal.eraseDisplay()
|
||||
self.terminal.resetPrivateModes([insults.privateModes.CURSOR_MODE])
|
||||
|
||||
self.window = window.TopWindow(self._draw, self._schedule)
|
||||
self.output = window.TextOutput((15, 1))
|
||||
self.input = window.TextInput(15, self._setText)
|
||||
self.select1 = window.Selection(map(str, range(100)), self._setText, 10)
|
||||
self.select2 = window.Selection(map(str, range(200, 300)), self._setText, 10)
|
||||
self.button = window.Button("Clear", self._clear)
|
||||
self.canvas = DrawableCanvas()
|
||||
|
||||
hbox = window.HBox()
|
||||
hbox.addChild(self.input)
|
||||
hbox.addChild(self.output)
|
||||
hbox.addChild(window.Border(self.button))
|
||||
hbox.addChild(window.Border(self.select1))
|
||||
hbox.addChild(window.Border(self.select2))
|
||||
|
||||
t1 = window.TextOutputArea(longLines=window.TextOutputArea.WRAP)
|
||||
t2 = window.TextOutputArea(longLines=window.TextOutputArea.TRUNCATE)
|
||||
t3 = window.TextOutputArea(longLines=window.TextOutputArea.TRUNCATE)
|
||||
t4 = window.TextOutputArea(longLines=window.TextOutputArea.TRUNCATE)
|
||||
for _t in t1, t2, t3, t4:
|
||||
_t.setText((('This is a very long string. ' * 3) + '\n') * 3)
|
||||
|
||||
vp = window.Viewport(t3)
|
||||
d = [1]
|
||||
def spin():
|
||||
vp.xOffset += d[0]
|
||||
if vp.xOffset == 0 or vp.xOffset == 25:
|
||||
d[0] *= -1
|
||||
self.call = task.LoopingCall(spin)
|
||||
self.call.start(0.25, now=False)
|
||||
hbox.addChild(window.Border(vp))
|
||||
|
||||
vp2 = window.ScrolledArea(t4)
|
||||
hbox.addChild(vp2)
|
||||
|
||||
texts = window.VBox()
|
||||
texts.addChild(window.Border(t1))
|
||||
texts.addChild(window.Border(t2))
|
||||
|
||||
areas = window.HBox()
|
||||
areas.addChild(window.Border(self.canvas))
|
||||
areas.addChild(texts)
|
||||
|
||||
vbox = window.VBox()
|
||||
vbox.addChild(hbox)
|
||||
vbox.addChild(areas)
|
||||
self.window.addChild(vbox)
|
||||
self.terminalSize(self.width, self.height)
|
||||
|
||||
def connectionLost(self, reason):
|
||||
self.call.stop()
|
||||
insults.TerminalProtocol.connectionLost(self, reason)
|
||||
|
||||
def terminalSize(self, width, height):
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.terminal.eraseDisplay()
|
||||
self._redraw()
|
||||
|
||||
|
||||
def keystrokeReceived(self, keyID, modifier):
|
||||
self.window.keystrokeReceived(keyID, modifier)
|
||||
|
||||
def _clear(self):
|
||||
self.canvas.clear()
|
||||
|
||||
def _setText(self, text):
|
||||
self.input.setText('')
|
||||
self.output.setText(text)
|
||||
|
||||
|
||||
def makeService(args):
|
||||
checker = checkers.InMemoryUsernamePasswordDatabaseDontUse(username="password")
|
||||
|
||||
f = protocol.ServerFactory()
|
||||
f.protocol = lambda: TelnetTransport(TelnetBootstrapProtocol,
|
||||
insults.ServerProtocol,
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
tsvc = internet.TCPServer(args['telnet'], f)
|
||||
|
||||
def chainProtocolFactory():
|
||||
return insults.ServerProtocol(
|
||||
args['protocolFactory'],
|
||||
*args.get('protocolArgs', ()),
|
||||
**args.get('protocolKwArgs', {}))
|
||||
|
||||
rlm = TerminalRealm()
|
||||
rlm.chainedProtocolFactory = chainProtocolFactory
|
||||
ptl = portal.Portal(rlm, [checker])
|
||||
f = ConchFactory(ptl)
|
||||
csvc = internet.TCPServer(args['ssh'], f)
|
||||
|
||||
m = service.MultiService()
|
||||
tsvc.setServiceParent(m)
|
||||
csvc.setServiceParent(m)
|
||||
return m
|
||||
|
||||
application = service.Application("Window Demo")
|
||||
|
||||
makeService({'protocolFactory': ButtonDemo,
|
||||
'telnet': 6023,
|
||||
'ssh': 6022}).setServiceParent(application)
|
318
vendor/Twisted-10.0.0/doc/conch/howto/conch_client.html
vendored
Normal file
318
vendor/Twisted-10.0.0/doc/conch/howto/conch_client.html
vendored
Normal file
@ -0,0 +1,318 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Twisted Documentation: Writing a client with Twisted.Conch</title>
|
||||
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h1 class="title">Writing a client with Twisted.Conch</h1>
|
||||
<div class="toc"><ol><li><a href="#auto0">Introduction</a></li><li><a href="#auto1">Writing a client</a></li><li><a href="#auto2">The Transport</a></li><li><a href="#auto3">The Authorization Client</a></li><li><a href="#auto4">The Connection</a></li><li><a href="#auto5">The Channel</a></li><li><a href="#auto6">The main() function</a></li></ol></div>
|
||||
<div class="content">
|
||||
<span/>
|
||||
|
||||
<h2>Introduction<a name="auto0"/></h2>
|
||||
|
||||
<p>In the original days of computing, rsh/rlogin were used to connect to
|
||||
remote computers and execute commands. These commands had the problem
|
||||
that the passwords and commands were sent in the clear. To solve this
|
||||
problem, the SSH protocol was created. Twisted.Conch implements the
|
||||
second version of this protocol.</p>
|
||||
|
||||
<h2>Writing a client<a name="auto1"/></h2>
|
||||
|
||||
<p>Writing a client with Conch involves sub-classing 4 classes: <code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/twisted.conch.ssh.transport.SSHClientTransport.html" title="twisted.conch.ssh.transport.SSHClientTransport">twisted.conch.ssh.transport.SSHClientTransport</a></code>, <code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/twisted.conch.ssh.userauth.SSHUserAuthClient.html" title="twisted.conch.ssh.userauth.SSHUserAuthClient">twisted.conch.ssh.userauth.SSHUserAuthClient</a></code>, <code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/twisted.conch.ssh.connection.SSHConnection.html" title="twisted.conch.ssh.connection.SSHConnection">twisted.conch.ssh.connection.SSHConnection</a></code>, and <code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/twisted.conch.ssh.channel.SSHChannel.html" title="twisted.conch.ssh.channel.SSHChannel">twisted.conch.ssh.channel.SSHChannel</a></code>. We'll start out
|
||||
with <code class="python">SSHClientTransport</code> because it's the base
|
||||
of the client.</p>
|
||||
|
||||
<h2>The Transport<a name="auto2"/></h2>
|
||||
|
||||
<pre class="python"><p class="py-linenumber"> 1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
</p><span class="py-src-keyword">from</span> <span class="py-src-variable">twisted</span>.<span class="py-src-variable">conch</span> <span class="py-src-keyword">import</span> <span class="py-src-variable">error</span>
|
||||
<span class="py-src-keyword">from</span> <span class="py-src-variable">twisted</span>.<span class="py-src-variable">conch</span>.<span class="py-src-variable">ssh</span> <span class="py-src-keyword">import</span> <span class="py-src-variable">transport</span>
|
||||
<span class="py-src-keyword">from</span> <span class="py-src-variable">twisted</span>.<span class="py-src-variable">internet</span> <span class="py-src-keyword">import</span> <span class="py-src-variable">defer</span>
|
||||
|
||||
<span class="py-src-keyword">class</span> <span class="py-src-identifier">ClientTransport</span>(<span class="py-src-parameter">transport</span>.<span class="py-src-parameter">SSHClientTransport</span>):
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">verifyHostKey</span>(<span class="py-src-parameter">self</span>, <span class="py-src-parameter">pubKey</span>, <span class="py-src-parameter">fingerprint</span>):
|
||||
<span class="py-src-keyword">if</span> <span class="py-src-variable">fingerprint</span> != <span class="py-src-string">'b1:94:6a:c9:24:92:d2:34:7c:62:35:b4:d2:61:11:84'</span>:
|
||||
<span class="py-src-keyword">return</span> <span class="py-src-variable">defer</span>.<span class="py-src-variable">fail</span>(<span class="py-src-variable">error</span>.<span class="py-src-variable">ConchError</span>(<span class="py-src-string">'bad key'</span>))
|
||||
<span class="py-src-keyword">else</span>:
|
||||
<span class="py-src-keyword">return</span> <span class="py-src-variable">defer</span>.<span class="py-src-variable">succeed</span>(<span class="py-src-number">1</span>)
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">connectionSecure</span>(<span class="py-src-parameter">self</span>):
|
||||
<span class="py-src-variable">self</span>.<span class="py-src-variable">requestService</span>(<span class="py-src-variable">ClientUserAuth</span>(<span class="py-src-string">'user'</span>, <span class="py-src-variable">ClientConnection</span>()))
|
||||
</pre>
|
||||
|
||||
<p>See how easy it is? <code class="python">SSHClientTransport</code>
|
||||
handles the negotiation of encryption and the verification of keys
|
||||
for you. The one security element that you as a client writer need to
|
||||
implement is <code class="python">verifyHostKey()</code>. This method
|
||||
is called with two strings: the public key sent by the server and its
|
||||
fingerprint. You should verify the host key the server sends, either
|
||||
by checking against a hard-coded value as in the example, or by asking
|
||||
the user. <code class="python">verifyHostKey</code> returns a <code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/twisted.internet.defer.Deferred.html" title="twisted.internet.defer.Deferred">twisted.internet.defer.Deferred</a></code> which gets a callback
|
||||
if the host key is valid, or an errback if it is not. Note that in the
|
||||
above, replace 'user' with the username you're attempting to ssh with,
|
||||
for instance a call to <code class="python">os.getlogin()</code> for the
|
||||
current user.</p>
|
||||
|
||||
<p>The second method you need to implement is <code class="python">connectionSecure()</code>. It is called when the
|
||||
encryption is set up and other services can be run. The example requests
|
||||
that the <code class="python">ClientUserAuth</code> service be started.
|
||||
This service will be discussed next.</p>
|
||||
|
||||
<h2>The Authorization Client<a name="auto3"/></h2>
|
||||
|
||||
<pre class="python"><p class="py-linenumber"> 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
|
||||
</p><span class="py-src-keyword">from</span> <span class="py-src-variable">twisted</span>.<span class="py-src-variable">conch</span>.<span class="py-src-variable">ssh</span> <span class="py-src-keyword">import</span> <span class="py-src-variable">keys</span>, <span class="py-src-variable">userauth</span>
|
||||
|
||||
<span class="py-src-comment"># these are the public/private keys from test_conch</span>
|
||||
|
||||
<span class="py-src-variable">publicKey</span> = <span class="py-src-string">'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAGEArzJx8OYOnJmzf4tfBEvLi8DVPrJ3\
|
||||
/c9k2I/Az64fxjHf9imyRJbixtQhlH9lfNjUIx+4LmrJH5QNRsFporcHDKOTwTTYLh5KmRpslkYHR\
|
||||
ivcJSkbh/C+BR3utDS555mV'</span>
|
||||
|
||||
<span class="py-src-variable">privateKey</span> = <span class="py-src-string">"""-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIByAIBAAJhAK8ycfDmDpyZs3+LXwRLy4vA1T6yd/3PZNiPwM+uH8Yx3/YpskSW
|
||||
4sbUIZR/ZXzY1CMfuC5qyR+UDUbBaaK3Bwyjk8E02C4eSpkabJZGB0Yr3CUpG4fw
|
||||
vgUd7rQ0ueeZlQIBIwJgbh+1VZfr7WftK5lu7MHtqE1S1vPWZQYE3+VUn8yJADyb
|
||||
Z4fsZaCrzW9lkIqXkE3GIY+ojdhZhkO1gbG0118sIgphwSWKRxK0mvh6ERxKqIt1
|
||||
xJEJO74EykXZV4oNJ8sjAjEA3J9r2ZghVhGN6V8DnQrTk24Td0E8hU8AcP0FVP+8
|
||||
PQm/g/aXf2QQkQT+omdHVEJrAjEAy0pL0EBH6EVS98evDCBtQw22OZT52qXlAwZ2
|
||||
gyTriKFVoqjeEjt3SZKKqXHSApP/AjBLpF99zcJJZRq2abgYlf9lv1chkrWqDHUu
|
||||
DZttmYJeEfiFBBavVYIF1dOlZT0G8jMCMBc7sOSZodFnAiryP+Qg9otSBjJ3bQML
|
||||
pSTqy7c3a2AScC/YyOwkDaICHnnD3XyjMwIxALRzl0tQEKMXs6hH8ToUdlLROCrP
|
||||
EhQ0wahUTCk1gKA4uPD6TMTChavbh4K63OvbKg==
|
||||
-----END RSA PRIVATE KEY-----"""</span>
|
||||
|
||||
<span class="py-src-keyword">class</span> <span class="py-src-identifier">ClientUserAuth</span>(<span class="py-src-parameter">userauth</span>.<span class="py-src-parameter">SSHUserAuthClient</span>):
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">getPassword</span>(<span class="py-src-parameter">self</span>, <span class="py-src-parameter">prompt</span> = <span class="py-src-parameter">None</span>):
|
||||
<span class="py-src-keyword">return</span>
|
||||
<span class="py-src-comment"># this says we won't do password authentication</span>
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">getPublicKey</span>(<span class="py-src-parameter">self</span>):
|
||||
<span class="py-src-keyword">return</span> <span class="py-src-variable">keys</span>.<span class="py-src-variable">getPublicKeyString</span>(<span class="py-src-variable">data</span> = <span class="py-src-variable">publicKey</span>)
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">getPrivateKey</span>(<span class="py-src-parameter">self</span>):
|
||||
<span class="py-src-keyword">return</span> <span class="py-src-variable">defer</span>.<span class="py-src-variable">succeed</span>(<span class="py-src-variable">keys</span>.<span class="py-src-variable">getPrivateKeyObject</span>(<span class="py-src-variable">data</span> = <span class="py-src-variable">privateKey</span>))
|
||||
</pre>
|
||||
|
||||
<p>Again, fairly simple. The <code class="python">SSHUserAuthClient</code> takes care of most
|
||||
of the work, but the actual authentication data needs to be
|
||||
supplied. <code class="python">getPassword()</code> asks for a
|
||||
password, <code class="python">getPublicKey()</code> and <code class="python">getPrivateKey()</code> get public and private keys,
|
||||
respectively. <code class="python">getPassword()</code> returns
|
||||
a <code class="python">Deferred</code> that is called back with
|
||||
the password to use. <code class="python">getPublicKey()</code>
|
||||
returns the SSH key data for the public key to use. <code class="python">keys.getPublicKeyString()</code> will take
|
||||
keys in OpenSSH and LSH format, and convert them to the
|
||||
required format. <code class="python">getPrivateKey()</code>
|
||||
returns a <code class="python">Deferred</code> which is
|
||||
called back with the key object (as used in PyCrypto) for
|
||||
the private key. <code class="python">getPassword()</code>
|
||||
and <code class="python">getPrivateKey()</code> return <code class="python">Deferreds</code> because they may need to ask the user
|
||||
for input.</p>
|
||||
|
||||
<p>Once the authentication is complete, <code class="python">SSHUserAuthClient</code> takes care of starting the code
|
||||
<code class="python">SSHConnection</code> object given to it. Next, we'll
|
||||
look at how to use the <code class="python">SSHConnection</code></p>
|
||||
|
||||
<h2>The Connection<a name="auto4"/></h2>
|
||||
|
||||
<pre class="python"><p class="py-linenumber">1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
</p><span class="py-src-keyword">from</span> <span class="py-src-variable">twisted</span>.<span class="py-src-variable">conch</span>.<span class="py-src-variable">ssh</span> <span class="py-src-keyword">import</span> <span class="py-src-variable">connection</span>
|
||||
|
||||
<span class="py-src-keyword">class</span> <span class="py-src-identifier">ClientConnection</span>(<span class="py-src-parameter">connection</span>.<span class="py-src-parameter">SSHConnection</span>):
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">serviceStarted</span>(<span class="py-src-parameter">self</span>):
|
||||
<span class="py-src-variable">self</span>.<span class="py-src-variable">openChannel</span>(<span class="py-src-variable">CatChannel</span>(<span class="py-src-variable">conn</span> = <span class="py-src-variable">self</span>))
|
||||
</pre>
|
||||
|
||||
<p><code class="python">SSHConnection</code> is the easiest,
|
||||
as it's only responsible for starting the channels. It has
|
||||
other methods, those will be examined when we look at <code class="python">SSHChannel</code>.</p>
|
||||
|
||||
<h2>The Channel<a name="auto5"/></h2>
|
||||
|
||||
<pre class="python"><p class="py-linenumber"> 1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
</p><span class="py-src-keyword">from</span> <span class="py-src-variable">twisted</span>.<span class="py-src-variable">conch</span>.<span class="py-src-variable">ssh</span> <span class="py-src-keyword">import</span> <span class="py-src-variable">channel</span>, <span class="py-src-variable">common</span>
|
||||
|
||||
<span class="py-src-keyword">class</span> <span class="py-src-identifier">CatChannel</span>(<span class="py-src-parameter">channel</span>.<span class="py-src-parameter">SSHChannel</span>):
|
||||
|
||||
<span class="py-src-variable">name</span> = <span class="py-src-string">'session'</span>
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">channelOpen</span>(<span class="py-src-parameter">self</span>, <span class="py-src-parameter">data</span>):
|
||||
<span class="py-src-variable">d</span> = <span class="py-src-variable">self</span>.<span class="py-src-variable">conn</span>.<span class="py-src-variable">sendRequest</span>(<span class="py-src-variable">self</span>, <span class="py-src-string">'exec'</span>, <span class="py-src-variable">common</span>.<span class="py-src-variable">NS</span>(<span class="py-src-string">'cat'</span>),
|
||||
<span class="py-src-variable">wantReply</span> = <span class="py-src-number">1</span>)
|
||||
<span class="py-src-variable">d</span>.<span class="py-src-variable">addCallback</span>(<span class="py-src-variable">self</span>.<span class="py-src-variable">_cbSendRequest</span>)
|
||||
<span class="py-src-variable">self</span>.<span class="py-src-variable">catData</span> = <span class="py-src-string">''</span>
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">_cbSendRequest</span>(<span class="py-src-parameter">self</span>, <span class="py-src-parameter">ignored</span>):
|
||||
<span class="py-src-variable">self</span>.<span class="py-src-variable">write</span>(<span class="py-src-string">'This data will be echoed back to us by "cat."\r\n'</span>)
|
||||
<span class="py-src-variable">self</span>.<span class="py-src-variable">conn</span>.<span class="py-src-variable">sendEOF</span>(<span class="py-src-variable">self</span>)
|
||||
<span class="py-src-variable">self</span>.<span class="py-src-variable">loseConnection</span>()
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">dataReceived</span>(<span class="py-src-parameter">self</span>, <span class="py-src-parameter">data</span>):
|
||||
<span class="py-src-variable">self</span>.<span class="py-src-variable">catData</span> += <span class="py-src-variable">data</span>
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">closed</span>(<span class="py-src-parameter">self</span>):
|
||||
<span class="py-src-keyword">print</span> <span class="py-src-string">'We got this from "cat":'</span>, <span class="py-src-variable">self</span>.<span class="py-src-variable">catData</span>
|
||||
</pre>
|
||||
|
||||
<p>Now that we've spent all this time getting the server and
|
||||
client connected, here is where that work pays off. <code class="python">SSHChannel</code> is the interface between you and the
|
||||
other side. This particular channel opens a session and plays with the
|
||||
'cat' program, but your channel can implement anything, so long as the
|
||||
server supports it.</p>
|
||||
|
||||
<p>The <code class="python">channelOpen()</code> method is
|
||||
where everything gets started. It gets passed a chunk of data;
|
||||
however, this chunk is usually nothing and can be ignored.
|
||||
Our <code class="python">channelOpen()</code> initializes our
|
||||
channel, and sends a request to the other side, using the
|
||||
<code class="python">sendRequest()</code> method of the <code class="python">SSHConnection</code> object. Requests are used to send
|
||||
events to the other side. We pass the method self so that it knows to
|
||||
send the request for this channel. The 2nd argument of 'exec' tells the
|
||||
server that we want to execute a command. The third argument is the data
|
||||
that accompanies the request. <code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/common.NS.html" title="common.NS">common.NS</a></code> encodes
|
||||
the data as a length-prefixed string, which is how the server expects
|
||||
the data. We also say that we want a reply saying that the process has a
|
||||
been started. <code class="python">sendRequest()</code> then returns a
|
||||
<code class="python">Deferred</code> which we add a callback for.</p>
|
||||
|
||||
<p>Once the callback fires, we send the data. <code class="python">SSHChannel</code> supports the <code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/
|
||||
.html" title="
|
||||
">
|
||||
twisted.internet.interface.Transport</a></code> interface, so
|
||||
it can be given to Protocols to run them over the secure
|
||||
connection. In our case, we just write the data directly. <code class="python">sendEOF()</code> does not follow the interface,
|
||||
but Conch uses it to tell the other side that we will write no
|
||||
more data. <code class="python">loseConnection()</code> shuts
|
||||
down our side of the connection, but we will still receive data
|
||||
through <code class="python">dataReceived()</code>. The <code class="python">closed()</code> method is called when both sides of the
|
||||
connection are closed, and we use it to display the data we received
|
||||
(which should be the same as the data we sent.)</p>
|
||||
|
||||
<p>Finally, let's actually invoke the code we've set up.</p>
|
||||
|
||||
<h2>The main() function<a name="auto6"/></h2>
|
||||
<pre class="python"><p class="py-linenumber"> 1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
</p><span class="py-src-keyword">from</span> <span class="py-src-variable">twisted</span>.<span class="py-src-variable">internet</span> <span class="py-src-keyword">import</span> <span class="py-src-variable">protocol</span>, <span class="py-src-variable">reactor</span>
|
||||
|
||||
<span class="py-src-keyword">def</span> <span class="py-src-identifier">main</span>():
|
||||
<span class="py-src-variable">factory</span> = <span class="py-src-variable">protocol</span>.<span class="py-src-variable">ClientFactory</span>()
|
||||
<span class="py-src-variable">factory</span>.<span class="py-src-variable">protocol</span> = <span class="py-src-variable">ClientTransport</span>
|
||||
<span class="py-src-variable">reactor</span>.<span class="py-src-variable">connectTCP</span>(<span class="py-src-string">'localhost'</span>, <span class="py-src-number">22</span>, <span class="py-src-variable">factory</span>)
|
||||
<span class="py-src-variable">reactor</span>.<span class="py-src-variable">run</span>()
|
||||
|
||||
<span class="py-src-keyword">if</span> <span class="py-src-variable">__name__</span> == <span class="py-src-string">"__main__"</span>:
|
||||
<span class="py-src-variable">main</span>()
|
||||
</pre>
|
||||
|
||||
<P>We call <code class="python">connectTCP()</code> to connect to
|
||||
localhost, port 22 (the standard port for ssh), and pass it an instance
|
||||
of <code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/twisted.internet.protocol.ClientFactory.html" title="twisted.internet.protocol.ClientFactory">twisted.internet.protocol.ClientFactory</a></code>.
|
||||
This instance has the attribute <code class="python">protocol</code>
|
||||
set to our earlier <code class="python">ClientTransport</code>
|
||||
class. Note that the protocol attribute is set to the class <code class="python">ClientTransport</code>, not an instance of
|
||||
<code class="python">ClientTransport</code>! When the <code class="python">connectTCP</code> call completes, the protocol will be
|
||||
called to create a <code class="python">ClientTransport()</code> object
|
||||
- this then invokes all our previous work.</P>
|
||||
|
||||
<P>It's worth noting that in the example <code class="python">main()</code>
|
||||
routine, the <code class="python">reactor.run()</code> call never returns.
|
||||
If you want to make the program exit, call
|
||||
<code class="python">reactor.stop()</code> in the earlier
|
||||
<code class="python">closed()</code> method.</P>
|
||||
|
||||
<P>If you wish to observe the interactions in more detail, adding a call
|
||||
to <code class="python">log.startLogging(sys.stdout, setStdout=0)</code>
|
||||
before the <code class="python">reactor.run()</code> call will send all
|
||||
logging to stdout.</P>
|
||||
|
||||
</div>
|
||||
|
||||
<p><a href="index.html">Index</a></p>
|
||||
<span class="version">Version: 10.0.0</span>
|
||||
</body>
|
||||
</html>
|
28
vendor/Twisted-10.0.0/doc/conch/howto/index.html
vendored
Normal file
28
vendor/Twisted-10.0.0/doc/conch/howto/index.html
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Twisted Documentation: Twisted Documentation</title>
|
||||
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h1 class="title">Twisted Documentation</h1>
|
||||
<div class="toc"><ol/></div>
|
||||
<div class="content">
|
||||
|
||||
<span/>
|
||||
|
||||
<ul class="toc">
|
||||
<li>Tutorial
|
||||
<ul>
|
||||
<li>
|
||||
<a href="conch_client.html" shape="rect">Writing an SSH client with Conch</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p><a href="index.html">Index</a></p>
|
||||
<span class="version">Version: 10.0.0</span>
|
||||
</body>
|
||||
</html>
|
25
vendor/Twisted-10.0.0/doc/conch/index.html
vendored
Normal file
25
vendor/Twisted-10.0.0/doc/conch/index.html
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Twisted Documentation: Twisted Conch Documentation</title>
|
||||
<link href="howto/stylesheet.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h1 class="title">Twisted Conch Documentation</h1>
|
||||
<div class="toc"><ol/></div>
|
||||
<div class="content">
|
||||
<span/>
|
||||
|
||||
<ul>
|
||||
<li><a href="howto/index.html" shape="rect">Developer guides</a>: documentation on using
|
||||
Twisted Conch to develop your own applications</li>
|
||||
<li><a href="examples/index.html" shape="rect">Examples</a>: short code examples using
|
||||
Twisted Conch</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<p><a href="howto/index.html">Index</a></p>
|
||||
<span class="version">Version: 10.0.0</span>
|
||||
</body>
|
||||
</html>
|
87
vendor/Twisted-10.0.0/doc/conch/man/cftp-man.html
vendored
Normal file
87
vendor/Twisted-10.0.0/doc/conch/man/cftp-man.html
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Twisted Documentation: CFTP.1</title>
|
||||
<link href="../howto/stylesheet.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h1 class="title">CFTP.1</h1>
|
||||
<div class="toc"><ol><li><a href="#auto0">NAME</a></li><li><a href="#auto1">SYNOPSIS</a></li><li><a href="#auto2">DESCRIPTION</a></li><li><a href="#auto3">AUTHOR</a></li><li><a href="#auto4">REPORTING BUGS</a></li><li><a href="#auto5">COPYRIGHT</a></li></ol></div>
|
||||
<div class="content">
|
||||
|
||||
<span/>
|
||||
|
||||
<h2>NAME<a name="auto0"/></h2>
|
||||
|
||||
<p>cftp </p>
|
||||
|
||||
<h2>SYNOPSIS<a name="auto1"/></h2>
|
||||
|
||||
<p>cftp [<strong>-B</strong><em> buffer_size</em>][<strong>-b</strong><em> command_file</em>][<strong>-R</strong><em> num_requests</em>][<strong>-s</strong><em> subsystem</em>]</p>
|
||||
|
||||
<h2>DESCRIPTION<a name="auto2"/></h2>
|
||||
|
||||
<p>cftp is a client for logging into a remote machine and executing commands to send and receive file information. It can wrap a number of file transfer subsystems
|
||||
</p>
|
||||
|
||||
<p>The options are as follows:
|
||||
<dl><dt><strong>-B</strong></dt><dd>Specifies the default size of the buffer to use for sending and receiving. (Default value: 32768 bytes.)
|
||||
</dd><dt><strong>-b</strong></dt><dd>File to read commands from, '-' for stdin. (Default value: interactive/stdin.)
|
||||
</dd><dt><strong>-R</strong></dt><dd>Number of requests to make before waiting for a reply.
|
||||
</dd><dt><strong>-s</strong></dt><dd>Subsystem/server program to connect to.
|
||||
</dd></dl>
|
||||
|
||||
</p>
|
||||
|
||||
<p>The following commands are recognised by
|
||||
cftp :
|
||||
<dl><dt>cd <u>path</u></dt><dd>Change the remote directory to 'path'.
|
||||
</dd><dt>chgrp <u>gid</u> <u>path</u></dt><dd>Change the gid of 'path' to 'gid'.
|
||||
</dd><dt>chmod <u>mode</u> <u>path</u></dt><dd>Change mode of 'path' to 'mode'.
|
||||
</dd><dt>chown <u>uid</u> <u>path</u></dt><dd>Change uid of 'path' to 'uid'.
|
||||
</dd><dt>exit</dt><dd>Disconnect from the server.
|
||||
</dd><dt>get <u>remote-path</u> [<u>local-path</u>]</dt><dd>Get remote file and optionally store it at specified local path.
|
||||
</dd><dt>help</dt><dd>Get a list of available commands.
|
||||
</dd><dt>lcd <u>path</u></dt><dd>Change local directory to 'path'.
|
||||
</dd><dt>lls [<u>ls-options</u>] [<u>path</u>]</dt><dd>Display local directory listing.
|
||||
</dd><dt>lmkdir <u>path</u></dt><dd>Create local directory.
|
||||
</dd><dt>ln <u>linkpath</u> <u>targetpath</u></dt><dd>Symlink remote file.
|
||||
</dd><dt>lpwd</dt><dd>Print the local working directory.
|
||||
</dd><dt>ls [<u>-l</u>] [<u>path</u>]</dt><dd>Display remote directory listing.
|
||||
</dd><dt>mkdir <u>path</u></dt><dd>Create remote directory.
|
||||
</dd><dt>progress</dt><dd>Toggle progress bar.
|
||||
</dd><dt>put <u>local-path</u> [<u>remote-path</u>]</dt><dd>Transfer local file to remote location
|
||||
</dd><dt>pwd</dt><dd>Print the remote working directory.
|
||||
</dd><dt>quit</dt><dd>Disconnect from the server.
|
||||
</dd><dt>rename <u>oldpath</u> <u>newpath</u></dt><dd>Rename remote file.
|
||||
</dd><dt>rmdir <u>path</u></dt><dd>Remove remote directory.
|
||||
</dd><dt>rm <u>path</u></dt><dd>Remove remote file.
|
||||
</dd><dt>version</dt><dd>Print the SFTP version.
|
||||
</dd><dt>?</dt><dd>Synonym for 'help'.
|
||||
</dd></dl>
|
||||
|
||||
</p>
|
||||
|
||||
<h2>AUTHOR<a name="auto3"/></h2>
|
||||
|
||||
<p>cftp by Paul Swartz <z3p@twistedmatrix.com>. Man page by Mary Gardiner <mary@twistedmatrix.com>.
|
||||
</p>
|
||||
|
||||
<h2>REPORTING BUGS<a name="auto4"/></h2>
|
||||
|
||||
<p>Report bugs to <em>http://twistedmatrix.com/bugs/</em>
|
||||
</p>
|
||||
|
||||
<h2>COPYRIGHT<a name="auto5"/></h2>
|
||||
|
||||
<p>Copyright © 2005-2008 Twisted Matrix Laboratories
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<p><a href="../howto/index.html">Index</a></p>
|
||||
<span class="version">Version: 10.0.0</span>
|
||||
</body>
|
||||
</html>
|
89
vendor/Twisted-10.0.0/doc/conch/man/cftp.1
vendored
Normal file
89
vendor/Twisted-10.0.0/doc/conch/man/cftp.1
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
.Dd October 8, 2005
|
||||
.Dt CFTP 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm cftp
|
||||
.Nd Conch command-line SFTP client
|
||||
.Sh SYNOPSIS
|
||||
.Nm cftp
|
||||
.Op Fl B Ar buffer_size
|
||||
.Op Fl b Ar command_file
|
||||
.Op Fl R Ar num_requests
|
||||
.Op Fl s Ar subsystem
|
||||
.Os
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is a client for logging into a remote machine and executing commands to send and receive file information. It can wrap a number of file transfer subsystems
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl B
|
||||
Specifies the default size of the buffer to use for sending and receiving. (Default value: 32768 bytes.)
|
||||
.It Fl b
|
||||
File to read commands from, '-' for stdin. (Default value: interactive/stdin.)
|
||||
.It Fl R
|
||||
Number of requests to make before waiting for a reply.
|
||||
.It Fl s
|
||||
Subsystem/server program to connect to.
|
||||
.El
|
||||
.Pp
|
||||
The following commands are recognised by
|
||||
.Nm
|
||||
:
|
||||
.Bl -tag -width Ds
|
||||
.It Ic cd Ar path
|
||||
Change the remote directory to 'path'.
|
||||
.It Ic chgrp Ar gid Ar path
|
||||
Change the gid of 'path' to 'gid'.
|
||||
.It Ic chmod Ar mode Ar path
|
||||
Change mode of 'path' to 'mode'.
|
||||
.It Ic chown Ar uid Ar path
|
||||
Change uid of 'path' to 'uid'.
|
||||
.It Ic exit
|
||||
Disconnect from the server.
|
||||
.It Ic get Ar remote-path Op Ar local-path
|
||||
Get remote file and optionally store it at specified local path.
|
||||
.It Ic help
|
||||
Get a list of available commands.
|
||||
.It Ic lcd Ar path
|
||||
Change local directory to 'path'.
|
||||
.It Ic lls Op Ar ls-options Op Ar path
|
||||
Display local directory listing.
|
||||
.It Ic lmkdir Ar path
|
||||
Create local directory.
|
||||
.It Ic ln Ar linkpath Ar targetpath
|
||||
Symlink remote file.
|
||||
.It Ic lpwd
|
||||
Print the local working directory.
|
||||
.It Ic ls Op Ar -l Op Ar path
|
||||
Display remote directory listing.
|
||||
.It Ic mkdir Ar path
|
||||
Create remote directory.
|
||||
.It Ic progress
|
||||
Toggle progress bar.
|
||||
.It Ic put Ar local-path Op Ar remote-path
|
||||
Transfer local file to remote location
|
||||
.It Ic pwd
|
||||
Print the remote working directory.
|
||||
.It Ic quit
|
||||
Disconnect from the server.
|
||||
.It Ic rename Ar oldpath Ar newpath
|
||||
Rename remote file.
|
||||
.It Ic rmdir Ar path
|
||||
Remove remote directory.
|
||||
.It Ic rm Ar path
|
||||
Remove remote file.
|
||||
.It Ic version
|
||||
Print the SFTP version.
|
||||
.It Ic ?
|
||||
Synonym for 'help'.
|
||||
.El
|
||||
.Sh AUTHOR
|
||||
cftp by Paul Swartz <z3p@twistedmatrix.com>. Man page by Mary Gardiner <mary@twistedmatrix.com>.
|
||||
.Sh "REPORTING BUGS"
|
||||
Report bugs to \fIhttp://twistedmatrix.com/bugs/\fR
|
||||
.Sh COPYRIGHT
|
||||
Copyright \(co 2005-2008 Twisted Matrix Laboratories
|
||||
.br
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
107
vendor/Twisted-10.0.0/doc/conch/man/ckeygen-man.html
vendored
Normal file
107
vendor/Twisted-10.0.0/doc/conch/man/ckeygen-man.html
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Twisted Documentation: CKEYGEN.1</title>
|
||||
<link href="../howto/stylesheet.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h1 class="title">CKEYGEN.1</h1>
|
||||
<div class="toc"><ol><li><a href="#auto0">NAME</a></li><li><a href="#auto1">SYNOPSIS</a></li><li><a href="#auto2">DESCRIPTION</a></li><li><a href="#auto3">DESCRIPTION</a></li><li><a href="#auto4">AUTHOR</a></li><li><a href="#auto5">REPORTING BUGS</a></li><li><a href="#auto6">COPYRIGHT</a></li><li><a href="#auto7">SEE ALSO</a></li></ol></div>
|
||||
<div class="content">
|
||||
|
||||
<span/>
|
||||
|
||||
<h2>NAME<a name="auto0"/></h2>
|
||||
|
||||
<p>ckeygen - connect to SSH servers
|
||||
</p>
|
||||
|
||||
<h2>SYNOPSIS<a name="auto1"/></h2>
|
||||
|
||||
<p><strong>ckeygen</strong> [-b <em>bits</em>] [-f <em>filename</em>] [-t <em>type</em>]<strong>[-C</strong> <em>comment</em>] [-N <em>new passphrase</em>] [-P <em>old passphrase</em>]<strong>[-l]</strong> [-p] [-q] [-y]<strong>ckeygen</strong> --help</p>
|
||||
|
||||
<h2>DESCRIPTION<a name="auto2"/></h2>
|
||||
|
||||
<p>The <strong>--help</strong> prints out a usage message to standard output.
|
||||
<dl><dt><strong>-b</strong>, <strong>--bits</strong> <bits>
|
||||
</dt><dd>Number of bits in the key to create (default: 1024)
|
||||
</dd>
|
||||
|
||||
<dt><strong>-f</strong>, <strong>--filename</strong> <file name>
|
||||
</dt><dd>Filename of the key file.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-t</strong>, <strong>--type</strong> <type>
|
||||
</dt><dd>Type of key (rsa or dsa).
|
||||
</dd>
|
||||
|
||||
<dt><strong>-C</strong>, <strong>--comment</strong> <comment>
|
||||
</dt><dd>Provide a new comment.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-N</strong>, <strong>--newpass</strong> <pass phrase>
|
||||
</dt><dd>Provide new passphrase.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-P</strong>, <strong>--pass</strong> <pass phrase>
|
||||
</dt><dd>Provide old passphrase.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-l</strong>, <strong>--fingerprint</strong>
|
||||
</dt><dd>Show fingerprint of key file.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-p</strong>, <strong>--changepass</strong>
|
||||
</dt><dd>Change passphrase of private key file.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-q</strong>, <strong>--quiet</strong>
|
||||
</dt><dd>Be quiet.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-y</strong>, <strong>--showpub</strong>
|
||||
</dt><dd>Read private key file and print public key.
|
||||
</dd>
|
||||
|
||||
<dt><strong>--version</strong>
|
||||
</dt><dd>Display version number only.
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
</p>
|
||||
|
||||
<h2>DESCRIPTION<a name="auto3"/></h2>
|
||||
|
||||
<p>Manipulate public/private keys in various ways.
|
||||
If no filename is given, a file name will be requested interactively.
|
||||
</p>
|
||||
|
||||
<h2>AUTHOR<a name="auto4"/></h2>
|
||||
|
||||
<p>Written by Moshe Zadka, based on ckeygen's help messages
|
||||
</p>
|
||||
|
||||
<h2>REPORTING BUGS<a name="auto5"/></h2>
|
||||
|
||||
<p>To report a bug, visit <em>http://twistedmatrix.com/bugs/</em>
|
||||
</p>
|
||||
|
||||
<h2>COPYRIGHT<a name="auto6"/></h2>
|
||||
|
||||
<p>Copyright © 2002-2008 Twisted Matrix Laboratories.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
</p>
|
||||
|
||||
<h2>SEE ALSO<a name="auto7"/></h2>
|
||||
|
||||
<p>ssh(1), conch(1)
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<p><a href="../howto/index.html">Index</a></p>
|
||||
<span class="version">Version: 10.0.0</span>
|
||||
</body>
|
||||
</html>
|
58
vendor/Twisted-10.0.0/doc/conch/man/ckeygen.1
vendored
Normal file
58
vendor/Twisted-10.0.0/doc/conch/man/ckeygen.1
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
.TH CKEYGEN "1" "October 2002" "" ""
|
||||
.SH NAME
|
||||
ckeygen \- connect to SSH servers
|
||||
.SH SYNOPSIS
|
||||
.B ckeygen [-b \fIbits\fR] [-f \fIfilename\fR] [-t \fItype\fR]
|
||||
.B [-C \fIcomment\fR] [-N \fInew passphrase\fR] [-P \fIold passphrase\fR]
|
||||
.B [-l] [-p] [-q] [-y]
|
||||
.B ckeygen --help
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fB\--help\fR prints out a usage message to standard output.
|
||||
.TP
|
||||
\fB-b\fR, \fB--bits\fR <bits>
|
||||
Number of bits in the key to create (default: 1024)
|
||||
.TP
|
||||
\fB-f\fR, \fB--filename\fR <file name>
|
||||
Filename of the key file.
|
||||
.TP
|
||||
\fB-t\fR, \fB--type\fR <type>
|
||||
Type of key (rsa or dsa).
|
||||
.TP
|
||||
\fB-C\fR, \fB--comment\fR <comment>
|
||||
Provide a new comment.
|
||||
.TP
|
||||
\fB-N\fR, \fB--newpass\fR <pass phrase>
|
||||
Provide new passphrase.
|
||||
.TP
|
||||
\fB-P\fR, \fB--pass\fR <pass phrase>
|
||||
Provide old passphrase.
|
||||
.TP
|
||||
\fB-l\fR, \fB--fingerprint\fR
|
||||
Show fingerprint of key file.
|
||||
.TP
|
||||
\fB-p\fR, \fB--changepass\fR
|
||||
Change passphrase of private key file.
|
||||
.TP
|
||||
\fB-q\fR, \fB--quiet\fR
|
||||
Be quiet.
|
||||
.TP
|
||||
\fB-y\fR, \fB--showpub\fR
|
||||
Read private key file and print public key.
|
||||
.TP
|
||||
\fB--version\fR
|
||||
Display version number only.
|
||||
.SH DESCRIPTION
|
||||
Manipulate public/private keys in various ways.
|
||||
If no filename is given, a file name will be requested interactively.
|
||||
.SH AUTHOR
|
||||
Written by Moshe Zadka, based on ckeygen's help messages
|
||||
.SH "REPORTING BUGS"
|
||||
To report a bug, visit \fIhttp://twistedmatrix.com/bugs/\fR
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2002-2008 Twisted Matrix Laboratories.
|
||||
.br
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.SH "SEE ALSO"
|
||||
ssh(1), conch(1)
|
148
vendor/Twisted-10.0.0/doc/conch/man/conch-man.html
vendored
Normal file
148
vendor/Twisted-10.0.0/doc/conch/man/conch-man.html
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Twisted Documentation: CONCH.1</title>
|
||||
<link href="../howto/stylesheet.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h1 class="title">CONCH.1</h1>
|
||||
<div class="toc"><ol><li><a href="#auto0">NAME</a></li><li><a href="#auto1">SYNOPSIS</a></li><li><a href="#auto2">DESCRIPTION</a></li><li><a href="#auto3">AUTHOR</a></li><li><a href="#auto4">REPORTING BUGS</a></li><li><a href="#auto5">COPYRIGHT</a></li><li><a href="#auto6">SEE ALSO</a></li></ol></div>
|
||||
<div class="content">
|
||||
|
||||
<span/>
|
||||
|
||||
<h2>NAME<a name="auto0"/></h2>
|
||||
|
||||
<p>conch </p>
|
||||
|
||||
<h2>SYNOPSIS<a name="auto1"/></h2>
|
||||
|
||||
<p>conch [<strong>-AaCfINnrsTtVvx</strong>][<strong>-c</strong><em> cipher_spec</em>][<strong>-e</strong><em> escape_char</em>][<strong>-i</strong><em> identity_file</em>][<strong>-K</strong><em> connection_spec</em>][<strong>-L</strong><em> port</em>:<em> host</em>:<em> hostport</em>][<strong>-l</strong><em> user</em>][<strong>-m</strong><em> mac_spec</em>][<strong>-o</strong><em> openssh_option</em>][<strong>-p</strong><em> port</em>][<strong>-R</strong><em> port</em>:<em> host</em>:<em> hostport</em>][<em> user</em>@]<em> hostname</em>[<em> command</em>]</p>
|
||||
|
||||
<h2>DESCRIPTION<a name="auto2"/></h2>
|
||||
|
||||
<p>conch is a SSHv2 client for logging into a remote machine and executing commands. It provides encrypted and secure communications across a possibly insecure network. Arbitrary TCP/IP ports can also be forwarded over the secure connection.
|
||||
</p>
|
||||
|
||||
<p>conch connects and logs into
|
||||
<em> hostname</em>(as
|
||||
<em> user</em>or the current username). The user must prove her/his identity through a public-key or a password. Alternatively, if a connection is already open to a server, a new shell can be opened over the connection without having to reauthenticate.
|
||||
</p>
|
||||
|
||||
<p>If
|
||||
<em> command</em>is specified,
|
||||
<em> command</em>is executed instead of a shell. If the
|
||||
<strong>-s</strong>option is given,
|
||||
<em> command</em>is treated as an SSHv2 subsystem name.
|
||||
Conch supports the public-key, keyboard-interactive, and password authentications.
|
||||
</p>
|
||||
|
||||
<p>The public-key method allows the RSA or DSA algorithm to be used. The client uses his/her private key,
|
||||
or
|
||||
to sign the session identifier, known only by the client and server. The server checks that the matching public key is valid for the user, and that the signature is correct.
|
||||
</p>
|
||||
|
||||
<p>If public-key authentication fails,
|
||||
conch can authenticate by sending an encrypted password over the connection.
|
||||
conch has the ability to multiplex multiple shells, commands and TCP/IP ports over the same secure connection. To disable multiplexing for a connection, use the
|
||||
<strong>-I</strong>flag.
|
||||
</p>
|
||||
|
||||
<p>The
|
||||
<strong>-K</strong>option determines how the client connects to the remote host. It is a comma-separated list of the methods to use, in order of preference. The two connection methods are
|
||||
(for connecting over a multiplexed connection) and
|
||||
(to connect directly).
|
||||
To disable connecting over a multiplexed connection, do not include
|
||||
in the preference list.
|
||||
</p>
|
||||
|
||||
<p>As an example of how connection sharing works, to speed up CVS over SSH:
|
||||
</p>
|
||||
|
||||
<p>conch --noshell --fork -l cvs_user cvs_host
|
||||
set CVS_RSH=<strong>conch</strong>
|
||||
</p>
|
||||
|
||||
<p>Now, when CVS connects to cvs_host as cvs_user, instead of making a new connection to the server,
|
||||
conch will add a new channel to the existing connection. This saves the cost of repeatedly negotiating the cryptography and authentication.
|
||||
</p>
|
||||
|
||||
<p>The options are as follows:
|
||||
<dl><dt><strong>-A</strong></dt><dd>Enables authentication agent forwarding.
|
||||
</dd><dt><strong>-a</strong></dt><dd>Disables authentication agent forwarding (default).
|
||||
</dd><dt><strong>-C</strong></dt><dd>Enable compression.
|
||||
</dd><dt><strong>-c</strong></dt><dd><em> cipher_spec</em>Selects encryption algorithms to be used for this connection, as a comma-separated list of ciphers in order of preference. The list that
|
||||
conch supports is (in order of default preference): aes256-ctr, aes256-cbc, aes192-ctr, aes192-cbc, aes128-ctr, aes128-cbc, cast128-ctr, cast128-cbc, blowfish-ctr, blowfish, idea-ctr, idea-cbc, 3des-ctr, 3des-cbc.
|
||||
</dd><dt><strong>-e</strong></dt><dd><em> ch</em>| ^ch | noneSets the escape character for sessions with a PTY (default:
|
||||
The escape character is only recognized at the beginning of a line (after a newline).
|
||||
The escape character followed by a dot
|
||||
closes the connection;
|
||||
followed by ^Z suspends the connection;
|
||||
and followed by the escape character sends the escape character once.
|
||||
Setting the character to
|
||||
disables any escapes.
|
||||
</dd><dt><strong>-f</strong></dt><dd>Fork to background after authentication.
|
||||
</dd><dt><strong>-I</strong></dt><dd>Do not allow connection sharing over this connection.
|
||||
</dd><dt><strong>-i</strong></dt><dd><em> identity_spec</em>The file from which the identity (private key) for RSA or DSA authentication is read.
|
||||
The defaults are
|
||||
and
|
||||
It is possible to use this option more than once to use more than one private key.
|
||||
</dd><dt><strong>-K</strong></dt><dd><em> connection_spec</em>Selects methods for connection to the server, as a comma-separated list of methods in order of preference. See
|
||||
for more information.
|
||||
</dd><dt><strong>-L</strong></dt><dd><em> port</em>: host : hostportSpecifies that the given port on the client host is to be forwarded to the given host and port on the remote side. This allocates a socket to listen to
|
||||
<em> port</em>on the local side, and when connections are made to that socket, they are forwarded over the secure channel and a connection is made to
|
||||
<em> host</em>port
|
||||
<em> hostport</em>from the remote machine.
|
||||
Only root can forward privieged ports.
|
||||
</dd><dt><strong>-l</strong></dt><dd><em> user</em>Log in using this username.
|
||||
</dd><dt><strong>-m</strong></dt><dd><em> mac_spec</em>Selects MAC (message authentication code) algorithms, as a comma-separated list in order of preference. The list that
|
||||
conch supports is (in order of preference): hmac-sha1, hmac-md5.
|
||||
</dd><dt><strong>-N</strong></dt><dd>Do not execute a shell or command.
|
||||
</dd><dt><strong>-n</strong></dt><dd>Redirect input from /dev/null.
|
||||
</dd><dt><strong>-o</strong></dt><dd><em> openssh_option</em>Ignored OpenSSH options.
|
||||
</dd><dt><strong>-p</strong></dt><dd><em> port</em>The port to connect to on the server.
|
||||
</dd><dt><strong>-R</strong></dt><dd><em> port</em>: host : hostportSpecifies that the given port on the remote host is to be forwarded to the given host and port on the local side. This allocates a socket to listen to
|
||||
<em> port</em>on the remote side, and when connections are made to that socket, they are forwarded over the secure channel and a connection is made to
|
||||
<em> host</em>port
|
||||
<em> hostport</em>from the client host.
|
||||
Only root can forward privieged ports.
|
||||
</dd><dt><strong>-s</strong></dt><dd>Reconnect to the server if the connection is lost.
|
||||
</dd><dt><strong>-s</strong></dt><dd>Invoke
|
||||
<em> command</em>(mandatory) as a SSHv2 subsystem.
|
||||
</dd><dt><strong>-T</strong></dt><dd>Do not allocate a TTY.
|
||||
</dd><dt><strong>-t</strong></dt><dd>Allocate a TTY even if command is given.
|
||||
</dd><dt><strong>-V</strong></dt><dd>Display version number only.
|
||||
</dd><dt><strong>-v</strong></dt><dd>Log to stderr.
|
||||
</dd><dt><strong>-x</strong></dt><dd>Disable X11 connection forwarding (default).
|
||||
</dd></dl>
|
||||
|
||||
</p>
|
||||
|
||||
<h2>AUTHOR<a name="auto3"/></h2>
|
||||
|
||||
<p>Written by Paul Swartz <z3p@twistedmatrix.com>.
|
||||
</p>
|
||||
|
||||
<h2>REPORTING BUGS<a name="auto4"/></h2>
|
||||
|
||||
<p>To report a bug, visit <em>http://twistedmatrix.com/bugs/</em>
|
||||
</p>
|
||||
|
||||
<h2>COPYRIGHT<a name="auto5"/></h2>
|
||||
|
||||
<p>Copyright © 2002-2008 Twisted Matrix Laboratories.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
</p>
|
||||
|
||||
<h2>SEE ALSO<a name="auto6"/></h2>
|
||||
|
||||
<p>ssh(1)
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<p><a href="../howto/index.html">Index</a></p>
|
||||
<span class="version">Version: 10.0.0</span>
|
||||
</body>
|
||||
</html>
|
206
vendor/Twisted-10.0.0/doc/conch/man/conch.1
vendored
Normal file
206
vendor/Twisted-10.0.0/doc/conch/man/conch.1
vendored
Normal file
@ -0,0 +1,206 @@
|
||||
.Dd May 22, 2004
|
||||
.Dt CONCH 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm conch
|
||||
.Nd Conch SSH client
|
||||
.Sh SYNOPSIS
|
||||
.Nm conch
|
||||
.Op Fl AaCfINnrsTtVvx
|
||||
.Op Fl c Ar cipher_spec
|
||||
.Op Fl e Ar escape_char
|
||||
.Op Fl i Ar identity_file
|
||||
.Op Fl K Ar connection_spec
|
||||
.Bk -words
|
||||
.Oo Fl L Xo
|
||||
.Sm off
|
||||
.Ar port :
|
||||
.Ar host :
|
||||
.Ar hostport
|
||||
.Sm on
|
||||
.Xc
|
||||
.Oc
|
||||
.Ek
|
||||
.Op Fl l Ar user
|
||||
.Op Fl m Ar mac_spec
|
||||
.Op Fl o Ar openssh_option
|
||||
.Op Fl p Ar port
|
||||
.Bk -words
|
||||
.Oo Fl R Xo
|
||||
.Sm off
|
||||
.Ar port :
|
||||
.Ar host :
|
||||
.Ar hostport
|
||||
.Sm on
|
||||
.Xc
|
||||
.Oc
|
||||
.Ek
|
||||
.Oo Ar user Ns @ Ns Oc Ar hostname
|
||||
.Op Ar command
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is a SSHv2 client for logging into a remote machine and executing commands. It provides encrypted and secure communications across a possibly insecure network. Arbitrary TCP/IP ports can also be forwarded over the secure connection.
|
||||
.Pp
|
||||
.Nm
|
||||
connects and logs into
|
||||
.Ar hostname
|
||||
(as
|
||||
.Ar user
|
||||
or the current username). The user must prove her/his identity through a public\-key or a password. Alternatively, if a connection is already open to a server, a new shell can be opened over the connection without having to reauthenticate.
|
||||
.Pp
|
||||
If
|
||||
.Ar command
|
||||
is specified,
|
||||
.Ar command
|
||||
is executed instead of a shell. If the
|
||||
.Fl s
|
||||
option is given,
|
||||
.Ar command
|
||||
is treated as an SSHv2 subsystem name.
|
||||
.Ss Authentication
|
||||
Conch supports the public-key, keyboard-interactive, and password authentications.
|
||||
.Pp
|
||||
The public-key method allows the RSA or DSA algorithm to be used. The client uses his/her private key,
|
||||
.Pa $HOME/.ssh/id_rsa
|
||||
or
|
||||
.Pa $HOME/.ssh/id_dsa
|
||||
to sign the session identifier, known only by the client and server. The server checks that the matching public key is valid for the user, and that the signature is correct.
|
||||
.Pp
|
||||
If public-key authentication fails,
|
||||
.Nm
|
||||
can authenticate by sending an encrypted password over the connection.
|
||||
.Ss Connection sharing
|
||||
.Nm
|
||||
has the ability to multiplex multiple shells, commands and TCP/IP ports over the same secure connection. To disable multiplexing for a connection, use the
|
||||
.Fl I
|
||||
flag.
|
||||
.Pp
|
||||
The
|
||||
.Fl K
|
||||
option determines how the client connects to the remote host. It is a comma-separated list of the methods to use, in order of preference. The two connection methods are
|
||||
.Ql unix
|
||||
(for connecting over a multiplexed connection) and
|
||||
.Ql direct
|
||||
(to connect directly).
|
||||
To disable connecting over a multiplexed connection, do not include
|
||||
.Ql unix
|
||||
in the preference list.
|
||||
.Pp
|
||||
As an example of how connection sharing works, to speed up CVS over SSH:
|
||||
.Pp
|
||||
.Nm
|
||||
--noshell --fork -l cvs_user cvs_host
|
||||
.br
|
||||
set CVS_RSH=\fBconch\fR
|
||||
.Pp
|
||||
Now, when CVS connects to cvs_host as cvs_user, instead of making a new connection to the server,
|
||||
.Nm
|
||||
will add a new channel to the existing connection. This saves the cost of repeatedly negotiating the cryptography and authentication.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl A
|
||||
Enables authentication agent forwarding.
|
||||
.It Fl a
|
||||
Disables authentication agent forwarding (default).
|
||||
.It Fl C
|
||||
Enable compression.
|
||||
.It Fl c Ar cipher_spec
|
||||
Selects encryption algorithms to be used for this connection, as a comma-separated list of ciphers in order of preference. The list that
|
||||
.Nm
|
||||
supports is (in order of default preference): aes256-ctr, aes256-cbc, aes192-ctr, aes192-cbc, aes128-ctr, aes128-cbc, cast128-ctr, cast128-cbc, blowfish-ctr, blowfish, idea-ctr, idea-cbc, 3des-ctr, 3des-cbc.
|
||||
.It Fl e Ar ch | ^ch | none
|
||||
Sets the escape character for sessions with a PTY (default:
|
||||
.Ql ~ ) .
|
||||
The escape character is only recognized at the beginning of a line (after a newline).
|
||||
The escape character followed by a dot
|
||||
.Pq Ql \&.
|
||||
closes the connection;
|
||||
followed by ^Z suspends the connection;
|
||||
and followed by the escape character sends the escape character once.
|
||||
Setting the character to
|
||||
.Dq none
|
||||
disables any escapes.
|
||||
.It Fl f
|
||||
Fork to background after authentication.
|
||||
.It Fl I
|
||||
Do not allow connection sharing over this connection.
|
||||
.It Fl i Ar identity_spec
|
||||
The file from which the identity (private key) for RSA or DSA authentication is read.
|
||||
The defaults are
|
||||
.Pa $HOME/.ssh/id_rsa
|
||||
and
|
||||
.Pa $HOME/.ssh/id_dsa .
|
||||
It is possible to use this option more than once to use more than one private key.
|
||||
.It Fl K Ar connection_spec
|
||||
Selects methods for connection to the server, as a comma-separated list of methods in order of preference. See
|
||||
.Cm Connection sharing
|
||||
for more information.
|
||||
.It Fl L Xo
|
||||
.Sm off
|
||||
.Ar port : host : hostport
|
||||
.Sm on
|
||||
.Xc
|
||||
Specifies that the given port on the client host is to be forwarded to the given host and port on the remote side. This allocates a socket to listen to
|
||||
.Ar port
|
||||
on the local side, and when connections are made to that socket, they are forwarded over the secure channel and a connection is made to
|
||||
.Ar host
|
||||
port
|
||||
.Ar hostport
|
||||
from the remote machine.
|
||||
Only root can forward privieged ports.
|
||||
.It Fl l Ar user
|
||||
Log in using this username.
|
||||
.It Fl m Ar mac_spec
|
||||
Selects MAC (message authentication code) algorithms, as a comma-separated list in order of preference. The list that
|
||||
.Nm
|
||||
supports is (in order of preference): hmac-sha1, hmac-md5.
|
||||
.It Fl N
|
||||
Do not execute a shell or command.
|
||||
.It Fl n
|
||||
Redirect input from /dev/null.
|
||||
.It Fl o Ar openssh_option
|
||||
Ignored OpenSSH options.
|
||||
.It Fl p Ar port
|
||||
The port to connect to on the server.
|
||||
.It Fl R Xo
|
||||
.Sm off
|
||||
.Ar port : host : hostport
|
||||
.Sm on
|
||||
.Xc
|
||||
Specifies that the given port on the remote host is to be forwarded to the given host and port on the local side. This allocates a socket to listen to
|
||||
.Ar port
|
||||
on the remote side, and when connections are made to that socket, they are forwarded over the secure channel and a connection is made to
|
||||
.Ar host
|
||||
port
|
||||
.Ar hostport
|
||||
from the client host.
|
||||
Only root can forward privieged ports.
|
||||
.It Fl s
|
||||
Reconnect to the server if the connection is lost.
|
||||
.It Fl s
|
||||
Invoke
|
||||
.Ar command
|
||||
(mandatory) as a SSHv2 subsystem.
|
||||
.It Fl T
|
||||
Do not allocate a TTY.
|
||||
.It Fl t
|
||||
Allocate a TTY even if command is given.
|
||||
.It Fl V
|
||||
Display version number only.
|
||||
.It Fl v
|
||||
Log to stderr.
|
||||
.It Fl x
|
||||
Disable X11 connection forwarding (default).
|
||||
.El
|
||||
.Sh AUTHOR
|
||||
Written by Paul Swartz <z3p@twistedmatrix.com>.
|
||||
.Sh "REPORTING BUGS"
|
||||
To report a bug, visit \fIhttp://twistedmatrix.com/bugs/\fR
|
||||
.Sh COPYRIGHT
|
||||
Copyright \(co 2002-2008 Twisted Matrix Laboratories.
|
||||
.br
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.Sh SEE ALSO
|
||||
ssh(1)
|
129
vendor/Twisted-10.0.0/doc/conch/man/tkconch-man.html
vendored
Normal file
129
vendor/Twisted-10.0.0/doc/conch/man/tkconch-man.html
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Twisted Documentation: CONCH.1</title>
|
||||
<link href="../howto/stylesheet.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<h1 class="title">CONCH.1</h1>
|
||||
<div class="toc"><ol><li><a href="#auto0">NAME</a></li><li><a href="#auto1">SYNOPSIS</a></li><li><a href="#auto2">DESCRIPTION</a></li><li><a href="#auto3">DESCRIPTION</a></li><li><a href="#auto4">AUTHOR</a></li><li><a href="#auto5">REPORTING BUGS</a></li><li><a href="#auto6">COPYRIGHT</a></li><li><a href="#auto7">SEE ALSO</a></li></ol></div>
|
||||
<div class="content">
|
||||
|
||||
<span/>
|
||||
|
||||
<h2>NAME<a name="auto0"/></h2>
|
||||
|
||||
<p>tkconch - connect to SSH servers graphically
|
||||
</p>
|
||||
|
||||
<h2>SYNOPSIS<a name="auto1"/></h2>
|
||||
|
||||
<p><strong>conch</strong> [-l <em>user</em>] [-i <em>identity</em> [ -i <em>identity</em> ... ]] [-c <em>cipher</em>] [-m <em>MAC</em>] [-p <em>port</em>] [-n] [-t] [-T] [-V] [-C] [-N] [-s] [arg [...]]</p>
|
||||
|
||||
<p><strong>conch</strong> --help</p>
|
||||
|
||||
<h2>DESCRIPTION<a name="auto2"/></h2>
|
||||
|
||||
<p>The <strong>--help</strong> prints out a usage message to standard output.
|
||||
<dl><dt><strong>-l</strong>, <strong>--user</strong> <user>
|
||||
</dt><dd>Log in using this user name.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-e</strong>, <strong>--escape</strong> <escape character>
|
||||
</dt><dd>Set escape character; 'none' = disable (default: ~)
|
||||
</dd>
|
||||
|
||||
<dt><strong>-i</strong>, <strong>--identity</strong> <identity>
|
||||
</dt><dd>Add an identity file for public key authentication (default: ~/.ssh/identity)
|
||||
</dd>
|
||||
|
||||
<dt><strong>-c</strong>, <strong>--cipher</strong> <cipher>
|
||||
</dt><dd>Cipher algorithm to use.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-m</strong>, <strong>--macs</strong> <mac>
|
||||
</dt><dd>Specify MAC algorithms for protocol version 2.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-p</strong>, <strong>--port</strong> <port>
|
||||
</dt><dd>Port to connect to.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-L</strong>, <strong>--localforward</strong> <listen-port:host:port>
|
||||
</dt><dd>Forward local port to remote address.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-R</strong>, <strong>--remoteforward</strong> <listen-port:host:port>
|
||||
</dt><dd>Forward remote port to local address.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-t</strong>, <strong>--tty</strong>
|
||||
</dt><dd>Allocate a tty even if command is given.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-n</strong>, <strong>--notty</strong>
|
||||
</dt><dd>Do not allocate a tty.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-V</strong>, <strong>--version</strong>
|
||||
</dt><dd>Display version number only.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-C</strong>, <strong>--compress</strong>
|
||||
</dt><dd>Enable compression.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-a</strong>, <strong>--ansilog</strong>
|
||||
</dt><dd>Print the received data to stdout.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-N</strong>, <strong>--noshell</strong>
|
||||
</dt><dd>Do not execute a shell or command.
|
||||
</dd>
|
||||
|
||||
<dt><strong>-s</strong>, <strong>--subsystem</strong>
|
||||
</dt><dd>Invoke command (mandatory) as SSH2 subsystem.
|
||||
</dd>
|
||||
|
||||
<dt><strong>--log</strong>
|
||||
</dt><dd>Print the receieved data to stderr.
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
</p>
|
||||
|
||||
<h2>DESCRIPTION<a name="auto3"/></h2>
|
||||
|
||||
<p>Open an SSH connection to specified server, and either run the command
|
||||
given there or open a remote interactive shell.
|
||||
</p>
|
||||
|
||||
<h2>AUTHOR<a name="auto4"/></h2>
|
||||
|
||||
<p>Written by Moshe Zadka, based on conch's help messages
|
||||
</p>
|
||||
|
||||
<h2>REPORTING BUGS<a name="auto5"/></h2>
|
||||
|
||||
<p>To report a bug, visit <em>http://twistedmatrix.com/bugs/</em>
|
||||
</p>
|
||||
|
||||
<h2>COPYRIGHT<a name="auto6"/></h2>
|
||||
|
||||
<p>Copyright © 2002-2008 Twisted Matrix Laboratories.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
</p>
|
||||
|
||||
<h2>SEE ALSO<a name="auto7"/></h2>
|
||||
|
||||
<p>ssh(1)
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<p><a href="../howto/index.html">Index</a></p>
|
||||
<span class="version">Version: 10.0.0</span>
|
||||
</body>
|
||||
</html>
|
72
vendor/Twisted-10.0.0/doc/conch/man/tkconch.1
vendored
Normal file
72
vendor/Twisted-10.0.0/doc/conch/man/tkconch.1
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
.TH CONCH "1" "October 2002" "" ""
|
||||
.SH NAME
|
||||
tkconch \- connect to SSH servers graphically
|
||||
.SH SYNOPSIS
|
||||
.B conch [-l \fIuser\fR] [-i \fIidentity\fR [ -i \fIidentity\fR ... ]] [-c \fIcipher\fR] [-m \fIMAC\fR] [-p \fIport\fR] [-n] [-t] [-T] [-V] [-C] [-N] [-s] [arg [...]]
|
||||
.PP
|
||||
.B conch --help
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fB\--help\fR prints out a usage message to standard output.
|
||||
.TP
|
||||
\fB-l\fR, \fB--user\fR <user>
|
||||
Log in using this user name.
|
||||
.TP
|
||||
\fB-e\fR, \fB--escape\fR <escape character>
|
||||
Set escape character; 'none' = disable (default: ~)
|
||||
.TP
|
||||
\fB-i\fR, \fB--identity\fR <identity>
|
||||
Add an identity file for public key authentication (default: ~/.ssh/identity)
|
||||
.TP
|
||||
\fB-c\fR, \fB--cipher\fR <cipher>
|
||||
Cipher algorithm to use.
|
||||
.TP
|
||||
\fB-m\fR, \fB--macs\fR <mac>
|
||||
Specify MAC algorithms for protocol version 2.
|
||||
.TP
|
||||
\fB-p\fR, \fB--port\fR <port>
|
||||
Port to connect to.
|
||||
.TP
|
||||
\fB-L\fR, \fB--localforward\fR <listen-port:host:port>
|
||||
Forward local port to remote address.
|
||||
.TP
|
||||
\fB-R\fR, \fB--remoteforward\fR <listen-port:host:port>
|
||||
Forward remote port to local address.
|
||||
.TP
|
||||
\fB-t\fR, \fB--tty\fR
|
||||
Allocate a tty even if command is given.
|
||||
.TP
|
||||
\fB-n\fR, \fB--notty\fR
|
||||
Do not allocate a tty.
|
||||
.TP
|
||||
\fB-V\fR, \fB--version\fR
|
||||
Display version number only.
|
||||
.TP
|
||||
\fB-C\fR, \fB--compress\fR
|
||||
Enable compression.
|
||||
.TP
|
||||
\fB-a\fR, \fB--ansilog\fR
|
||||
Print the received data to stdout.
|
||||
.TP
|
||||
\fB-N\fR, \fB--noshell\fR
|
||||
Do not execute a shell or command.
|
||||
.TP
|
||||
\fB-s\fR, \fB--subsystem\fR
|
||||
Invoke command (mandatory) as SSH2 subsystem.
|
||||
.TP
|
||||
\fB--log\fR
|
||||
Print the receieved data to stderr.
|
||||
.SH DESCRIPTION
|
||||
Open an SSH connection to specified server, and either run the command
|
||||
given there or open a remote interactive shell.
|
||||
.SH AUTHOR
|
||||
Written by Moshe Zadka, based on conch's help messages
|
||||
.SH "REPORTING BUGS"
|
||||
To report a bug, visit \fIhttp://twistedmatrix.com/bugs/\fR
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2002-2008 Twisted Matrix Laboratories.
|
||||
.br
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.SH "SEE ALSO"
|
||||
ssh(1)
|
10
vendor/Twisted-10.0.0/doc/core/benchmarks/banana.py
vendored
Normal file
10
vendor/Twisted-10.0.0/doc/core/benchmarks/banana.py
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from timer import timeit
|
||||
from twisted.spread.banana import b1282int
|
||||
|
||||
ITERATIONS = 100000
|
||||
|
||||
for length in (1, 5, 10, 50, 100):
|
||||
elapsed = timeit(b1282int, ITERATIONS, "\xff" * length)
|
||||
print "b1282int %3d byte string: %10d cps" % (length, ITERATIONS / elapsed)
|
145
vendor/Twisted-10.0.0/doc/core/benchmarks/deferreds.py
vendored
Normal file
145
vendor/Twisted-10.0.0/doc/core/benchmarks/deferreds.py
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
# Copyright (c) 2007-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
"""
|
||||
See how fast deferreds are.
|
||||
|
||||
This is mainly useful to compare cdefer.Deferred to defer.Deferred
|
||||
"""
|
||||
|
||||
|
||||
from twisted.internet import defer
|
||||
from timer import timeit
|
||||
|
||||
benchmarkFuncs = []
|
||||
|
||||
def benchmarkFunc(iter, args=()):
|
||||
"""
|
||||
A decorator for benchmark functions that measure a single iteration
|
||||
count. Registers the function with the given iteration count to the global
|
||||
benchmarkFuncs list
|
||||
"""
|
||||
def decorator(func):
|
||||
benchmarkFuncs.append((func, args, iter))
|
||||
return func
|
||||
return decorator
|
||||
|
||||
def benchmarkNFunc(iter, ns):
|
||||
"""
|
||||
A decorator for benchmark functions that measure multiple iteration
|
||||
counts. Registers the function with the given iteration count to the global
|
||||
benchmarkFuncs list.
|
||||
"""
|
||||
def decorator(func):
|
||||
for n in ns:
|
||||
benchmarkFuncs.append((func, (n,), iter))
|
||||
return func
|
||||
return decorator
|
||||
|
||||
def instantiate():
|
||||
"""
|
||||
Only create a deferred
|
||||
"""
|
||||
d = defer.Deferred()
|
||||
instantiate = benchmarkFunc(100000)(instantiate)
|
||||
|
||||
def instantiateShootCallback():
|
||||
"""
|
||||
Create a deferred and give it a normal result
|
||||
"""
|
||||
d = defer.Deferred()
|
||||
d.callback(1)
|
||||
instantiateShootCallback = benchmarkFunc(100000)(instantiateShootCallback)
|
||||
|
||||
def instantiateShootErrback():
|
||||
"""
|
||||
Create a deferred and give it an exception result. To avoid Unhandled
|
||||
Errors, also register an errback that eats the error
|
||||
"""
|
||||
d = defer.Deferred()
|
||||
try:
|
||||
1/0
|
||||
except:
|
||||
d.errback()
|
||||
d.addErrback(lambda x: None)
|
||||
instantiateShootErrback = benchmarkFunc(200)(instantiateShootErrback)
|
||||
|
||||
ns = [10, 1000, 10000]
|
||||
|
||||
def instantiateAddCallbacksNoResult(n):
|
||||
"""
|
||||
Creates a deferred and adds a trivial callback/errback/both to it the given
|
||||
number of times.
|
||||
"""
|
||||
d = defer.Deferred()
|
||||
def f(result):
|
||||
return result
|
||||
for i in xrange(n):
|
||||
d.addCallback(f)
|
||||
d.addErrback(f)
|
||||
d.addBoth(f)
|
||||
d.addCallbacks(f, f)
|
||||
instantiateAddCallbacksNoResult = benchmarkNFunc(20, ns)(instantiateAddCallbacksNoResult)
|
||||
|
||||
def instantiateAddCallbacksBeforeResult(n):
|
||||
"""
|
||||
Create a deferred and adds a trivial callback/errback/both to it the given
|
||||
number of times, and then shoots a result through all of the callbacks.
|
||||
"""
|
||||
d = defer.Deferred()
|
||||
def f(result):
|
||||
return result
|
||||
for i in xrange(n):
|
||||
d.addCallback(f)
|
||||
d.addErrback(f)
|
||||
d.addBoth(f)
|
||||
d.addCallbacks(f)
|
||||
d.callback(1)
|
||||
instantiateAddCallbacksBeforeResult = benchmarkNFunc(20, ns)(instantiateAddCallbacksBeforeResult)
|
||||
|
||||
def instantiateAddCallbacksAfterResult(n):
|
||||
"""
|
||||
Create a deferred, shoots it and then adds a trivial callback/errback/both
|
||||
to it the given number of times. The result is processed through the
|
||||
callbacks as they are added.
|
||||
"""
|
||||
d = defer.Deferred()
|
||||
def f(result):
|
||||
return result
|
||||
d.callback(1)
|
||||
for i in xrange(n):
|
||||
d.addCallback(f)
|
||||
d.addErrback(f)
|
||||
d.addBoth(f)
|
||||
d.addCallbacks(f)
|
||||
instantiateAddCallbacksAfterResult = benchmarkNFunc(20, ns)(instantiateAddCallbacksAfterResult)
|
||||
|
||||
def pauseUnpause(n):
|
||||
"""
|
||||
Adds the given number of callbacks/errbacks/both to a deferred while it is
|
||||
paused, and unpauses it, trigerring the processing of the value through the
|
||||
callbacks.
|
||||
"""
|
||||
d = defer.Deferred()
|
||||
def f(result):
|
||||
return result
|
||||
d.callback(1)
|
||||
d.pause()
|
||||
for i in xrange(n):
|
||||
d.addCallback(f)
|
||||
d.addErrback(f)
|
||||
d.addBoth(f)
|
||||
d.addCallbacks(f)
|
||||
d.unpause()
|
||||
pauseUnpause = benchmarkNFunc(20, ns)(pauseUnpause)
|
||||
|
||||
def benchmark():
|
||||
"""
|
||||
Run all of the benchmarks registered in the benchmarkFuncs list
|
||||
"""
|
||||
print defer.Deferred.__module__
|
||||
for func, args, iter in benchmarkFuncs:
|
||||
print func.__name__, args, timeit(func, iter, *args)
|
||||
|
||||
if __name__ == '__main__':
|
||||
benchmark()
|
66
vendor/Twisted-10.0.0/doc/core/benchmarks/failure.py
vendored
Normal file
66
vendor/Twisted-10.0.0/doc/core/benchmarks/failure.py
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
|
||||
"""See how slow failure creation is"""
|
||||
|
||||
import random
|
||||
from twisted.python import failure
|
||||
|
||||
random.seed(10050)
|
||||
O = [0, 20, 40, 60, 80, 10, 30, 50, 70, 90]
|
||||
DEPTH = 30
|
||||
|
||||
def pickVal():
|
||||
return random.choice([None, 1, 'Hello', [], {1: 1}, (1, 2, 3)])
|
||||
|
||||
def makeLocals(n):
|
||||
return ';'.join(['x%d = %s' % (i, pickVal()) for i in range(n)])
|
||||
|
||||
for nLocals in O:
|
||||
for i in range(DEPTH):
|
||||
s = """
|
||||
def deepFailure%d_%d():
|
||||
%s
|
||||
deepFailure%d_%d()
|
||||
""" % (nLocals, i, makeLocals(nLocals), nLocals, i + 1)
|
||||
exec s
|
||||
|
||||
exec """
|
||||
def deepFailure%d_%d():
|
||||
1 / 0
|
||||
""" % (nLocals, DEPTH)
|
||||
|
||||
R = range(5000)
|
||||
def fail(n):
|
||||
for i in R:
|
||||
try:
|
||||
eval('deepFailure%d_0' % n)()
|
||||
except:
|
||||
failure.Failure()
|
||||
|
||||
def fail_str(n):
|
||||
for i in R:
|
||||
try:
|
||||
eval('deepFailure%d_0' % n)()
|
||||
except:
|
||||
str(failure.Failure())
|
||||
|
||||
class PythonException(Exception): pass
|
||||
|
||||
def fail_easy(n):
|
||||
for i in R:
|
||||
try:
|
||||
failure.Failure(PythonException())
|
||||
except:
|
||||
pass
|
||||
|
||||
from timer import timeit
|
||||
# for i in O:
|
||||
# timeit(fail, 1, i)
|
||||
|
||||
# for i in O:
|
||||
# print 'easy failing', i, timeit(fail_easy, 1, i)
|
||||
|
||||
for i in O:
|
||||
print 'failing', i, timeit(fail, 1, i)
|
||||
|
||||
# for i in O:
|
||||
# print 'string failing', i, timeit(fail_str, 1, i)
|
47
vendor/Twisted-10.0.0/doc/core/benchmarks/linereceiver.py
vendored
Normal file
47
vendor/Twisted-10.0.0/doc/core/benchmarks/linereceiver.py
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
import math, time
|
||||
|
||||
from twisted.protocols import basic
|
||||
|
||||
class CollectingLineReceiver(basic.LineReceiver):
|
||||
def __init__(self):
|
||||
self.lines = []
|
||||
self.lineReceived = self.lines.append
|
||||
|
||||
def deliver(proto, chunks):
|
||||
map(proto.dataReceived, chunks)
|
||||
|
||||
def benchmark(chunkSize, lineLength, numLines):
|
||||
bytes = ('x' * lineLength + '\r\n') * numLines
|
||||
chunkCount = len(bytes) / chunkSize + 1
|
||||
chunks = []
|
||||
for n in xrange(chunkCount):
|
||||
chunks.append(bytes[n*chunkSize:(n+1)*chunkSize])
|
||||
assert ''.join(chunks) == bytes, (chunks, bytes)
|
||||
p = CollectingLineReceiver()
|
||||
|
||||
before = time.clock()
|
||||
deliver(p, chunks)
|
||||
after = time.clock()
|
||||
|
||||
assert bytes.splitlines() == p.lines, (bytes.splitlines(), p.lines)
|
||||
|
||||
print 'chunkSize:', chunkSize,
|
||||
print 'lineLength:', lineLength,
|
||||
print 'numLines:', numLines,
|
||||
print 'CPU Time: ', after - before
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
for numLines in 100, 1000:
|
||||
for lineLength in (10, 100, 1000):
|
||||
for chunkSize in (1, 500, 5000):
|
||||
benchmark(chunkSize, lineLength, numLines)
|
||||
|
||||
for numLines in 10000, 50000:
|
||||
for lineLength in (1000, 2000):
|
||||
for chunkSize in (51, 500, 5000):
|
||||
benchmark(chunkSize, lineLength, numLines)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
26
vendor/Twisted-10.0.0/doc/core/benchmarks/task.py
vendored
Normal file
26
vendor/Twisted-10.0.0/doc/core/benchmarks/task.py
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
"""
|
||||
Benchmarks for L{twisted.internet.task}.
|
||||
"""
|
||||
|
||||
from timer import timeit
|
||||
|
||||
from twisted.internet import task
|
||||
|
||||
def test_performance():
|
||||
"""
|
||||
L{LoopingCall} should not take long to skip a lot of iterations.
|
||||
"""
|
||||
clock = task.Clock()
|
||||
call = task.LoopingCall(lambda: None)
|
||||
call.clock = clock
|
||||
|
||||
call.start(0.1)
|
||||
clock.advance(1000000)
|
||||
|
||||
|
||||
def main():
|
||||
print "LoopingCall large advance takes", timeit(test_performance, iter=1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
24
vendor/Twisted-10.0.0/doc/core/benchmarks/timer.py
vendored
Normal file
24
vendor/Twisted-10.0.0/doc/core/benchmarks/timer.py
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright (c) 2007-2009 Twisted Matrix Laboratories.
|
||||
# See LICENSE for details.
|
||||
|
||||
"""
|
||||
Helper stuff for benchmarks.
|
||||
"""
|
||||
|
||||
import gc
|
||||
gc.disable()
|
||||
print 'Disabled GC'
|
||||
|
||||
def timeit(func, iter = 1000, *args, **kwargs):
|
||||
"""
|
||||
timeit(func, iter = 1000 *args, **kwargs) -> elapsed time
|
||||
|
||||
calls func iter times with args and kwargs, returns time elapsed
|
||||
"""
|
||||
|
||||
from time import time as currentTime
|
||||
r = range(iter)
|
||||
t = currentTime()
|
||||
for i in r:
|
||||
func(*args, **kwargs)
|
||||
return currentTime() - t
|
60
vendor/Twisted-10.0.0/doc/core/benchmarks/tpclient.py
vendored
Normal file
60
vendor/Twisted-10.0.0/doc/core/benchmarks/tpclient.py
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
"""Throughput test."""
|
||||
|
||||
import time, sys
|
||||
from twisted.internet import reactor, protocol
|
||||
from twisted.python import log
|
||||
|
||||
TIMES = 10000
|
||||
S = "0123456789" * 1240
|
||||
|
||||
toReceive = len(S) * TIMES
|
||||
|
||||
class Sender(protocol.Protocol):
|
||||
|
||||
def connectionMade(self):
|
||||
start()
|
||||
self.numSent = 0
|
||||
self.received = 0
|
||||
self.transport.registerProducer(self, 0)
|
||||
|
||||
def stopProducing(self):
|
||||
pass
|
||||
|
||||
def pauseProducing(self):
|
||||
pass
|
||||
|
||||
def resumeProducing(self):
|
||||
self.numSent += 1
|
||||
self.transport.write(S)
|
||||
if self.numSent == TIMES:
|
||||
self.transport.unregisterProducer()
|
||||
self.transport.loseConnection()
|
||||
|
||||
def connectionLost(self, reason):
|
||||
shutdown(self.numSent == TIMES)
|
||||
|
||||
|
||||
started = None
|
||||
|
||||
def start():
|
||||
global started
|
||||
started = time.time()
|
||||
|
||||
def shutdown(success):
|
||||
if not success:
|
||||
raise SystemExit, "failure or something"
|
||||
passed = time.time() - started
|
||||
print "Throughput (send): %s kbytes/sec" % ((toReceive / passed) / 1024)
|
||||
reactor.stop()
|
||||
|
||||
|
||||
def main():
|
||||
f = protocol.ClientFactory()
|
||||
f.protocol = Sender
|
||||
reactor.connectTCP(sys.argv[1], int(sys.argv[2]), f)
|
||||
reactor.run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
#log.startLogging(sys.stdout)
|
||||
main()
|
22
vendor/Twisted-10.0.0/doc/core/benchmarks/tpclient_nt.py
vendored
Normal file
22
vendor/Twisted-10.0.0/doc/core/benchmarks/tpclient_nt.py
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"""Non-twisted throughput client."""
|
||||
|
||||
import socket, time, sys
|
||||
|
||||
TIMES = 50000
|
||||
S = "0123456789" * 1024
|
||||
sent = len(S) * TIMES
|
||||
|
||||
def main():
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((sys.argv[1], int(sys.argv[2])))
|
||||
start = time.time()
|
||||
i = 0
|
||||
while i < TIMES:
|
||||
i += 1
|
||||
s.sendall(S)
|
||||
passed = time.time() - start
|
||||
print "Throughput: %s kbytes/sec" % ((sent / passed) / 1024)
|
||||
s.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user