GithubHelp home page GithubHelp logo

relaycorp / awala-gateway-desktop Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 10.93 MB

Awala Gateway for Desktop

Home Page: https://awala.network/users/download

License: GNU General Public License v3.0

JavaScript 2.42% TypeScript 96.09% HTML 0.03% CSS 1.46%
linux windows awala awala-gateway macos

awala-gateway-desktop's Introduction

Awala Gateway for Desktop

The Awala Gateway for Desktop is a private gateway for Windows 8+ and Linux desktops, with experimental support for macOS. The installers can be found in the latest GitHub release.

This repository contains the source code for the app, which is also a reference implementation of a private gateway in the Awala protocol suite.

This document is aimed at advanced users and (prospective) contributors. We aim to make the app as simple and intuitive as possible, and we're therefore not planning on publishing end-user documentation at this point. To learn more about using Awala, visit awala.network/users.

Awala bindings

This private gateway implements Awala bindings as follows:

  • Local endpoints communicate with the private gateway via a PoWeb server on 127.0.0.1:13276. This server is implemented with the PoWeb binding, and the Fastify and ws servers.
  • When the Internet is available and the Internet gateway is reachable, this private gateway will communicate with its public counterpart using Relaycorp's PoWeb client.
  • When communicating with couriers over WiFi, this private gateway uses the CogRPC binding through Relaycorp's CogRPC client.

The local communication with endpoints does not use TLS, but all other connections are external and therefore require TLS.

By default, instances of this gateway are paired to Relaycorp's Frankfurt gateway.

Security and privacy considerations

The items below summarize the security and privacy considerations specific to this app. For a more general overview of the security considerations in Awala, please refer to RS-019.

No encryption at rest

This app does not (currently) support encryption at rest, so a malicious app on your computer could get hold of the private keys used by this gateway. Users are highly encouraged to use full-disk encryption to protect such keys in the event that the device were lost or stolen.

Note that because Awala employs end-to-end encryption, compromising these keys won't compromise the encryption of the messages exchanged by your Awala-compatible apps. The keys of any private gateway are used to sign messages and issue Awala PKI certificates, and to encrypt/decrypt cargo exchanged with its Internet gateway.

External communication

In addition to communicating with its Internet gateway, this app communicates with the following:

  • https://cloudflare-dns.com/dns-query as the DNS-over-HTTPS (DoH) resolver. DoH is only used to resolve SRV records for the Internet gateway (e.g., _awala-gsc._tcp.frankfurt.relaycorp.cloud), as we delegate the DNSSEC validation to the DoH resolver.
  • The host running the DHCP server on port 21473, when the device is connected to a WiFi network but disconnected from the Internet. We do this to check whether the device is connected to the WiFi hotspot of a courier.
  • Other apps on the same device can potentially communicate with the local PoWeb server provided by this app on 127.0.0.1:13276. Because this server uses the HTTP and WebSocket protocols, we block web browser requests by disabling CORS and refusing WebSocket connections with the Origin header (per the PoWeb specification).

This app doesn't track usage (for example, using Google Analytics), nor does it use ads.

App signing

The Windows installer is signed with a certificate issued to Relaycorp, Inc..

Naming rationale

We're referring to this app as "Awala" in the user interface, even though this is obviously one of the components that make up the network, in order to hide technical details from the end user. The terms "private gateway" or "gateway" may be more accurate, but we don't think they sound user-friendly.

However, we do use the terms "private gateway" or "gateway" in the code base because we absolutely need accuracy there.

Development

System dependencies

You only need Node.js 16+ installed.

Setup

npm install
npm run bootstrap

Code structure

This is a monorepo and all components can be found under packages.

Contributing

We love contributions! If you haven't contributed to a Relaycorp project before, please take a minute to read our guidelines first.

awala-gateway-desktop's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar gnarea avatar liliakai avatar

Watchers

 avatar

Forkers

stanislav1975

awala-gateway-desktop's Issues

Implement connection to relayer

There's two parts to this: Write a script to trigger the connection and the actual initialisation of the connection in the gateway.

It should use a signal or some other IPC method to tell the gateway to connect to the relayer.

This script could be extended in the future to output the logs of the relay if we find that makes sense.

Native dependencies don't work in Electron

The native dependencies in the daemon package (i.e., gRPC and SQLite) aren't working. I can build the app, but the daemon errors out when forked:

/home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/node_modules/grpc/src/grpc_extension.js:55
    throw error;
    ^

Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: electron-v12.0-linux-x64-glibc
Found: [node-v72-linux-x64-glibc]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/node_modules/grpc/src/node/extension_binary/electron-v12.0-linux-x64-glibc/grpc_node.node'
Require stack:
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/node_modules/grpc/src/grpc_extension.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/node_modules/grpc/src/client_interceptors.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/node_modules/grpc/src/client.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/node_modules/grpc/index.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/node_modules/@relaycorp/cogrpc/build/main/lib/client.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/node_modules/@relaycorp/cogrpc/build/main/index.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/build/sync/courierSync/CourierSync.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/build/sync/StatusMonitor.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/build/server/control/connectionStatus.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/build/server/index.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/build/daemon.js
- /home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/build/bin/gateway-daemon.js
    at Object.<anonymous> (/home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/node_modules/grpc/src/grpc_extension.js:53:17)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12684)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/gus/repos/awala-gateway-desktop/packages/ui/app/daemon/node_modules/grpc/src/client_interceptors.js:144:12)
    at Module._compile (internal/modules/cjs/loader.js:1078:30) {
  code: 'MODULE_NOT_FOUND'
}
(node:26471) UnhandledPromiseRejectionWarning: ReferenceError: WebSocket is not defined
    at updateToolTip (webpack://ui/./src/electron/main.ts?:93:39)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

I've tried the following but hadn't managed to make things work (I'm sure I'm doing something wrong but can't tell what it is):

See #90, for example.

Can you please look into this when you get a chance, Lilia?

Add support for macOS

It's likely that the app can be ported to macOS with minimal tweaks, since we're using Electron.

The main thing blocking this is that we need to purchase a macOS device. Even if an external contributor volunteers to do this work, I still wouldn't approve the PR for two reasons:

  • We'd still need to test it to ensure the quality of the integration is adequate.
  • Going forward, as the app evolves, we'd need to ensure it continues to work well on macOS. We can't fully rely on the functional test suite, because we also have to test a client-server connection over WiFi.

Courier sync is reported as successful even when it fails

For example, whilst checking why I'm not seeing the screen in the "UNREGISTERED" status, I started a sync with the courier.

I expected that sync to fail because we're in the UNREGISTERED status, but the UI immediately showed the screen you'd see when the sync succeeds. But I can see in the daemon logs that the request was aborted early on because of the current state:

{"level":40,"time":1619709970826,"pid":110247,"hostname":"relaybox","msg":"Aborting courier sync because gateway is unregistered"}

It should be possible to reproduce this by disconnecting from the courier's WiFi hotspot, but I haven't tried that.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

PoWeb server: WS socket is suddenly closed after sending first parcel

And the close event isn't fired, so we can't handle it.

Since we'd be trying to write to a closed stream, that crashes the app with:

Error: WebSocket is not open: readyState 3 (CLOSED)
    at sendAfterClose (/home/gus/repos/awala-gateway-desktop/packages/ui/app/node_modules/daemon/node_modules/ws/lib/websocket.js:763:17)
    at WebSocket.send (/home/gus/repos/awala-gateway-desktop/packages/ui/app/node_modules/daemon/node_modules/ws/lib/websocket.js:345:7)
    at Duplex.duplex._write (/home/gus/repos/awala-gateway-desktop/packages/ui/app/node_modules/daemon/node_modules/ws/lib/stream.js:169:8)
    at writeOrBuffer (internal/streams/writable.js:358:12)
    at Duplex.Writable.write (internal/streams/writable.js:303:10)
    at Object.sink (/home/gus/repos/awala-gateway-desktop/packages/ui/app/node_modules/daemon/node_modules/stream-to-it/sink.js:71:20)

I can reproduce this reliably by running the ping command twice (awala-ping ping).

Publish app on Snapcraft

I tried to do it with:

linux:
  target:
    - AppImage
    - snap
  category: Network
  icon: src/electron/assets/logo.png
snap:
  buildPackages:
    - libc6
  stagePackages:
    - default
    - libc6
    - libappindicator1

But got this runtime error:

$ awala
Gtk-Message: 12:29:47.619: Failed to load module "colorreload-gtk-module"
/snap/awala/x1/app/resources/app.asar/node_modules/daemon/node_modules/grpc/src/grpc_extension.js:58
    throw e;
    ^

Error: Failed to load /snap/awala/x1/app/resources/app.asar/node_modules/daemon/node_modules/grpc/src/node/extension_binary/electron-v12.0-linux-x64-glibc/grpc_node.node. /snap/awala/x1/lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /run/user/1000/snap.awala/.org.chromium.Chromium.ywNXIS)
    at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1846)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1138:18)
    at Object.func [as .node] (electron/js2c/asar_bundle.js:5:2073)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12684)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/snap/awala/x1/app/resources/app.asar/node_modules/daemon/node_modules/grpc/src/grpc_extension.js:32:13)
    at Module._compile **(internal/modules/cjs/loader.js:1078:30)**

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Cannot push to the Git repository.

semantic-release cannot push the version tag to the branch master on the remote Git repository with URL https://x-access-token:[secure]@github.com/relaycorp/awala-gateway-desktop.git.

This can be caused by:


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Packaged app can't fork the daemon when asar is enabled

In a packaged electron app, the app directory is typically converted to an asar archive.

The problem is we currently need to cwd into the daemon directory to run the server. Since this is a virtual directory in an archive file, you can't. Possibly this could be resolved by making the daemon agnostic to the current working directory. Or we can try to exclude the daemon from the asar using electron-builder's config asarUnpack.

See electron/electron#2708

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.