Commit Graph

16 Commits

Author SHA1 Message Date
Lorenzo Blasa
3f6424930a Add resetState documentation
Summary:
Add documentation to `ConnectionContextStore::resetState`.

Useful to have, I guess.

Reviewed By: passy

Differential Revision: D46849937

fbshipit-source-id: 7dec76e23b566f460f0b22e0fa14b73e16a142f0
2023-06-21 13:33:10 -07:00
Lorenzo Blasa
216c926ca5 Remove dead code in connection context store
Summary:
^
It was used by rsocket.

Reviewed By: fabiomassimo

Differential Revision: D36246038

fbshipit-source-id: 8bdc77d9e1ecf22402436e0102b5522ed36aff27
2022-05-12 09:16:13 -07:00
Lorenzo Blasa
37b87b7653 ConnectionContextStore to expose API to retrieve store items path
Summary:
^

This change allow callers to retrieve the path of different store items some of which are used for connection authentication.

Reviewed By: aigoncharov

Differential Revision: D34081942

fbshipit-source-id: c6b8d3590993de6c48a36266a5c16f2caf9f5a93
2022-02-09 06:31:14 -08:00
Andres Suarez
79023ee190 Update copyright headers from Facebook to Meta
Reviewed By: bhamodi

Differential Revision: D33331422

fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
2021-12-27 14:31:45 -08:00
Andrey Goncharov
6a8135af38 Initiate cert exchange when medium changes
Summary:
Changelog: Initiate cert exchange when medium changes

Fixes the following bug:

1. Start an iOS app with WWW cert exchange
2. Get cert (and fake serial of a virtual device)
3. Close app
4. Restart Flipper
5. Switch app to FS_ACCESS cert exchange
6. Start app

Expected result:
App re-initializes cert exchange to get a new serial of a real device

Current result:
App tries to connect securely using the previous fake serial of a virtual device. Flipper does not recognize it and refuses the connection.

Reviewed By: lblasa

Differential Revision: D33163798

fbshipit-source-id: 67126a9b562f2cb7cfe6521a46abf38b2699fb2d
2021-12-17 03:54:55 -08:00
Lorenzo Blasa
a935ab8a6c Android Web Socket (#2978)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/2978

Flipper Android WebSocket provider and socket implementation

Reviewed By: ldelgadoj

Differential Revision: D31683510

fbshipit-source-id: d553a7fdee9451da742e9ea3e6e5b6a2c9417579
2021-11-08 09:22:48 -08:00
Lorenzo Blasa
43179a7ef4 ConnectionContext to expose client certificate in PKCS #12 format
Summary:
RSocket plays nicely with Folly and OpenSSL.

Flipper WebSocket-client uses SocketRocket which instead relies on Apple's NSInputStream and NSOutputStream types.

SSL options can be set to secure the communication in both.

Unfortunately, Apple APIs are a bit limited on the supported cryptographic formats it can accept as arguments.

SSL options require the client certificate to be set in PKCS #12 format, contrary to the existing PEM format used by RSocket.

This change adds a method to the ConnectionContext which converts and saves the client certificate in PKCS #12 format.

The method is always expected to succeed as it will only be called once a valid client certificate is available. An unlikely failure will raise an exception.

Reviewed By: fabiomassimo

Differential Revision: D30074334

fbshipit-source-id: 91a475d080569cc339b649c7302b1f28793c7de7
2021-08-04 06:34:18 -07:00
Andres Suarez
c315691b2d Apply clang-format
Differential Revision: D19843069

fbshipit-source-id: af3f3998e2259ca5070b43ffb19933cf9304319d
2020-02-11 19:29:23 -08:00
John Knox
c2370f7faf Speed up re-connect after re-opening app
Summary:
The problem is that whenever an app is shutdown, and then reopened, the flipper dir gets reset when getting the CSR for connecting to flipper.
This causes the first connection attempt to fail always, and it goes through the whole cert exchange, taking longer than necessary.

Fixes it by loading the csr from disk if it's not loaded yet, without blowing away the whole certs state.

A side effect of this would be that as long as some file exists where the csr lives, flipper state would never get reset, so it wouldn't be able to fix itself automatically anymore. To keep that working, I've made `resetFlipperDir()` public and am calling it explicitly when starting certificate exchange. This should ensure that we still reset when we need to, but not unnecessarily.

The reason it went wrong is that getCSR used to be called only at cert exchange, when resetting and generating a new one was always desirable. However, when we shipped the fix for changeable android serials, it started to be used as a normal getter.

Reviewed By: timur-valiev

Differential Revision: D18834806

fbshipit-source-id: 56ca7e03e1aa9011f836bc9c021cf3048f7dc1e4
2019-12-06 05:29:22 -08:00
Andres Suarez
0675dd924d Tidy up Flipper license headers [1/2]
Reviewed By: passy

Differential Revision: D17863711

fbshipit-source-id: 259dc77826fb803ff1b88c88529d7f679d3b74d8
2019-10-11 13:46:45 -07:00
Rain ⁣
aa649ff48f standardize C-like MIT copyright headers throughout fbsource
Summary:
`/*` is the standard throughout open source code. For example, Firefox uses single /*: https://hg.mozilla.org/mozilla-central/file/21d22b2f541258d3d1cf96c7ba5ad73e96e616b5/gfx/ipc/CompositorWidgetVsyncObserver.cpp#l3

In addition, Rust considers `/**` to be a doc comment (similar to Javadoc) and having such a comment at the beginning of the file causes `rustc` to barf.

Note that some JavaScript tooling requires `/**`. This is OK since JavaScript files were not covered by the linter in the first place, but it would be good to have that tooling fixed too.

Reviewed By: zertosh

Differential Revision: D15640366

fbshipit-source-id: b4ed4599071516364d6109720750d6a43304c089
2019-06-06 19:40:28 -07:00
John Knox
9c87dfe230 Only create CSR once per app invocation
Summary: The CSR has no need to change, don't recreate it every time we need it. Useful for the physical iOS case especially, because it connects to the portforwarder and keeps attempting to send a CSR.

Reviewed By: passy

Differential Revision: D14131617

fbshipit-source-id: 82a69d5aff813d77fa05dd13fc2441b784766d99
2019-02-19 10:33:25 -08:00
John Knox
f15fe48fa9 Clean on-device sonar dir between certificate exchanges
Summary:
During certificate exchange, the mobile device creates a public/private key pair, and then requests a certificate from flipper to match it's public key.

Flipper responds with the cert and it's written to the sonar dir along side the key pair files.

If certificate exchange happens again for any reason, the mobile device will regenerate the key pair and request a new cert. If for any reason that cert never arrives, then the device is in a state where it has the new key pair, but the old certificate that doesn't match its new credentials. This would never work, but it means you get a strange SSL error because you're using inconsistent files.

To improve error messaging, I'm making the client wipe all files before starting the certificate exchange step, so you should never get key/cert mismatches. Now the device can tell it doesn't have all the necessary files and won't even attempt to connect until it does.

Reviewed By: passy

Differential Revision: D13256369

fbshipit-source-id: 28f3cb5ba5938c17f01294683ba86c418f651376
2018-11-30 06:23:40 -08:00
John Knox
1a076f1300 Rename C++ fields and internal methods
Summary: From sonar* to flipper*.

Reviewed By: priteshrnandgaonkar

Differential Revision: D9944461

fbshipit-source-id: 870997e3d1d5aaef73dd445e6d94615f93fe6abc
2018-09-25 04:57:48 -07:00
John Knox
574c05c41d Rename SonarInitConfig
Summary: Part of sonar -> flipper rename

Reviewed By: priteshrnandgaonkar

Differential Revision: D9908472

fbshipit-source-id: f2e694b5abfa22a745ee4719d24d6aad8af6ee2a
2018-09-20 17:06:55 -07:00
John Knox
df8763e697 Move xplat/sonar/xplat/Sonar* to Flipper*
Summary:
Part of the Sonar -> Flipper rename
Intentionally left externally visible buck target as Sonar for now to minimize diff size.

Reviewed By: passy

Differential Revision: D9871684

fbshipit-source-id: 6926eb62c578a05cd895745c75ed7da3cfe965b5
2018-09-20 15:39:57 -07:00