Commit ed401e51 authored by David Stainton's avatar David Stainton

Add cmd/voting and cmd/nonvoting modules

for building the binaries
parent aa75bd36
# Katzenpost non-voting authority configuration file.
#
# The Authority section contains mandatory information.
#
[Authority]
# Addresses are the IP address/port combinations that the authority will bind
# to for incoming connections.
Addresses = [ "192.0.2.1:29483", "[2001:DB8::1]:29483" ]
# DataDir is the absolute path to the server's state files.
DataDir = "/var/lib/katzenpost-authority"
#
# The Logging section controls the logging.
#
[Logging]
# Disable disables logging entirely.
Disable = false
# File specifies the log file, if omitted stdout will be used.
# File = "/var/log/katzenpost.log"
# Level specifies the log level out of `ERROR`, `WARNING`, `NOTICE`,
# `INFO` and `DEBUG`.
#
# Warning: The `DEBUG` log level is unsafe for production use.
Level = "DEBUG"
#
# The Parameters section holds the network parameters.
#
[Parameters]
# Send rate per minute rating limiting.
SendRatePerMinute = 100
# MixLambda is the inverse of the mean of the exponential distribution that
# clients will use to sample delays.
MixLambda = 0.00025
# MixMaxDelay is the maximum per-hop delay in milliseconds.
#
# If omitted, the MaxDelay will be derived from the 0.99999 quantile of
# of the exponential distribution.
MixMaxDelay = 90000
# SendLambda is the mean of the poisson distribution that clients will use
# to sample the send scheduling interval (seconds).
SendLambda = 15.0
# SendMaxInterval is the maximum send interval in milliseconds.
SendMaxInterval = 123000
# MixLoopLambda is the inverse of the mean of the exponential distribution
# that clients will sample to determine send timing of loop decoy messages.
MixLoopLambda = 15.0
# MixLoopMaxInterval is the maximum send interval in milliseconds.
MixLoopMaxInterval = 123000
#
# The Mixes array defines the list of white-listed non-provider nodes.
#
[[Mixes]]
# IdentityKey is the node's EdDSA signing key, in either Base16 OR Base64
# format.
IdentityKey = "kAiVchOBwHVtKJVFJLsdCQ9UyN2SlfhLHYqT8ePBetg="
[[Mixes]]
IdentityKey = "900895721381C0756D28954524BB1D090F54C8DD9295F84B1D8A93F1E3C17AD8"
#
# The Providers array defines the list of white-listed Provider nodes.
#
[[Providers]]
# Identifier is the human readable provider identifier, such as a FQDN.
Identifier = "example.com"
# IdentityKey is the provider's EdDSA signing key, in either Base16 OR Base64
# format.
IdentityKey = "0AV1syaCdBbm3CLmgXLj6HdlMNiTeeIxoDc8Lgk41e0="
// main.go - Katzenpost nonvoting-authrity binary.
// Copyright (C) 2017 Yawning Angel.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"flag"
"fmt"
"os"
"os/signal"
"syscall"
"github.com/katzenpost/authority/nonvoting/server"
"github.com/katzenpost/authority/nonvoting/server/config"
)
func main() {
cfgFile := flag.String("f", "katzenpost-authority.toml", "Path to the authority config file.")
genOnly := flag.Bool("g", false, "Generate the keys and exit immediately.")
flag.Parse()
// Set the umask to something "paranoid".
syscall.Umask(0077)
cfg, err := config.LoadFile(*cfgFile, *genOnly)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to load config file '%v': %v\n", *cfgFile, err)
os.Exit(-1)
}
// Setup the signal handling.
ch := make(chan os.Signal)
signal.Notify(ch, os.Interrupt, syscall.SIGTERM)
rotateCh := make(chan os.Signal)
signal.Notify(rotateCh, syscall.SIGHUP)
// Start up the authority.
svr, err := server.New(cfg)
if err != nil {
if err == server.ErrGenerateOnly {
os.Exit(0)
}
fmt.Fprintf(os.Stderr, "Failed to spawn authority instance: %v\n", err)
os.Exit(-1)
}
defer svr.Shutdown()
// Halt the authority gracefully on SIGINT/SIGTERM.
go func() {
<-ch
svr.Shutdown()
}()
// Rotate server logs upon SIGHUP.
go func() {
<-rotateCh
svr.RotateLog()
}()
// Wait for the authority to explode or be terminated.
svr.Wait()
}
# Katzenpost voting authority configuration file.
#
# The Authority section contains mandatory information.
#
[Authority]
# Addresses are the IP address/port combinations that the authority will bind
# to for incoming connections.
Addresses = [ "192.0.2.1:29483", "[2001:DB8::1]:29483" ]
# DataDir is the absolute path to the server's state files.
DataDir = "/var/lib/katzenpost-authority"
[[Authorities]]
IdentityPublicKey = "BEEF95721381C0756D28954524BB1D090F54C8DD9295F84B1D8A93F1E3C17AD8"
Addresses = [ "192.0.2.7:29483", "[2001:DB8::7]:29483" ]
[[Authorities]]
IdentityPublicKey = "CAFE95721381C0756D28954524BB1D090F54C8DD9295F84B1D8A93F1E3C17AD8"
Addresses = [ "192.0.2.6:29483", "[2001:DB8::6]:29483" ]
#
# The Logging section controls the logging.
#
[Logging]
# Disable disables logging entirely.
Disable = false
# File specifies the log file, if omitted stdout will be used.
# File = "/var/log/katzenpost.log"
# Level specifies the log level out of `ERROR`, `WARNING`, `NOTICE`,
# `INFO` and `DEBUG`.
#
# Warning: The `DEBUG` log level is unsafe for production use.
Level = "DEBUG"
#
# The Parameters section holds the network parameters.
#
[Parameters]
# Send rate per minute rating limiting.
SendRatePerMinute = 100
# MixLambda is the inverse of the mean of the exponential distribution that
# clients will use to sample delays.
MixLambda = 0.00025
# MixMaxDelay is the maximum per-hop delay in milliseconds.
#
# If omitted, the MaxDelay will be derived from the 0.99999 quantile of
# of the exponential distribution.
MixMaxDelay = 90000
# SendLambda is the mean of the poisson distribution that clients will use
# to sample the send scheduling interval (seconds).
SendLambda = 15.0
# SendMaxInterval is the maximum send interval in milliseconds.
SendMaxInterval = 123000
# MixLoopLambda is the inverse of the mean of the exponential distribution
# that clients will sample to determine send timing of loop decoy messages.
MixLoopLambda = 15.0
# MixLoopMaxInterval is the maximum send interval in milliseconds.
MixLoopMaxInterval = 123000
#
# The Mixes array defines the list of white-listed non-provider nodes.
#
[[Mixes]]
# IdentityKey is the node's EdDSA signing key, in either Base16 OR Base64
# format.
IdentityKey = "kAiVchOBwHVtKJVFJLsdCQ9UyN2SlfhLHYqT8ePBetg="
[[Mixes]]
IdentityKey = "900895721381C0756D28954524BB1D090F54C8DD9295F84B1D8A93F1E3C17AD8"
#
# The Providers array defines the list of white-listed Provider nodes.
#
[[Providers]]
# Identifier is the human readable provider identifier, such as a FQDN.
Identifier = "example.com"
# IdentityKey is the provider's EdDSA signing key, in either Base16 OR Base64
# format.
IdentityKey = "0AV1syaCdBbm3CLmgXLj6HdlMNiTeeIxoDc8Lgk41e0="
// main.go - Katzenpost nonvoting-authrity binary.
// Copyright (C) 2017 Yawning Angel.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"flag"
"fmt"
"os"
"os/signal"
"syscall"
"github.com/katzenpost/authority/voting/server"
"github.com/katzenpost/authority/voting/server/config"
)
func main() {
cfgFile := flag.String("f", "katzenpost-authority.toml", "Path to the authority config file.")
genOnly := flag.Bool("g", false, "Generate the keys and exit immediately.")
flag.Parse()
// Set the umask to something "paranoid".
syscall.Umask(0077)
cfg, err := config.LoadFile(*cfgFile, *genOnly)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to load config file '%v': %v\n", *cfgFile, err)
os.Exit(-1)
}
// Setup the signal handling.
ch := make(chan os.Signal)
signal.Notify(ch, os.Interrupt, syscall.SIGTERM)
rotateCh := make(chan os.Signal)
signal.Notify(rotateCh, syscall.SIGHUP)
// Start up the authority.
svr, err := server.New(cfg)
if err != nil {
if err == server.ErrGenerateOnly {
os.Exit(0)
}
fmt.Fprintf(os.Stderr, "Failed to spawn authority instance: %v\n", err)
os.Exit(-1)
}
defer svr.Shutdown()
// Halt the authority gracefully on SIGINT/SIGTERM.
go func() {
<-ch
svr.Shutdown()
}()
// Rotate server logs upon SIGHUP.
go func() {
<-rotateCh
svr.RotateLog()
}()
// Wait for the authority to explode or be terminated.
svr.Wait()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment