Skip to content

How to disable ssl cert verification #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yurenji opened this issue Sep 25, 2018 · 29 comments
Closed

How to disable ssl cert verification #480

yurenji opened this issue Sep 25, 2018 · 29 comments

Comments

@yurenji
Copy link

yurenji commented Sep 25, 2018

Is there a way to disable SSL? I found it in a similar project:

image

It will be very helpful if this can be supported

@aaugustin
Copy link
Member

connect accepts the same ssl argument than create_connection: https://docs.python.org/3/library/asyncio-eventloop.html?highlight=create_connection#asyncio.loop.create_connection

Create an insecure ssl.SSLContext and pass it as the ssl argument.

@aaugustin
Copy link
Member

aaugustin commented Sep 27, 2018

Also: please don't do this, creating a certificate and building a SSL context that trusts it is super easy, there's even an example here: https://github.com/aaugustin/websockets/blob/4e7a82eeec4621f7a6d99d43aa0a995b70382992/tests/test_client_server.py#L43-L46

@yurenji
Copy link
Author

yurenji commented Sep 27, 2018

Thanks for the reply. I am testing with binance websocket. I tested another project without ssl certificate, but not sure how to make it work with ssl. Can you give me some guide, here is my code:

url = 'wss://stream.binance.com:9443/stream?streams=btcusdt@depth10'
async def hello():
    ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
    ssl_context.load_verify_locations(
        pathlib.Path(__file__).with_name('test_localhost.pem'))
    async with websockets.connect(url, ssl=ssl_context) as websocket:
        greeting = await websocket.recv()
        print(f"< {greeting}")
asyncio.get_event_loop().run_until_complete(hello())

I created a self signed pem, but seems I was not able to read anything from websocket.

@aaugustin
Copy link
Member

Sorry, I have to walk out of this discussion: https://websockets.readthedocs.io/en/stable/contributing.html#bitcoin-users

@bgits
Copy link

bgits commented Feb 18, 2020

Sorry, I have to walk out of this discussion: https://websockets.readthedocs.io/en/stable/contributing.html#bitcoin-users

@aaugustin Your objection is supported by many in crypto community and there is active research in making them more sustainable. I would point you towards the Ethereum roadmap and it's plans to move away from proof-of-work completely to the much more sustainable model of proof-of-stake.

@aaugustin
Copy link
Member

I'm aware of this.

Tell me when the combined carbon footprint of all cryptocurrencies has dropped down to a non-bullshit level ;-)

aaugustin added a commit that referenced this issue Feb 18, 2020
Meanwhile, bitcoin still heats the planet.

Sorry crypto buffs.

Refs #480 and several others.
@levihb
Copy link

levihb commented Feb 5, 2021

@aaugustin Yeah it's not as if anyone else in the future is going to find this thread (top result on Google for this) and need help. Surely it would only have been that one bitcoin miner. /s

And no crypto isn't the problem. The problem is the way we generate our electricity. You could use this argument for almost anything that requires a lot of computational resources. Just look at modern machine learning. If you use crypto on renewable energy then suddenly it's not an issue, because it's not crypto that's the problem, it's that we're still using fossil fuels.

@bgits
Copy link

bgits commented Feb 5, 2021

I'm aware of this.

Tell me when the combined carbon footprint of all cryptocurrencies has dropped down to a non-bullshit level ;-)

It's worth noting that Ethereum has launched the first stage 2.0 the beacon chain which is a proof of stake chain. Aside from the energy usage I would argue most crypto projects share values of being open, permissionless and privacy preserving. There are also new networks such as avalanche which are pure proof of stake networks. Ultimately just because bitcoin is proof of work doesn't mean all crypto projects support that view and a great incentive might be to allow energy efficient and energy conscious projects to engage with this project.

@aaugustin
Copy link
Member

@aaugustin Yeah it's not as if anyone else in the future is going to find this thread (top result on Google for this) and need help. Surely it would only have been that one bitcoin miner. /s

Too bad bitcoin miners ruined it for everyone :-( On the bright side, not having an answer to this question is a rather small nuisance compared to heating the planet.

@aaugustin
Copy link
Member

a great incentive might be to allow energy efficient and energy conscious projects to engage with this project.

This is a good point. I have the feeling that most crypto projects still piggyback on proof-of-work-based networks in one way or another, but perhaps this isn't true anymore.

In the meantime I'm happy to engage with those who help making websockets sustainable, even if it's crypto-related.

@bgits
Copy link

bgits commented Feb 5, 2021 via email

@aaugustin
Copy link
Member

Looking forwards to the time when that goal is met and when no one uses a "proof-of-heating-the-planet" chain anymore. Unfortunately, given the current total valuation of the Bitcoin chain, this isn't happening any time son.

@bgits
Copy link

bgits commented Feb 6, 2021

Looking forwards to the time when that goal is met and when no one uses a "proof-of-heating-the-planet" chain anymore. Unfortunately, given the current total valuation of the Bitcoin chain, this isn't happening any time son.

Worth noting the Bitcoin camp claims most bitcoin mining is done using clean energy as it's done using cheap renewable energy such as solar and hydro electric as it would not be profitable to mine using other sources.

@aaugustin
Copy link
Member

That's bullshit. That clean electricity could be used for something more useful if it wasn't just used for heating the planet, and then we'd produce less dirty electricity. Marginal electricity production is coal or gas almost everywhere (rarely hydro).

@yurenji
Copy link
Author

yurenji commented Feb 7, 2021

That's bullshit. That clean electricity could be used for something more useful if it wasn't just used for heating the planet, and then we'd produce less dirty electricity. Marginal electricity production is coal or gas almost everywhere (rarely hydro).

A different view on this topic from Andreas M. Antonopoulos :https://www.youtube.com/watch?v=2T0OUIW89II&ab_channel=aantonop

Electricity consumed by bitcoin mining can be considered as 'energy arbitrage'. Much of them will be wasted if not used by bitcoin mining.

@bgits
Copy link

bgits commented Feb 7, 2021

That's bullshit. That clean electricity could be used for something more useful if it wasn't just used for heating the planet, and then we'd produce less dirty electricity. Marginal electricity production is coal or gas almost everywhere (rarely hydro).

Bitcoin is not mined everywhere. In the U.S. for example it's mostly mined in Washington state and at night when the cost of electricity is becomes free due to the excess capacity produced by hydro. The largest concentration of miners are in China where they get cheap access to hydro power.

@aaugustin
Copy link
Member

Let's leave rivers alone and stop mining bitcoin, then.

@yurenji
Copy link
Author

yurenji commented Feb 7, 2021

Agree. We should also stop the money printing machines of current financial system, which is equally important.

@bgits
Copy link

bgits commented Feb 7, 2021

Agree. We should also stop the money printing machines of current financial system, which is equally important.

This is the reason there is such a large crypto market.

@bgits
Copy link

bgits commented Feb 7, 2021

A talk on getting Ethereum nodes so efficient they could run Raspberry pis.

https://www.youtube.com/watch?v=SgVsaXhTWNc

@hammertoe
Copy link

a great incentive might be to allow energy efficient and energy conscious projects to engage with this project.

This is a good point. I have the feeling that most crypto projects still piggyback on proof-of-work-based networks in one way or another, but perhaps this isn't true anymore.

In the meantime I'm happy to engage with those who help making websockets sustainable, even if it's crypto-related.

Not wanting to derail this into a cryptocurrency debate thread, but please be open minded that not all cryptocurrencies use PoW. For example XRP was specifically created about 9 years ago to address the issues of wasteful energy usage of Bitcoin. https://xrpl.org/carbon-calculator.html

(I'm involved with the team writing the XRP Ledger Python SDK, which uses websockets)

@aaugustin
Copy link
Member

Good to hear that you're putting efforts into a more responsible model!

I hope websockets works well for you.

I'm aware of non-PoW models. As the docs say:

I’m aware of efforts to build proof-of-stake models. I’ll care once the total carbon footprint of all cryptocurrencies drops to a non-bullshit level.

I realize that my position isn't particularly subtle and can come across as offensive to folks who pick the good fight. I'll think about it.

To be completely honest, my interactions with folks in crypto community have essentially killed my motivation to work on websockets. The only way I can keep this project alive while maintaining my sanity is by avoiding these interactions 🤷

The carbon footprint thing is true, but largely unrelated to websockets.

@bgits
Copy link

bgits commented Feb 10, 2021

Good to hear that you're putting efforts into a more responsible model!

I hope websockets works well for you.

I'm aware of non-PoW models. As the docs say:

I’m aware of efforts to build proof-of-stake models. I’ll care once the total carbon footprint of all cryptocurrencies drops to a non-bullshit level.

I realize that my position isn't particularly subtle and can come across as offensive to folks who pick the good fight. I'll think about it.

To be completely honest, my interactions with folks in crypto community have essentially killed my motivation to work on websockets. The only way I can keep this project alive while maintaining my sanity is by avoiding these interactions 🤷

The carbon footprint thing is true, but largely unrelated to websockets.

Perhaps another way to both incentivize ecofriendly projects and yourself is to accept donations websockets in crypto currencies that shares values you believe in. You can do this by putting up donation addresses in the respective chains.

@bgits
Copy link

bgits commented Sep 16, 2022

I'm aware of this.

Tell me when the combined carbon footprint of all cryptocurrencies has dropped down to a non-bullshit level ;-)

With the Ethereum network successfully transitioning to proof of stake it now uses < 4% of the energy that paypal uses. This is second largest crypto network by marketcap and arguably the largest by developer and user activity.
Screen Shot 2022-09-16 at 12 37 20 PM

https://ethereum.org/en/energy-consumption/

@aaugustin
Copy link
Member

Next: Bitcoin.

@bgits
Copy link

bgits commented Sep 16, 2022

Next: Bitcoin.

It's not on the Bitcoin roadmap, but these are different communities with different philosophies. Refusing to work with people from the Ethereum community because of Bitcoin is beyond the control of the Ethereum community.

It might help by supporting projects that actively work to lower their footprint over those that don't.

@aaugustin
Copy link
Member

aaugustin commented Sep 17, 2022

Sounds good. Going forward, I will try to help users who run in trouble connecting to crypto trackers supporting ETH but not BTC.

@bgits
Copy link

bgits commented Sep 17, 2022

Sounds good. Going forward, I will try to help users who run in trouble connecting to crypto trackers supporting ETH but not BTC.

Awesome. You can take it step further by adding an Ethereum address and accepting donations

@aaugustin
Copy link
Member

I accept donations in Ethereum :-) Just convert it to EUR and send the EUR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants