Skip to content

Commit

Permalink
doc: add comments in config files to help users
Browse files Browse the repository at this point in the history
Adding comment in config file help users to edit it without having to
keep documentation opened on side.

Change-Id: If58dd43dd6c5ac5dbb4209881fb4c14bd0d88e78
  • Loading branch information
loulou123546 authored and aberaud committed Jul 24, 2024
1 parent 8838918 commit f81d36b
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 30 deletions.
40 changes: 29 additions & 11 deletions extras/packaging/gnu-linux/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,35 @@ configure_yaml() {
sed -i 's/^#certificate:.*$/certificate: \"\/etc\/dhtnet\/id\/id-server.crt\"/' /etc/dhtnet/dnc.yaml
sed -i 's/^#privateKey:.*$/privateKey: \"\/etc\/dhtnet\/id\/id-server.pem\"/' /etc/dhtnet/dnc.yaml
else
echo "bootstrap: \"bootstrap.jami.net\"" > /etc/dhtnet/dnc.yaml
echo "turn_host: \"turn.jami.net\"" > /etc/dhtnet/dnc.yaml
echo "turn_user: \"ring\"" > /etc/dhtnet/dnc.yaml
echo "turn_pass: \"ring\"" > /etc/dhtnet/dnc.yaml
echo "turn_realm: \"ring\"" > /etc/dhtnet/dnc.yaml
echo "port: 22" > /etc/dhtnet/dnc.yaml
echo "ip: \"127.0.0.1\"" > /etc/dhtnet/dnc.yaml
echo "certificate: \"/etc/dhtnet/id/id-server.crt\"" > /etc/dhtnet/dnc.yaml
echo "privateKey: \"/etc/dhtnet/id/id-server.pem\"" > /etc/dhtnet/dnc.yaml
echo "anonymous: false" > /etc/dhtnet/dnc.yaml
echo "verbose: false" > /etc/dhtnet/dnc.yaml
{
echo "# The bootstrap node serves as the entry point to the DHT network."
echo "# By default, bootstrap.jami.net is configured for the public DHT network and should be used for personal use only."
echo "# For production environments, it is recommended to set up your own bootstrap node to establish your own DHT network."
echo "# Documentation: https://docs.jami.net/en_US/user/lan-only.html#boostraping"
echo "bootstrap: \"bootstrap.jami.net\""
echo ""
echo "# TURN server is used as a fallback for connections if the NAT block all possible connections."
echo "# By default is turn.jami.net (which uses coturn) but can be any TURN."
echo "# Developer must set up their own TURN server."
echo "# Documentation: https://docs.jami.net/en_US/developer/going-further/setting-up-your-own-turn-server.html"
echo "turn_host: \"turn.jami.net\""
echo "turn_user: \"ring\""
echo "turn_pass: \"ring\""
echo "turn_realm: \"ring\""
echo ""
echo "# When verbose is set to true, the server logs all incoming connections"
echo "verbose: false"
echo ""
echo "# On server, identities are saved in /etc/dhtnet/id/"
echo "certificate: \"/etc/dhtnet/id/id-server.crt\""
echo "privateKey: \"/etc/dhtnet/id/id-server.pem\""
echo ""
echo "# When anonymous is set to true, the server accepts any connection without checking CA"
echo "# When anonymous is set to false, the server allows only connection which are issued by the same CA as the server"
echo "anonymous: false"
echo ""
echo ""
} > /etc/dhtnet/dnc.yaml
fi
}

Expand Down
19 changes: 10 additions & 9 deletions tools/dhtnet_crtmgr/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,24 @@ int create_yaml_config(std::filesystem::path file, std::filesystem::path certifi
yaml_file << "turn_user: \"ring\"\n";
yaml_file << "turn_pass: \"ring\"\n";
yaml_file << "turn_realm: \"ring\"\n";
if (is_client) {
yaml_file << "\n# When dnc server receives connexions, it forwards them to service at specified IP:port requested by client\n";
yaml_file << "# By default, it forwards them to SSH server running on localhost at port 22\n";
yaml_file << "ip: \"127.0.0.1\"\n";
yaml_file << "port: 22\n";
}

yaml_file << "\n# When verbose is set to true, the server logs all incoming connections\n";
yaml_file << "verbose: false\n";

yaml_file << "\n# On server, identities are saved in /etc/dhtnet/id/\n";
yaml_file << "# On client, they are generaly saved in ~/.dnc/\n";
yaml_file << "certificate: " << certificate << "\n";
yaml_file << "privateKey: " << privateKey << "\n";
if (!is_client) {
if (is_client) {
yaml_file << "\n# When dnc server receives connexions, it forwards them to service at specified IP:port requested by CLIENT\n";
yaml_file << "# By default, it forwards them to SSH server running on localhost at port 22\n";
yaml_file << "ip: \"127.0.0.1\"\n";
yaml_file << "port: 22\n";
} else {
yaml_file << "\n# When anonymous is set to true, the server accepts any connection without checking CA\n";
yaml_file << "# When anonymous is set to false, the server allows only connection which are issued by the same CA as the server\n";
yaml_file << "anonymous: false\n";
}
yaml_file << "\n# When verbose is set to true, the server logs all incoming connections\n";
yaml_file << "verbose: false\n";
yaml_file.close();
fmt::print("Configuration file created in {}\n", file);
} else {
Expand Down
40 changes: 35 additions & 5 deletions tools/dnc/dnc.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
# The bootstrap node serves as the entry point to the DHT network.
# By default, bootstrap.jami.net is configured for the public DHT network and should be used for personal use only.
# For production environments, it is recommended to set up your own bootstrap node to establish your own DHT network.
# Documentation: https://docs.jami.net/en_US/user/lan-only.html#boostraping
bootstrap: "bootstrap.jami.net"

# TURN server is used as a fallback for connections if the NAT block all possible connections.
# By default is turn.jami.net (which uses coturn) but can be any TURN.
# Developer must set up their own TURN server.
# Documentation: https://docs.jami.net/en_US/developer/going-further/setting-up-your-own-turn-server.html
turn_host: "turn.jami.net"
turn_user: "ring"
turn_pass: "ring"
turn_realm: "ring"
port: 22

# When verbose is set to true, the server logs all incoming connections
verbose: false

# On server, identities are saved in /etc/dhtnet/id/
# On client, identities are saved in ~/.dnc/
#certificate: "to/your/certificate.crt"
#privateKey: "to/your/privatekey.pem"


##########################
### For Client Use Only ##
##########################

# When dnc server receives connexions, it forwards them to service at specified IP:port requested by CLIENT.
# By default, it forwards them to SSH server running on localhost at port 22
ip: "127.0.0.1"
# certificate: "to/your/certificate.crt"
# privateKey: "to/your/privatekey.pem"
anonymous: true
verbose: false
port: 22

##########################
### For Server Use Only ##
##########################

# When anonymous is set to true, the server accepts any connection without checking CA
# When anonymous is set to false, the server allows only connection which are issued by the same CA as the server
anonymous: false

32 changes: 30 additions & 2 deletions tools/dsh/dsh.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
# The bootstrap node serves as the entry point to the DHT network.
# By default, bootstrap.jami.net is configured for the public DHT network and should be used for personal use only.
# For production environments, it is recommended to set up your own bootstrap node to establish your own DHT network.
# Documentation: https://docs.jami.net/en_US/user/lan-only.html#boostraping
bootstrap: "bootstrap.jami.net"

# TURN server is used as a fallback for connections if the NAT block all possible connections.
# By default is turn.jami.net (which uses coturn) but can be any TURN.
# Developer must set up their own TURN server.
# Documentation: https://docs.jami.net/en_US/developer/going-further/setting-up-your-own-turn-server.html
turn_host: "turn.jami.net"
turn_user: "ring"
turn_pass: "ring"
turn_realm: "ring"

# On server, identities are saved in /etc/dhtnet/id/
# On client, they are generaly saved in ~/.dnc/
#certificate: "to/your/certificate.crt"
#privateKey: "to/your/privatekey.pem"


##########################
### For Client Use Only ##
##########################

# When dsh server receives connexions, it run the specified binary requested by client
binary: "bash"
# certificate: "/path/to/ca"
# privateKey: "/path/to/privateKey"


##########################
### For Server Use Only ##
##########################

# When anonymous is set to true, the server accepts any connection without checking CA
# When anonymous is set to false, the server allows only connection which are issued by the same CA as the server
anonymous: false

25 changes: 22 additions & 3 deletions tools/dvpn/dvpn.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
# The bootstrap node serves as the entry point to the DHT network.
# By default, bootstrap.jami.net is configured for the public DHT network and should be used for personal use only.
# For production environments, it is recommended to set up your own bootstrap node to establish your own DHT network.
# Documentation: https://docs.jami.net/en_US/user/lan-only.html#boostraping
bootstrap: "bootstrap.jami.net"

# TURN server is used as a fallback for connections if the NAT block all possible connections.
# By default is turn.jami.net (which uses coturn) but can be any TURN.
# Developer must set up their own TURN server.
# Documentation: https://docs.jami.net/en_US/developer/going-further/setting-up-your-own-turn-server.html
turn_host: "turn.jami.net"
turn_user: "ring"
turn_pass: "ring"
turn_realm: "ring"
# configuration_file: "HOME/dhtnet/tools/dvpn/dvpn.yaml" # Change this to the path of the dvpn.yaml file
# certificate: /path/to/certificate
# privateKey: /path/to/privateKey

# On server, identities are saved in /etc/dhtnet/id/
# On client, they are generaly saved in ~/.dnc/
#certificate: "to/your/certificate.crt"
#privateKey: "to/your/privatekey.pem"


##########################
### For Server Use Only ##
##########################

# When anonymous is set to true, the server accepts any connection without checking CA
# When anonymous is set to false, the server allows only connection which are issued by the same CA as the server
anonymous: false

0 comments on commit f81d36b

Please sign in to comment.