oxen-io / lokinet

Lokinet is an anonymous, decentralized and IP based overlay network for the internet.
https://lokinet.org/
GNU General Public License v3.0
1.77k stars 220 forks source link

I'm unable to keep a Lokinet address across Lokinet reconnects despite setting data-dir and keyfile values. #2159

Closed styromaniac closed 1 year ago

styromaniac commented 1 year ago

Here's my /home/styromaniac/.lokinet/lokinet.ini

[router]
# Configuration for routing activity.

# Network ID; this is 'lokinet' for mainnet, 'gamma' for testnet.
#netid=lokinet

# Minimum number of routers lokinet will attempt to maintain connections to.
#min-connections=4

# Maximum number (hard limit) of routers lokinet will be connected to at any time.
#max-connections=6

# Optional directory for containing lokinet runtime data. This includes generated
# private keys.
data-dir=/home/styromaniac/.lokinet

# The number of threads available for performing cryptographic functions.
# The minimum is one thread, but network performance may increase with more.
# threads. Should not exceed the number of logical CPU cores.
# 0 means use the number of logical CPU cores detected at startup.
#worker-threads=0

[network]
# Network settings
# Snapp settings

# Public keys of routers which will act as pinned first-hops. This may be used to
# provide a trusted router (consider that you are not fully anonymous with your
# first hop).  This REQUIRES two or more nodes to be specified.
#strict-connect=

# The private key to persist address with. If not specified the address will be
# ephemeral.
keyfile=/home/styromaniac/.lokinet/lokinet-keyfile.private

# Set the endpoint authentication mechanism.
# none/whitelist/lmq/file
#auth=

# lmq endpoint to talk to for authenticating new sessions
# ipc:///var/lib/lokinet/auth.socket
# tcp://127.0.0.1:5555
#auth-lmq=

# lmq function to call for authenticating new sessions
# llarp.auth
#auth-lmq-method=llarp.auth

# manually add a remote endpoint by .loki address to the access whitelist
#auth-whitelist=

# Read auth tokens from file to accept endpoint auth
# Can be provided multiple times
#auth-file=

# How to interpret the contents of an auth file.
# Possible values: hashes, plaintext
#auth-file-type=

# Manually add a static auth code to accept for endpoint auth
# Can be provided multiple times
#auth-static=

# Determines whether we will pubish our snapp's introset to the DHT.
#reachable=true

# Number of hops in a path. Min 1, max 8.
#hops=4

# Number of paths to maintain at any given time.
#paths=6

# Whether or not we should act as an exit node. Beware that this increases demand
# on the server and may pose liability concerns. Enable at your own risk.
#exit=false

# When in exit mode announce we allow a private range in our introset.  For example:
#     owned-range=10.0.0.0/24
#owned-range=

# Adds an IP traffic type whitelist; can be specified multiple times.  If any are
# specified then only matched traffic will be allowed and all other traffic will be
# dropped.  Examples:
#     traffic-whitelist=tcp
# would allow all TCP/IP packets (regardless of port);
#     traffic-whitelist=0x69
# would allow IP traffic with IP protocol 0x69;
#     traffic-whitelist=udp/53
# would allow UDP port 53; and
#     traffic-whitelist=tcp/smtp
# would allow TCP traffic on the standard smtp port (21).
#traffic-whitelist=

# Specify a `.loki` address and an optional ip range to use as an exit broker.
# Examples:
#     exit-node=whatever.loki
# would map all exit traffic through whatever.loki; and
#     exit-node=stuff.loki:100.0.0.0/24
# would map the IP range 100.0.0.0/24 through stuff.loki.
# This option can be specified multiple times (to map different IP ranges).
#exit-node=

# Specify an optional authentication code required to use a non-public exit node.
# For example:
#     exit-auth=myfavouriteexit.loki:abc
# uses the authentication code `abc` whenever myfavouriteexit.loki is accessed.
# Can be specified multiple times to store codes for different exit nodes.
#exit-auth=

# Enable / disable automatic route configuration.
# When this is enabled and an exit is used Lokinet will automatically configure the
# operating system routes to route public internet traffic through the exit node.
# This is enabled by default, but can be disabled if advanced/manual exit routing
# configuration is desired.
#auto-routing=true

# Enable / disable route configuration blackholes.
# When enabled lokinet will drop IPv4 and IPv6 traffic (when in exit mode) that is not
# handled in the exit configuration.  Enabled by default.
#blackhole-routes=true

# Interface name for lokinet traffic. If unset lokinet will look for a free name
# matching 'lokinetN', starting at N=0 (e.g. lokinet0, lokinet1, ...).
#ifname=

# Local IP and range for lokinet traffic. For example, 172.16.0.1/16 to use
# 172.16.0.1 for this machine and 172.16.x.y for remote peers. If omitted then
# lokinet will attempt to find an unused private range.
#ifaddr=

# For all IPv6 exit traffic you will use this as the base address bitwised or'd with 
# the v4 address in use.
# To disable ipv6 set this to an empty value.
# !!! WARNING !!! Disabling ipv6 tunneling when you have ipv6 routes WILL lead to 
# de-anonymization as lokinet will no longer carry your ipv6 traffic.
#ip6-range=fd00::

# Map a remote `.loki` address to always use a fixed local IP. For example:
#     mapaddr=whatever.loki:172.16.0.10
# maps `whatever.loki` to `172.16.0.10` instead of using the next available IP.
# The given IP address must be inside the range configured by ifaddr=
#mapaddr=

# Adds a lokinet relay `.snode` address to the list of relays to avoid when
# building paths. Can be specified multiple times.
#blacklist-snode=

# Specify SRV Records for services hosted on the SNApp for protocols that use SRV
# records for service discovery. Each line specifies a single SRV record as:
#     srv=_service._protocol priority weight port target.loki
# and can be specified multiple times as needed.
# For more info see
# https://docs.oxen.io/products-built-on-oxen/lokinet/snapps/hosting-snapps
# and general description of DNS SRV record configuration.
#srv=

# How long to wait (in seconds) for a path to align to a pivot router when establishing
# a path through the network to a remote .loki address.
#path-alignment-timeout=

# If given this specifies a file in which to record mapped local tunnel addresses so
# the same local address will be used for the same lokinet address on reboot.  If this
# is not specified then the local IP of remote lokinet targets will not persist across
# restarts of lokinet.
#persist-addrmap-file=/home/styromaniac/.lokinet/addrmap.dat

[paths]
# path selection algorithm options

# Netmask for router path selection; each router must be from a distinct IPv4 subnet
# of the given size.
# E.g. 16 ensures that all routers are using IPs from distinct /16 IP ranges.
#unique-range-size=32

[dns]
# DNS configuration

# Upstream resolver(s) to use as fallback for non-loki addresses.
# Multiple values accepted.
#upstream=

# Intercept all dns traffic (udp/53) going into our lokinet network interface instead of binding a local udp socket
#l3-intercept=false

# Address to bind to for sending upstream DNS requests.

# Address to bind to for handling DNS requests.
#bind=127.0.0.1:0
#bind=127.3.2.1:53

# Add a hosts file to the dns resolver
# For use with client side dns filtering
#add-hosts=

# Can be uncommented and set to 1 to disable resolvconf configuration of lokinet DNS.
# (This is not used directly by lokinet itself, but by the lokinet init scripts
# on systems which use resolveconf)
#no-resolvconf=

[bind]
# This section allows specifying the IPs that lokinet uses for incoming and outgoing
# connections.  For simple setups it can usually be left blank, but may be required
# for routers with multiple IPs, or routers that must listen on a private IP with
# forwarded public traffic.  It can also be useful for clients that want to use a
# consistent outgoing port for which firewall rules can be configured.

# IP and/or port to use for outbound socket connections to lokinet routers.
# 
# If no outbound bind IP is configured then lokinet will use a wildcard IP address
# (equivalent to specifying 0.0.0.0).  If no port is given then a random high port
# will be used.
# 
# Examples:
#     outbound=1.2.3.4:5678
#     outbound=:9000
#     outbound=8.9.10.11
# 
# The second example binds on the wildcard address using port 9000; the third example
# binds on the given IP address using a random high port.
#outbound=

[api]
# JSON API settings

# Determines whether or not the LMQ JSON API is enabled. Defaults 
#enabled=true

# IP address and port to bind to.
# Recommend localhost-only for security purposes.
#bind=tcp://127.0.0.1:1190

[bootstrap]
# Configure nodes that will bootstrap us onto the network

# Whether or not to run as a seed node. We will not have any bootstrap routers configured.
#seed-node=false

# Specify a bootstrap file containing a list of signed RouterContacts of service nodes
# which can act as a bootstrap. Can be specified multiple times.
#add-node=

[logging]
# logging settings

# Log type (format). Valid options are:
#   print - print logs to standard output
#   system - logs directed to the system logger (syslog/eventlog/etc.)
#   file - plaintext formatting to a file
#type=print

# Minimum log level to print. Logging below this level will be ignored.
# Valid log levels, in ascending order, are:
#   trace
#   debug
#   info
#   warn
#   error
#   critical
#   none
#level=info

# When using type=file this is the output filename.
#file=

[services]
ZeroNet=localhost:15441
majestrate commented 1 year ago

what happens if you omit the

[services]
ZeroNet=localhost:15441

part?

styromaniac commented 1 year ago

what happens if you omit the

[services]
ZeroNet=localhost:15441

part?

Nothing.

majestrate commented 1 year ago

On Tue, 18 Apr 2023 07:40:34 -0700 Styromaniac @.***> wrote:

what happens if you omit the

[services]
ZeroNet=localhost:15441

part?

Nothing.

what are the permissions on the data dir and the keyfile in it?

-- ~jeff

jagerman commented 1 year ago

Are you by chance using the system service to run lokinet? If so, the config would be in /etc/loki/lokinet.ini, not $HOME/.lokinet

styromaniac commented 1 year ago

The folder permissions are default like any other folder in the home directory, meaning I am the owner.

styromaniac commented 1 year ago

Are you by chance using the system service to run lokinet? If so, the config would be in /etc/loki/lokinet.ini, not $HOME/.lokinet

I start the service with lokinet-gui.

jagerman commented 1 year ago

I start the service with lokinet-gui.

On Linux systems, lokinet-gui interacts with the system daemon, so you very likely need to put changes in /etc/loki/lokinet.ini rather than under your home directory.

styromaniac commented 1 year ago

I start the service with lokinet-gui.

On Linux systems, lokinet-gui interacts with the system daemon, so you very likely need to put changes in /etc/loki/lokinet.ini rather than under your home directory.

I've tried and I have a private key saved, but the .loki address does not persist between reconnects.

[router]
# Configuration for routing activity.

# Network ID; this is 'lokinet' for mainnet, 'gamma' for testnet.
#netid=lokinet

# Minimum number of routers lokinet will attempt to maintain connections to.
#min-connections=4

# Maximum number (hard limit) of routers lokinet will be connected to at any time.
#max-connections=6

# Optional directory for containing lokinet runtime data. This includes generated
# private keys.
data-dir=/var/lib/lokinet

# The number of threads available for performing cryptographic functions.
# The minimum is one thread, but network performance may increase with more.
# threads. Should not exceed the number of logical CPU cores.
# 0 means use the number of logical CPU cores detected at startup.
#worker-threads=0

[network]
# Network settings
# Snapp settings

# Public keys of routers which will act as pinned first-hops. This may be used to
# provide a trusted router (consider that you are not fully anonymous with your
# first hop).  This REQUIRES two or more nodes to be specified.
#strict-connect=

# The private key to persist address with. If not specified the address will be
# ephemeral.
keyfile=/var/lib/lokinet/low.key

# Set the endpoint authentication mechanism.
# none/whitelist/lmq/file
#auth=

# lmq endpoint to talk to for authenticating new sessions
# ipc:///var/lib/lokinet/auth.socket
# tcp://127.0.0.1:5555
#auth-lmq=

# lmq function to call for authenticating new sessions
# llarp.auth
#auth-lmq-method=llarp.auth

# manually add a remote endpoint by .loki address to the access whitelist
#auth-whitelist=

# Read auth tokens from file to accept endpoint auth
# Can be provided multiple times
#auth-file=

# How to interpret the contents of an auth file.
# Possible values: hashes, plaintext
#auth-file-type=

# Manually add a static auth code to accept for endpoint auth
# Can be provided multiple times
#auth-static=

# Determines whether we will pubish our snapp's introset to the DHT.
#reachable=true

# Number of hops in a path. Min 1, max 8.
#hops=4

# Number of paths to maintain at any given time.
#paths=6

# Whether or not we should act as an exit node. Beware that this increases demand
# on the server and may pose liability concerns. Enable at your own risk.
#exit=false

# When in exit mode announce we allow a private range in our introset.  For example:
#     owned-range=10.0.0.0/24
#owned-range=

# Adds an IP traffic type whitelist; can be specified multiple times.  If any are
# specified then only matched traffic will be allowed and all other traffic will be
# dropped.  Examples:
#     traffic-whitelist=tcp
# would allow all TCP/IP packets (regardless of port);
#     traffic-whitelist=0x69
# would allow IP traffic with IP protocol 0x69;
#     traffic-whitelist=udp/53
# would allow UDP port 53; and
#     traffic-whitelist=tcp/smtp
# would allow TCP traffic on the standard smtp port (21).
#traffic-whitelist=

# Specify a `.loki` address and an optional ip range to use as an exit broker.
# Examples:
#     exit-node=whatever.loki
# would map all exit traffic through whatever.loki; and
#     exit-node=stuff.loki:100.0.0.0/24
# would map the IP range 100.0.0.0/24 through stuff.loki.
# This option can be specified multiple times (to map different IP ranges).
#exit-node=

# Specify an optional authentication code required to use a non-public exit node.
# For example:
#     exit-auth=myfavouriteexit.loki:abc
# uses the authentication code `abc` whenever myfavouriteexit.loki is accessed.
# Can be specified multiple times to store codes for different exit nodes.
#exit-auth=

# Enable / disable automatic route configuration.
# When this is enabled and an exit is used Lokinet will automatically configure the
# operating system routes to route public internet traffic through the exit node.
# This is enabled by default, but can be disabled if advanced/manual exit routing
# configuration is desired.
#auto-routing=true

# Enable / disable route configuration blackholes.
# When enabled lokinet will drop IPv4 and IPv6 traffic (when in exit mode) that is not
# handled in the exit configuration.  Enabled by default.
#blackhole-routes=true

# Interface name for lokinet traffic. If unset lokinet will look for a free name
# matching 'lokinetN', starting at N=0 (e.g. lokinet0, lokinet1, ...).
#ifname=

# Local IP and range for lokinet traffic. For example, 172.16.0.1/16 to use
# 172.16.0.1 for this machine and 172.16.x.y for remote peers. If omitted then
# lokinet will attempt to find an unused private range.
#ifaddr=

# For all IPv6 exit traffic you will use this as the base address bitwised or'd with 
# the v4 address in use.
# To disable ipv6 set this to an empty value.
# !!! WARNING !!! Disabling ipv6 tunneling when you have ipv6 routes WILL lead to 
# de-anonymization as lokinet will no longer carry your ipv6 traffic.
#ip6-range=fd00::

# Map a remote `.loki` address to always use a fixed local IP. For example:
#     mapaddr=whatever.loki:172.16.0.10
# maps `whatever.loki` to `172.16.0.10` instead of using the next available IP.
# The given IP address must be inside the range configured by ifaddr=
#mapaddr=

# Adds a lokinet relay `.snode` address to the list of relays to avoid when
# building paths. Can be specified multiple times.
#blacklist-snode=

# Specify SRV Records for services hosted on the SNApp for protocols that use SRV
# records for service discovery. Each line specifies a single SRV record as:
#     srv=_service._protocol priority weight port target.loki
# and can be specified multiple times as needed.
# For more info see
# https://docs.oxen.io/products-built-on-oxen/lokinet/snapps/hosting-snapps
# and general description of DNS SRV record configuration.
#srv=

# How long to wait (in seconds) for a path to align to a pivot router when establishing
# a path through the network to a remote .loki address.
#path-alignment-timeout=

# If given this specifies a file in which to record mapped local tunnel addresses so
# the same local address will be used for the same lokinet address on reboot.  If this
# is not specified then the local IP of remote lokinet targets will not persist across
# restarts of lokinet.
#persist-addrmap-file=/var/lib/lokinet/addrmap.dat

[paths]
# path selection algorithm options

# Netmask for router path selection; each router must be from a distinct IPv4 subnet
# of the given size.
# E.g. 16 ensures that all routers are using IPs from distinct /16 IP ranges.
#unique-range-size=32

[dns]
# DNS configuration

# Upstream resolver(s) to use as fallback for non-loki addresses.
# Multiple values accepted.
#upstream=

# Intercept all dns traffic (udp/53) going into our lokinet network interface instead of binding a local udp socket
#l3-intercept=false

# Address to bind to for sending upstream DNS requests.

# Address to bind to for handling DNS requests.
#bind=127.0.0.1:0
#bind=127.3.2.1:53

# Add a hosts file to the dns resolver
# For use with client side dns filtering
#add-hosts=

# Can be uncommented and set to 1 to disable resolvconf configuration of lokinet DNS.
# (This is not used directly by lokinet itself, but by the lokinet init scripts
# on systems which use resolveconf)
#no-resolvconf=

[bind]
# This section allows specifying the IPs that lokinet uses for incoming and outgoing
# connections.  For simple setups it can usually be left blank, but may be required
# for routers with multiple IPs, or routers that must listen on a private IP with
# forwarded public traffic.  It can also be useful for clients that want to use a
# consistent outgoing port for which firewall rules can be configured.

# IP and/or port to use for outbound socket connections to lokinet routers.
# 
# If no outbound bind IP is configured then lokinet will use a wildcard IP address
# (equivalent to specifying 0.0.0.0).  If no port is given then a random high port
# will be used.
# 
# Examples:
#     outbound=1.2.3.4:5678
#     outbound=:9000
#     outbound=8.9.10.11
# 
# The second example binds on the wildcard address using port 9000; the third example
# binds on the given IP address using a random high port.
#outbound=

[api]
# JSON API settings

# Determines whether or not the LMQ JSON API is enabled. Defaults 
#enabled=true

# IP address and port to bind to.
# Recommend localhost-only for security purposes.
#bind=tcp://127.0.0.1:1190

[bootstrap]
# Configure nodes that will bootstrap us onto the network

# Whether or not to run as a seed node. We will not have any bootstrap routers configured.
#seed-node=false

# Specify a bootstrap file containing a list of signed RouterContacts of service nodes
# which can act as a bootstrap. Can be specified multiple times.
#add-node=

[logging]
# logging settings

# Log type (format). Valid options are:
#   print - print logs to standard output
#   system - logs directed to the system logger (syslog/eventlog/etc.)
#   file - plaintext formatting to a file
#type=print

# Minimum log level to print. Logging below this level will be ignored.
# Valid log levels, in ascending order, are:
#   trace
#   debug
#   info
#   warn
#   error
#   critical
#   none
#level=info

# When using type=file this is the output filename.
#file=
majestrate commented 1 year ago

restart lokinet using systemctl restart lokinet

styromaniac commented 1 year ago

systemctl restart lokinet

I should have guessed that I had to use that command. Thank you! Problem resolved!