[Twisted-Python] how to run ckeygen

Colin Watson cjwatson at debian.org
Sat Jan 9 11:23:12 MST 2021


On Sat, Jan 09, 2021 at 11:03:28AM -0600, Thomas Anderson wrote:
> I did "pip install twisted" and it seemed to install okay.
> 
> Now I'm trying to get
> https://twistedmatrix.com/documents/current/_downloads/9620a18fe21cabe0de79cc9c0efe1043/sshsimpleserver.py
> running locally. To do so it says I need to first do "ckeygen -t rsa -f
> ssh-keys/ssh_host_rsa_key". ssh-keygen is a command that's commonly
> available on Linux systems but ckeygen...  that appears to be a twisted
> thing. When I try to run that on Ubuntu I get a "-bash: ckeygen: command
> not found" error.

It's in the Twisted distribution (perhaps pip has installed it to
somewhere not on your $PATH?  On Linux, hopefully you're using pip in
conjunction with a virtualenv, in which case you may need to activate
the virtualenv), but you do need to use "pip install 'Twisted[conch]'"
to get the right dependencies.

  $ virtualenv twisted-test
  $ twisted-test/bin/pip install 'Twisted[conch]'
  $ twisted-test/bin/ckeygen --help
  Usage:    ckeygen [options]
  Options:
    -C, --comment=              Provide new comment.
    -N, --newpass=              Provide new passphrase.
    -P, --pass=                 Provide old passphrase.
    -b, --bits=                 Number of bits in the key to create.
    -f, --filename=             Filename of the key file.
        --help                  Display this help and exit.
    -l, --fingerprint           Show fingerprint of key file.
        --no-passphrase         Create the key with no passphrase.
    -o, --format=               Fingerprint format of key file. [default:
                                sha256-base64]
    -p, --changepass            Change passphrase of private key file.
        --private-key-subtype=  OpenSSH private key subtype to write ("PEM" or
                                "v1"). [default: PEM]
    -q, --quiet                 Quiet.
    -t, --type=                 Specify type of key to create.
        --version               Display Twisted version and exit.
    -y, --showpub               Read private key file and print public key.
  
  ckeygen manipulates public/private keys in various ways.

Alternatively, if you don't mind having a Twisted version of an age that
roughly matches when the Ubuntu version you're running was being
prepared, then you can run "sudo apt install python3-twisted" to get a
system-installed version.  That'll give you /usr/bin/ckeygen3 rather
than ckeygen, but close enough.  Whether the older version is good
enough depends on what you're doing.

-- 
Colin Watson (he/him)                              [cjwatson at debian.org]



More information about the Twisted-Python mailing list