newsapps / beeswithmachineguns

A utility for arming (creating) many bees (micro EC2 instances) to attack (load test) targets (web applications).
http://apps.chicagotribune.com/
MIT License
6.44k stars 632 forks source link

SSHException: not a valid EC private key file #207

Open RiceBowlJr opened 6 years ago

RiceBowlJr commented 6 years ago

Hi, I've got an error when trying to attack my target. The error below is showing, but can't find any workaround. Seems that Python SSH module (paramiko) you use don't like my key type. It is an Amazon keypair that I placed in my ~/.ssh directory. I tried to reate a new one but it doesn't change a thing.

bees attack -n 2000 -c 500 --url=<URL> --headers="Accept:*/*;Accept-Encoding:gzip,deflate;Connection:keep-alive;Content-Length:25;Content-Type:application/x-www-form-urlencoded;Host:<host>;Origin:<originurl>;Referer:<Referer>" --post-file=data.json

Read 4 bees from the roster: eu-west-1a
Connecting to the hive.
Assembling bees.
Each of 4 bees will fire 500 rounds, 125 at a time.
Stinging URL sequentially so it will be cached for the attack.
Organizing the swarm.
Bee 0 is joining the swarm.
Bee 1 is joining the swarm.
Bee 2 is joining the swarm.
Bee 3 is joining the swarm.
/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV
  self._cipher = factory.new(key, *args, **kwargs)
/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV
  self._cipher = factory.new(key, *args, **kwargs)
/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV
  self._cipher = factory.new(key, *args, **kwargs)
/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV
  self._cipher = factory.new(key, *args, **kwargs)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/beeswithmachineguns/bees.py", line 421, in _attack
    key_filename=pem_path)
  File "/usr/local/lib/python2.7/dist-packages/paramiko/client.py", line 307, in connect
    look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
  File "/usr/local/lib/python2.7/dist-packages/paramiko/client.py", line 519, in _auth
    raise saved_exception
SSHException: not a valid EC private key file

Kind of annoying since I can do most of my loadcharge tests with AB Testing, but not all of them. Free to give more infos about my issue.

mkarski commented 6 years ago

Same problem. Any solution so far, @RiceBowlJr ?

edison0xyz commented 6 years ago

Adding -l ubuntu worked for me.

Although it has been three years, paramiko is still strict about the user who is supposed to "own" the private key.

RiceBowlJr commented 6 years ago

Hi @mkarski Since my load tests were pretty basic, I switched to an home made solution based on multiple instances and Ansible ad-hoc cURL commands.

Although I will try to reproduce it and find a workaround, but since I changed my comuter I may not be abel to reproduce it.