Code Monkey home page Code Monkey logo

number571 / go-peer Goto Github PK

View Code? Open in Web Editor NEW
239.0 10.0 15.0 177.09 MB

🔐 🕵🏻 End-to-End encryption and Theoretically-Provable anonymity in a library wrapper. Confirmed by theoretical and research papers. The Hidden Lake anonymous network is located inside the project: https://github.com/number571/go-peer/tree/master/cmd/hidden_lake

License: MIT License

Go 89.29% Makefile 1.48% HTML 7.60% Dockerfile 0.45% Shell 0.56% Python 0.62%
network anonymity golang library qb-nets hidden-lake cryptography friend-to-friend peer-to-peer decentralized

go-peer's Introduction

go-peer_logo.png

Anonymity and Security without compromise

Go Release License Build Coverage GoDoc Awesome

GoReportCard Activity Commits Code Lines CodeSize Downloads

VKontakte

About project

Warning

The go-peer package and the Hidden Lake anonymous network are under active development. New versions may not be compatible with the old ones. As a result, it is necessary to use the latest release versions in order to keep up to date.

The go-peer library contains a large number of functions necessary to ensure the security of transmitted or stored information, as well as for the anonymity of nodes in the decentralized form. The library can be divided into several main pkg modules:

  1. The crypto module represents cryptographic primitives: 1) asymmetric encryption, decryption; 2) asymmetric signing and signature verification; 3) symmetric encryption and decryption; 4) hashing; 5) key building; 6) computational problems (puzzles); 7) cryptographically stable pseudorandom number generator.
  2. The client module for encrypting and decrypting information with the attached data integrity (hash) and authentication (signature). It is a basic part of the network/anonymity module.
  3. The network module is a decentralized communication between network nodes. Allows you to delimit networks and give information a random appearance using the network key.
  4. The network/anonymity module to ensure anonymity based on the fifth^ stage. Presents the main functions for working with the network on top of the network and network/anonymity/queue modules.
  5. The network/anonymity/queue module represents the generation, storage and issuance of encrypted messages every time the period specified by the application is reached. Uses the client, client/message and network/message modules.
  6. The storage/database module is a key-value database with the functions of value encryption and key hashing.

Examples of works in the directory github.com/number571/go-peer/examples;

Coverage map

coverage.svg

Installation

$ go get github.com/number571/go-peer

Requirements

  1. Go version >= 1.16

Releases

All programs are compiled for {amd64, arm64} ARCH and {windows, linux, darwin} OS as pattern = appname_arch_os. In total, one application is compiled into six versions. The entire list of releases can be found here: github.com/number571/go-peer/releases.

Supported platforms

  • Windows (x86_64, arm64)
  • Linux (x86_64, arm64)
  • MacOS (x86_64, arm64)

Dependencies

Important

All dependencies are loaded into the go-peer project once using the go mod vendor command (for the Go language) or simply by installing (for other languages) and saved in it. This is done for security purposes, provided that dependency creators can modify the code in older versions.

  1. Go library go.etcd.io/bbolt (used by pkg/database);
  2. Go library golang.org/x/net (used by cmd/hidden_lake/applications/messenger);
  3. Go library golang.org/x/crypto (used by pkg/crypto/keybuilder);
  4. Go library gopkg.in/yaml.v2 (used by pkg/encoding);
  5. Go library github.com/g8rswimmer/error-chain (used by pkg/utils);
  6. CSS/JS library getbootstrap.com (used by cmd/hidden_lake/applications/messenger|filesharer);

Makefile

There are a number of dependencies that represent separate applications for providing additional information about the quality of the code. These applications are not entered into the project, but are loaded via the make install-deps command. The list of applications is as follows:

  1. golangci-lint github.com/golangci/golangci-lint/cmd/[email protected]
  2. go-cover-treemap github.com/nikolaydubina/[email protected]

Theoretical works

  1. Theory of the structure of hidden systems
  2. Monolithic cryptographic protocol
  3. Abstract anonymous networks
  4. Decentralized key exchange protocol
  5. The Hidden Lake anonymous network

Also, the composition of these works (without "The Hidden Lake anonymous network") can be found in the book The general theory of anonymous communications (Ridero). This book can be purchased in a tangible form on the Ozon and Wildberries marketplaces. You can download the book in digital form for free here.

How can you help the project

  1. Find bugs, vulnerabilities, and errors in the code
  2. Suggest improvements, ask questions, create issues
  3. Create anonymizing nodes (HLS) in the Hidden Lake network
  4. Create new relay nodes (HLT) in the Hidden Lake network
  5. Append new theoretical works or update current
  6. Create new secure / anonymity applications
  7. Popularize technology and applications

Library based applications

Basic Applied Helpers
HL Service HL Messenger HL Traffic
HL Composite HL Filesharer HL Loader
HL Adapters HL Remoter HL Encryptor

1. Hidden Lake Service

github.com/number571/go-peer/cmd/hidden_lake/service

hls_logo.png

The Hidden Lake Service is a core of an anonymous network with theoretically provable anonymity. HLS is based on the fifth^ stage of anonymity and is an implementation of an abstract anonymous network based on queues. It is a peer-to-peer network communication with trusted friend-to-friend participants. All transmitted and received messages are in the form of end-to-end encryption.

Features / Anonymity networks QB-networks (5^stage) EI-networks (6stage) DC-networks (1^stage)
Theoretical provability + + +
Anonymity has a cumulative effect - + -
Ease of software implementation + - -
Polymorphism of information - + +
Static communication delay +/- - +
Sending parallel messages - + -
Network scales easily - - -

A feature of HLS (compared to many other anonymous networks) is its easy adaptation to a hostile centralized environment. Anonymity can be restored literally from one node in the network, even if it is the only point of failure.

More information about HLS in the hidden_lake_anonymous_network.pdf and here habr.com/ru/post/696504

How it works

Each network participant sets a message generation period for himself (the period can be a network constant for all system participants). When one cycle of the period ends and the next begins, each participant sends his encrypted message to all his connections (those in turn to all of their own, etc.). If there is no true message to send, then a pseudo message is generated (filled with random bytes) that looks like a normal encrypted one. The period property ensures the anonymity of the sender.

hls_queue.jpg

Figure 1. Queue and message generation in HLS.

Since the encrypted message does not disclose the recipient in any way, each network participant tries to decrypt the message with his private key. The true recipient is only the one who can decrypt the message. At the same time, the true recipient acts according to the protocol and further distributes the received packet, even knowing the meaninglessness of the subsequent dispatch. This property makes it impossible to determine the recipient.

Simple example of the client package (encrypt/decrypt functions) in the directory github.com/number571/go-peer/pkg/client/examples;

hls_view.jpg

Figure 2. Two participants are constantly generating messages for their periods on the network. It is impossible to determine their real activity.

Data exchange between network participants is carried out using application services. HLS has a dual role: 1) packages traffic from pure to anonymizing and vice versa; 2) converts external traffic to internal and vice versa. The second property is the redirection of traffic from the network to the local service and back.

hls_service.jpg

Figure 3. Interaction of third-party services with the traffic anonymization service.

As shown in the figure above, HLS acts as an anonymizer and handlers of incoming and outgoing traffic. The remaining parts in the form of applications and services depend on third-party components (as an example, HLM).

Minimum system requirements

  1. Processor: 1x2.2GHz (limit of communication = ~5-10 nodes)
  2. Memory: 0.5GB RAM (~250MB of memory can be consumed)
  3. Storage: 5Gib available space (~3.5GiB the size of hashes per year from one node)

Build and run

Default build and run

$ cd ./cmd/hidden_lake/service
$ make build # create hls, hls_[arch=amd64,arm64]_[os=linux,windows,darwin] and copy to ./bin
$ make run # run ./bin/hls

> [INFO] 2023/06/03 14:32:40 HLS is running...
> [INFO] 2023/06/03 14:32:42 service=HLS type=BRDCS hash=43A5E9C5...BA73DF43 addr=211494E4...EEA12BBC proof=0000000002256145 conn=127.0.0.1:
> [INFO] 2023/06/03 14:32:47 service=HLS type=BRDCS hash=EFDDC1D4...C47588AD addr=211494E4...EEA12BBC proof=0000000000090086 conn=127.0.0.1:
> [INFO] 2023/06/03 14:32:52 service=HLS type=BRDCS hash=8549E257...EDEB2748 addr=211494E4...EEA12BBC proof=0000000000634328 conn=127.0.0.1:
> ...

Service was running with random private key. Open ports 9571 (TCP, traffic) and 9572 (HTTP, interface). Creates ./hls.yml and ./hls.db files. The file hls.db stores hashes of sent/received messages.

Default config hls.yml

settings:
  message_size_bytes: 8192
  key_size_bits: 4096
  fetch_timeout_ms: 60000
  queue_period_ms: 5000
logging:
  - info
  - warn
  - erro
address:
  tcp: 127.0.0.1:9571
  http: 127.0.0.1:9572
services:
  hidden-lake-messenger: 
    host: 127.0.0.1:9592

Example

There are five nodes in the network send_hls, recv_hls and middle_hlt1, middle_hlt2, middle_hlt3. The send_his and recv_hls nodes connects to middle_hlt1, middle_hlt3. As a result, a link of the form send_his <-> middle_hlt1 <-> middle_hlt2 <-> middle_hlt3 <-> recv_hls is created. Due to the specifics of HLS, the centralized middle_hlt nodes does not violate the security and anonymity of the send_hls and recv_hls subjects in any way.

The recv_hls node contains its echo_service, which performs the role of redirecting the request body back to the client as a response. Access to this service is carried out by its alias hidden-echo-service, put forward by the recv_hls node.

...
// handle: "/echo"
// return format: {"echo":string,"return":int}
func echoPage(w http.ResponseWriter, r *http.Request) {
	if r.Method != "POST" {
		response(w, 2, "failed: incorrect method")
		return
	}
	res, err := io.ReadAll(r.Body)
	if err != nil {
		response(w, 3, "failed: read body")
		return
	}
	response(w, 1, string(res))
}
...

Identification between recv_hls and send_hls nodes is performed using public keys. This is the main method of identification and routing in the HLS network. IP addresses are only needed to connect to such a network and no more. Requests and responses structure are HEX encoded.

Structure of request. The body hello, world! is encoded base64.

PUSH_FORMAT='{
    "receiver":"Bob",
    "req_data":{
        "method":"POST",
        "host":"hidden-echo-service",
        "path":"/echo",
        "body":"aGVsbG8sIHdvcmxkIQ=="
    }
}';

Build and run nodes

$ cd examples/anonymity/echo_service/routing
$ make

Logs from one another connected node. When sending requests and receiving responses, another node does not see the action. For him, all actions and moments of inaction are equivalent.

hls_logger.gif

Figure 4. Output of all actions and all received traffic from the middle_hls node.

Send request

$ cd examples/anonymity/echo_service
$ make request # go run ./_request/main.go
# OR
$ ./_request/request.sh

Get response

HTTP/1.1 200 OK
Date: Mon, 22 May 2023 18:18:34 GMT
Content-Length: 113
Content-Type: text/plain; charset=utf-8

{"code":200,"head":{"Content-Type":"application/json"},"body":"eyJlY2hvIjoiaGVsbG8sIHdvcmxkISIsInJldHVybiI6MX0K"}
Request took 8 seconds

Return code 200 is HTTP code = StatusOK. Decode base64 response body

echo "eyJlY2hvIjoiaGVsbG8sIHdvcmxkISIsInJldHVybiI6MX0K" | base64 -d
> {"echo":"hello, world!","return":1}

hls_request.gif

Figure 5. Example of running HLS with internal service.

Simple examples of the anonymity package in the directory github.com/number571/go-peer/pkg/network/anonymity/examples;

⬆ back to top

2. Hidden Lake Messenger

github.com/number571/go-peer/cmd/hidden_lake/applications/messenger;

hlm_logo.png

The Hidden Lake Messenger is a messenger based on the core of an anonymous network with theoretically provable anonymity of HLS. A feature of this messenger is the provision of anonymity of the fact of transactions (sending, receiving).

HLM is an application that implements a graphical user interface (GUI) on a browser-based HTML/CSS/JS display. Most of the code is based on the bootstrap library https://getbootstrap.com /. GUI is adapted to the size of the window, so it can be used both in a desktop and in a smartphone.

More information about HLM in the habr.com/ru/post/701488

How it works

Most of the code is a call to API functions from the HLS kernel. Thanks to this approach, implicit authorization of users is formed from the state of the anonymizing service.

hlm_chat.gif

Figure 6. Example of chat room in HLM.

Build and run

Default build and run

$ cd ./cmd/hidden_lake/applications/messenger
$ make build # create hlm, hlm_[arch=amd64,arm64]_[os=linux,windows,darwin] and copy to ./bin
$ make run # run ./bin/hlm

> [INFO] 2023/06/03 15:30:31 HLM is running...
> ...

Open ports 9591 (HTTP, interface) and 9592 (HTTP, incoming). Creates ./hlm.yml and ./hlm.db files. The file hlm.db stores all sent/received messages in encrypted view.

Default config hlm.yml

settings:
  messages_capacity: 2048
logging:
  - info
  - warn
  - erro
address:
  interface: 127.0.0.1:9591
  incoming: 127.0.0.1:9592
connection: 127.0.0.1:9572

Example

The example will involve (as well as in HLS) five nodes node1_hlm, node2_hlm and middle_hlt_1, middle_hlt_2, middle_hlt_3. The three HLT nodes are only needed for communication between node1_hlm and node2_hlm nodes. Each of the remaining ones is a combination of HLS and HLM, where HLM plays the role of an application and services (as it was depicted in Figure 3 HLS readme).

Build and run nodes

$ cd examples/anonymity/messenger/routing
$ make

The output of the middle_hls node is similar to Figure 4. Than open browser on localhost:8080. It is a node1_hlm. This node is a Bob.

hlm_about.png

Figure 7. Home page of the HLM application.

To see the success of sending and receiving messages, you need to do all the same operations, but with localhost:7070 as node2_hlm. This node will be Alice.

hlm_logger.png

Figure 8. Log of the three nodes with request/response actions.

More example images about HLM pages in the github.com/number571/go-peer/cmd/hidden_lake/applications/messenger/_images

⬆ back to top

3. Hidden Lake Filesharer

github.com/number571/go-peer/cmd/hidden_lake/applications/filesharer;

hlf_logo.png

The Hidden Lake Filesharer is a file sharing service based on the Anonymous Network Core (HLS) with theoretically provable anonymity. A feature of this file sharing service is the anonymity of the fact of transactions (file downloads), taking into account the existence of a global observer.

HLF is an application that implements a graphical user interface (GUI) on a browser-based HTML/CSS/JS display. Most of the code is based on the bootstrap library https://getbootstrap.com/. GUI is adapted to the size of the window, so it can be used both in a desktop and in a smartphone.

More information about HLF in the habr.com/ru/articles/789968

How it works

Most of the code is a call to API functions from the HLS kernel. Thanks to this approach, implicit authorization of users is formed from the state of the anonymizing service.

Unlike applications such as HLS, HLT, and HLM, the HLF application does not have a database. Instead, the storage is used, represented by the usual hlf.stg directory.

hlf_download.gif

Figure 9. Example of download file in HLF (x2 speed).

File transfer is limited by the bandwidth of HLS itself. If we take into account that the packet generation period is 5 seconds, then it will take about 10 seconds to complete the request-response cycle. HLS also limits the size of transmitted packets. If we assume that the limit is 8KiB, taking into account the existing ~4KiB headers, then the transfer rate is defined as 4KiB/10s or 410B/1s.

Build and run

Default build and run

$ cd ./cmd/hidden_lake/applications/filesharer
$ make build # create hlf, hlf_[arch=amd64,arm64]_[os=linux,windows,darwin] and copy to ./bin
$ make run # run ./bin/hlf

> [INFO] 2023/06/03 15:30:31 HLF is running...
> ...

Open ports 9541 (HTTP, interface) and 9542 (HTTP, incoming). Creates ./hlf.yml and ./hlf.stg files. The directory hlf.stg stores all shared/loaded files.

Default config hlf.yml

settings:
  retry_num: 2
  page_offset: 10
logging:
- info
- warn
- erro
address:
  interface: 127.0.0.1:9541
  incoming: 127.0.0.1:9542
connection: 127.0.0.1:9572

Example

The example will involve three nodes node1_hlf, node2_hlf and middle_hlt_1, middle_hlt_2, middle_hlt3_. Both nodes are a combination of HLS and HLF, where HLF plays the role of an application and services (as shown in Figure 3 of the HLS readme). The three remaining nodes are used only for the successful connection of the two main nodes. In other words, HLT nodes are traffic relay nodes.

Build and run nodes

$ cd examples/anonymity/filesharer/routing
$ make

Than open browser on localhost:8080. It is a node1_hlf. This node is a Alice.

hlf_about.png

Figure 10. Home page of the HLF application.

To see the another side of communication, you need to do all the same operations, but with localhost:7070 as node2_hlf. This node will be Bob.

More example images about HLF pages in the github.com/number571/go-peer/cmd/hidden_lake/applications/filesharer/_images

⬆ back to top

4. Hidden Lake Remoter

github.com/number571/go-peer/cmd/hidden_lake/applications/remoter;

hlr_logo.png

The Hidden Lake Remoter this is a service that provides the ability to make remote calls on the anonymous network core (HLS) with theoretically provable anonymity.

Caution

This application can be extremely dangerous if the F2F option is disabled in the HLS application or if a private key known to many is used. Use HLR with caution.

More information about HLR in the habr.com/ru/articles/830130

How it works

Most of the code is a call to API functions from the HLS kernel. Thanks to this approach, implicit authorization of users is formed from the state of the anonymizing service.

The server providing the remote access service is waiting for a request in the form of a command. The command does not depend on the operating system and therefore should have a small additional syntax separating the launch of the main command and its arguments.

As an example, to create a file with the contents of "hello, world!" and then reading from the same file, you will need to run the following command:

bash[@remoter-separator]-c[@remoter-separator]echo 'hello, world' > file.txt && cat file.txt

The [@remoter-separator] label means that the arguments are separated for the main command.

Build and run

Default build and run

$ cd ./cmd/hidden_lake/applications/remoter
$ make build # create hlr, hlr_[arch=amd64,arm64]_[os=linux,windows,darwin] and copy to ./bin
$ make run # run ./bin/hlr

> [INFO] 2023/06/03 15:30:31 HLR is running...
> ...

Open port 9532 (HTTP, incoming). Creates ./hlr.yml file.

Default config hlr.yml

settings:
  exec_timeout_ms: 5000
  password: 4otg9sohTw8Lv8PheDZ7fOD5j5v5sU
logging:
- info
- warn
- erro
address:
  incoming: 127.0.0.1:9532

Example

The example will involve three nodes recv_hlc, send_hls and three repeaters middle_hlt_1, middle_hlt_2, middle_hlt3_. The three remaining nodes are used only for the successful connection of the two main nodes. In other words, HLT nodes are traffic relay nodes.

Build and run nodes

$ cd examples/anonymity/remoter/routing
$ make

Than run command

$ cd examples/anonymity/remoter
$ make request # go run ./_request/main.go

Got response

{"code":200,"head":{"Content-Type":"application/octet-stream"},"body":"aGVsbG8sIHdvcmxkCg=="}

⬆ back to top

5. Hidden Lake Traffic

github.com/number571/go-peer/cmd/hidden_lake/helpers/traffic;

hlt_logo.png

The Hidden Lake Traffic is an application that saves traffic passed through HLS. The saved traffic can be used by other applications when they were offline. HLT provides an API for loading and unloading messages. Messages are stored in the database based on the "ring" structure. Thus, new messages will overwrite the old ones after some time.

More information about HLT in the habr.com/ru/post/717184

How it works

HLT emulates HLS to receive messages. In this scenario, HLT has only the functions of accepting messages, without the ability to generate or send them via HLS or independently.

hlt_client.gif

Figure 11. Example of running HLT client.

Minimum system requirements

  1. Processor: 1x2.2GHz (characteristic for relayer mode)
  2. Memory: 0.5GB RAM (~200MB of memory is consumed in relayer mode)
  3. Storage: 20Gib available space (the size of messages per day from one node in storage mode)

Build and run

Default build and run

$ cd ./cmd/hidden_lake/helpers/traffic
$ make build # create hlt, hlt_[arch=amd64,arm64]_[os=linux,windows,darwin] and copy to ./bin
$ make run # run ./bin/hlt

> [INFO] 2023/06/03 15:39:13 HLT is running...
> ...

Open ports 9581 (HTTP, interface). Creates ./hlt.yml and ./hlt.db files. The file hlm.db stores all sent/received messages as structure ring from network HL.

Default config hlt.yml

settings:
  message_size_bytes: 8192
  key_size_bits: 4096
  messages_capacity: 2048
logging:
  - info
  - warn
  - erro
address:
  tcp: 127.0.0.1:9581
  http: 127.0.0.1:9582
connections:
  - 127.0.0.1:9571

Example

Build and run service

$ cd examples/traffic_actions/keeper
$ make

Run client

$ cd client
$ go run ./main.go w 'hello, world!'
$ go run ./main.go h
$ go run ./main.go r cb3c6558fe0cb64d0d2bad42dffc0f0d9b0f144bc24bb8f2ba06313af9297be4 # hash get by 'h' option

⬆ back to top

6. Hidden Lake Loader

github.com/number571/go-peer/cmd/hidden_lake/helpers/loader

hll_logo.png

The Hidden Lake Loader is a smallest service of the Hidden Lake network applications. It is used to redirect traffic from HLT producers (storages) to HLT consumers. Previously, it was used as a component of HLM, and then HLS applications.

How it works

HLL uses the HLT service interface to download and upload messages. This property is necessary to redirect multiple messages to HLT once, and then to HLS services.

hll_arch.png

Figure 12. Architecture of HLL.

Build and run

Default build and run

$ cd ./cmd/hidden_lake/helpers/loader
$ make build # create hll, hll_[arch=amd64,arm64]_[os=linux,windows,darwin] and copy to ./bin
$ make run # run ./bin/hll

> [INFO] 2023/12/03 02:12:51 HLL is running...
> ...

Open ports 9561 (HTTP). Creates ./hll.yml file.

Default config hll.yml

settings:
  messages_capacity: 2048
logging:
- info
- warn
- erro
address:
  http: 127.0.0.1:9561

Example

In the example, two HLT services are created, where one is a message producer, the other a consumer. First, messages are entered into the manufacturer, then the HLL (message transportation) function is turned on, and at the end, the delivery of all previously entered messages is checked, but already on the consumer's side.

hll_logger.png

Figure 13. Example of running HLL service.

Build and run HLT services

$ cd examples/traffic_actions/loader
$ make

Run transfer

$ cd examples/traffic_actions/loader/client_hll
$ go run ./main.go

Get valid response

messages have been successfully transported

⬆ back to top

7. Hidden Lake Encryptor

github.com/number571/go-peer/cmd/hidden_lake/helpers/encryptor

hle_logo.png

The Hidden Lake Encryptor is a small service of the Hidden Lake network applications. It is used to encrypt and decrypt HL type messages.

How it works

HLE uses the pkg/client and pkg/network/message packages. Encrypted messages can then be sent to HLT for storage and distribution.

Build and run

Default build and run

$ cd ./cmd/hidden_lake/helpers/encryptor
$ make build # create hle, hle_[arch=amd64,arm64]_[os=linux,windows,darwin] and copy to ./bin
$ make run # run ./bin/hle

> [INFO] 2023/12/22 11:03:47 HLE is running...
> ...

Open ports 9551 (HTTP). Creates ./hle.yml file.

Default config hle.yml

settings:
  message_size_bytes: 8192
  key_size_bits: 4096
logging:
- info
- warn
- erro
address:
  http: 127.0.0.1:9551

Example

Build and run HLE service

$ cd examples/encryptor
$ make

Encrypt and decrypt message

$ cd examples/encryptor/client_hle
$ go run ./main.go e 'hello, world!'
> 5a8b4f0b388650fd...8d7cbd8fa01c008
$ go run ./main.go d '5a8b4f0b388650fd...8d7cbd8fa01c008'
> hello, world!

⬆ back to top

8. Hidden Lake Adapters

github.com/number571/go-peer/cmd/hidden_lake/adapters

hla_logo.png

The Hidden Lake Adapters are a way to exchange data between multiple HLS processes via third-party services. Thus, there is no need to use your own computing resources in the face of individual servers to store or distribute the traffic generated by HLS.

More information about HLA in the habr.com/ru/post/720544

How it works

Adapters in their full execution represent one design template - "Flyweight". They are based on the composition of HLS and HLT processes. Adapters adapt to the interfaces of the service for reading/writing data and, thanks to this, are able to conduct anonymizing traffic through the service.

hla_arch.jpg

Figure 14. Architecture of HLA.

Example

Since the adapters are capable of performing the same functions as the source programs, without secret communication channels, then all the examples become similar. So, let's analyze one of the examples based on the echo service.

Build and run nodes

$ cd examples/anonymity/echo_service/secret_channel
$ make

Send request

$ cd examples/anonymity/echo_service
$ ./request.sh

Get response

HTTP/1.1 200 OK
Date: Mon, 22 May 2023 18:18:34 GMT
Content-Length: 113
Content-Type: text/plain; charset=utf-8

{"code":200,"head":{"Content-Type":"application/json"},"body":"eyJlY2hvIjoiaGVsbG8sIHdvcmxkISIsInJldHVybiI6MX0K"}
Request took 8 seconds

There are no external differences, but there are internal ones. While the original model assumed the presence of a middle_hls node through which all traffic was broadcast, there is no such intermediate node in the model based on secret communication channels, there is a service that performs its own logical functions that are in no way tied to traffic anonymization. And, thus, adapters use a third-party service in order to pass traffic through it.

hla_request.gif

Figure 15. Example of running HLA client.

Similarly, you can use a more complex composition, as shown in the example examples/anonymity/messenger/secret_channel.

⬆ back to top

9. Hidden Lake Composite

github.com/number571/go-peer/cmd/hidden_lake/composite

hlc_logo.png

The Hidden Lake Composite combines several HL type's services into one application using startup config.

How it works

The application HLC includes the download of all Hidden Lake services, and runs only the configurations selected by names in the file. The exact names of the services can be found in their pkg/settings/settings.go configuration files.

Build and run

Default build and run

$ cd ./cmd/hidden_lake/composite
$ make build # create hlc, hlc_[arch=amd64,arm64]_[os=linux,windows,darwin] and copy to ./bin
$ make run # run ./bin/hlc

> [INFO] 2023/12/03 02:12:51 HLC is running...
> ...

Creates ./hlc.yml file.

Default config hlc.yml

logging:
- info
- warn
- erro
services:
- hidden-lake-service
- hidden-lake-messenger
- hidden-lake-filesharer

⬆ back to top

Deprecated applications

Previously, some applications (such as HL, HLS, HES) were developed separately from the go-peer platform. Currently, these applications are outdated because they did not keep up with go-peer updates and were based on poor architectural solutions.

The difference between the old version of Hidden Lake and the new one is in the following details:

  1. The new version is based on a model of theoretically provable anonymity (QB networks), while the old version was based on onion routing
  2. The old version was a monolith, incorporating both transport logic, anonymizing, and applied. The new version is already based on the micro service architecture
  3. The new version is located inside the go-peer framework (in the cmd directory), while the old one used go-peer as a library
  4. The main anonymizing and transport functions in the new version of Hidden Lake (at the level of the go-peer framework) have been covered by tests and verified for security. In the old version, there were no tests at all

⬆ back to top

Star History

Star History Chart

⬆ back to top

License

Licensed under the MIT License. See LICENSE for the full license text.

go-peer's People

Contributors

number571 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-peer's Issues

New Hidden Lake application service - Remoter (HLR)

English

In the anonymous Hidden Lake network, it is possible to add remote command execution. In some form, this can be implemented as a simple SSH client that accepts commands, then executes them, and eventually responds with the result of execution. This feature will expand the range of possible ways to use the network.


Russian

В анонимной сети Hidden Lake возможно добавить удалённое исполнение команд. В неком виде это может быть реализовано как простой SSH клиент, принимающий команды, далее исполняющий их, и в итоге отвечающий результатом исполнения. Данная фича позволит расширить круг возможных способов применения сети.

New Hidden Lake application service - Proxy (HLP)

English

The anonymous Hidden Lake network is a closed network. This suggests that it is unable to interact with an external open Internet network. At the moment, all actions on the anonymous network are performed exclusively within itself.

However, this property is not at all fundamental to the HL network and it is technically possible to implement traffic proxying through a friend. This scheme may look like this:

  1. The initiator (sender) has N friends;
  2. The initiator allocates one friend from the set N as a proxy server;
  3. All proxying must take place through traffic anonymization by the HLS service;
  4. The proxy server (friend) should redirect messages with delay > queue_duration_ms.

For a global passive observer, the task of determining the true sender becomes difficult to solve, since it boils down to solving a QB problem from an N-1 set.


Russian

Анонимная сеть Hidden Lake является замкнутой сетью. Это говорит о том, что она неспособна взаимодействовать с внешней открытой сетью Интернет. На текущий момент все действия в анонимной сети совершаются исключительно внутри самой себя.

Тем не менее, это свойство вовсе не является основополагающим для сети HL и чисто технически можно реализовать проксирование трафика через друга. Эта схема может выглядить следующим образом:

  1. У инициатора (отправителя) существует N друзей;
  2. Инициатор выделяет одного друга из множества N в качестве прокси-сервера;
  3. Всё проксирование должно проходить через анонимизацию трафика со стороны HLS сервиса;
  4. Прокси-сервер (друг) должен перенаправлять сообщение с задержкой > queue_duration_ms.

Для глобального пассивного наблюдателя задача определения истинного отправителя становится труднорешаемой, т.к. сводится к решению QB-задачи из N-1 множества.

Add custom linters for code style (docs)

English

When writing a project, it is necessary to adhere to the specified code style described in the documentation. Nevertheless, compliance with it is manual labor and appropriate verification. As a result, some incorrect parts of the code may be skipped and ignored. Linters are able to fix this problem.

https://github.com/number571/go-peer/tree/master/docs#code-style-go-peer


Russian

При написании проекта необходимо придерживаться заданного стиля кода описанного в документации. Тем не менее его соблюдение представляет собой ручной труд и соответствующую проверку. Вследствие этого некоторые неправильные части кода могут быть пропущены и проигнорированы. Линтеры способны исправить данную проблему.

https://github.com/number571/go-peer/tree/master/docs#code-style-go-peer

Add tests for Hidden Lake

English

Currently, the test coverage of the anonymous Hidden Lake network is < 60%. It would be great if the coverage was 80 percent or more.


Russian

На текущий момент покрытие тестами анонимной сети Hidden Lake составляет < 60%. Было бы здорово, если покрытие составляло 80 и более процентов.

Consider using well-known pbkdf in `crypto/entropy`

From the source:

// Increase entropy by multiple hashing.
func (p *sEntropyBooster) BoostEntropy(pData []byte) []byte {

The comment is misleading. This function does not and cannot increase entropy.

IIUC, this function is a password-based key derivation. That is it derives key-material from a password and the salt.

It is important to only feed passwords as a key. Feeding a proper key material to this function might reduce security. So it might be beneficial to rename the parameter to password.

And last but not least, instead of using a variation PBKDF1, it might be better to use a modern algorithm, like argon, scrypt, or at least bcrypt. What is your position on this?

README: Simple typo

  1. The network/anonymity module to ensure anonymity based on the fifth^ stage. Presents the main functions for working with the network on top of the network and queue modules.

expected

based on the fourth^ stage

?

Автоудаление

Считаю необходимым добавление функции автоудаления Онтона из группового чата, т.к. как говорил Владимир Ленин

Цепь прочна настолько, насколько прочно её самое слабое звено

`network/conn` may leak message size to an observer

WritePayload issues 4 separate Write calls to the underlying connection.

It may be the case, that OS sends each part of the request in a separate IP packet.

In such case, an observer can deduce size of the message and the void part.

New Hidden Lake Adapter - Telegram (HLA)

English

There are entities such as adapters in the Hidden Lake network. Their main role is to create secret communication channels through the introduction of secure/anonymized traffic into third-party systems. At this point in time, the Hidden Lake network is already able to function through a centralized service [chatingar] website (https://chatingar.com /).

In a similar way, you can create an adapter for the popular Telegram messenger, the API of which is quite simple, and the possibilities are wide.

An example of an adapter for chatingar: https://github.com/number571/go-peer/tree/master/cmd/hidden_lake/adapters/chatingar
An article on the implementation of chatingar: https://habr.com/ru/articles/800965/ (RUS)


Russian

В сети Hidden Lake существуют такие сущности как адаптеры. Их основная роль заключается создании тайных каналов связи посредством внедрения безопасного / анонимизированного трафика в сторонние системы. На данный момент времени сеть Hidden Lake уже способна функционировать посредством централизованного сервиса chatingar.

Схожим образом можно создать адаптер под популярный мессенджер Telegram, API которого достаточно простое, а возможности широкие.

Пример адаптера для chatingar: https://github.com/number571/go-peer/tree/master/cmd/hidden_lake/adapters/chatingar
Статья по имплементации chatingar: https://habr.com/ru/articles/800965/

An attacker can partially decrypt data

I am going to outline an attack to decrypt some blocks of data using network key. The attack is at network package and network/conn part in particular.

Decrypt message len

The idea is to connect to a node and send some ciphertext to it. The node expects the following:

len(P)||len(V)||P||V

It first read both len(P) and len(V), and then it expects L=len(P)+len(V) bytes.

If we send <L bytes the node is going to timeout and subsequently reset the connection. If send at least L bytes that are not valid ciphertext, we would immediately get a connection reset.

So the approach is simple:

  1. Select 4 blocks of data and save it to X. This will be our len(P)||len(V).
  2. Choose n as a guess for L.
  3. Send X and then n random bytes.
  4. If we get immediate conn reset, then n >= L.
  5. Otherwise n < L.
  6. Repeat, until found.

This setup only gets us L. But we still don't know neither of len(P), nor len(V). The following is going to overcome this problem.

Decrypting Len(V)

Suppose we somehow capture a single encrypted message. That is: len(P)||len(V)||P||V.

The idea is that if we perturb V, decryption will still pass, but if we change P, it will fail.

So we can randomly perturb blocks and check wether we get a connection reset.

This will give us both ciphertext and plaintext of a particular len(V).

Then we can attach this len(V) block to a given len(P) block and decrypt len(P) via algo from previous section.


TL;DR; use TLS, AEAD, AES-GCM and ephemeral keys for transport layer security

Add descriptions to functions (godoc)

English

The go-peer project and the anonymous Hidden Lake network have functions that are not described in any way. To improve the documentation, it would be nice to comment on them.


Russian

В проекте go-peer и анонимной сети Hidden Lake есть функции, которые никак не описаны. Чтобы улучшить документацию, было бы неплохо прокомментировать их.

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.