fixed some names
This commit is contained in:
@ -80,12 +80,12 @@ I'm eventually going to make the manager implement net.Conn. This won't be
|
|||||||
exposed in the default application probably though, but rather as a library.
|
exposed in the default application probably though, but rather as a library.
|
||||||
-----BEGIN PGP SIGNATURE-----
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
|
||||||
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAlugdTMACgkQ11wDs5te
|
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAluge7AACgkQ11wDs5te
|
||||||
FOGGTggAqP7jEXjl0dhdxo8ANB2IliJtPRSLvWNk3n+f2XsHYl80cvwjAJ+fZ7d9
|
FOGe4Af/Ulw4pnDfb+vTkevH0dqwqnFO5QEzug6Eb0GfCTykz774KIFWtoAuYoSW
|
||||||
x7rZ30vFwzvGLEt0RB+GU4vbVbuOe4iJL+KbfQJ64MT31U/A53bUSOG2+rOB7asp
|
UvmPaUr0/Kl+Csnl2p2hrnwgReFZvfGSthV1UmfnFuya4d6XyrvRBpsnkdQreKEF
|
||||||
DTcEsLWNUCzohMokem2tvVprldk/IfyHPp7t+PyfzQRNcewPunTJE2Jx1ymzhMhZ
|
krc72VJLhPwhaAGYTVqi3dBAIX3gdm7FGQSSz4NWoWlKAELMrLAf5a0uRlyqPzQI
|
||||||
IUcC/xSAGf5VsT/0ADLDFiR/mq4VpMpnky6Ch3W22RZFGO8dfnQy+v1RbZVmukd/
|
/fq3LNML+KLwq7/VcEaq7vhyRROOUiV8tQAEnGAqszJghXWGhlfR91EsQMlg11SZ
|
||||||
WHf6Q5hhxfrFXZHEVtqKN9t0W//VRzBqPPybjx+QD3WZqVxM5lf0EA8qKNZ3FA21
|
CyN2OMkltdAQN1GcmncoALETyJkGKkGc1gUyxumsZvHv7O5RfYU/4Dd3UtGmTlbm
|
||||||
I1BoQGph7VgpZbEI8VhlAK4tba8bdg==
|
hmnkj0sVdrAsnT82JcErXWdMrlzwDQ==
|
||||||
=T7Xt
|
=NXVQ
|
||||||
-----END PGP SIGNATURE-----
|
-----END PGP SIGNATURE-----
|
||||||
|
@ -27,20 +27,23 @@ func Encrypt(i2pkeypath, aeskeypath string) error {
|
|||||||
if r, e := ioutil.ReadFile(i2pkeypath); e != nil {
|
if r, e := ioutil.ReadFile(i2pkeypath); e != nil {
|
||||||
return e
|
return e
|
||||||
} else {
|
} else {
|
||||||
var key *[32]byte
|
|
||||||
if _, err := os.Stat(aeskeypath); os.IsNotExist(err) {
|
if _, err := os.Stat(aeskeypath); os.IsNotExist(err) {
|
||||||
key = cryptopasta.NewEncryptionKey()
|
key := cryptopasta.NewEncryptionKey()
|
||||||
ioutil.WriteFile(aeskeypath, bytes(*key), 644)
|
ioutil.WriteFile(aeskeypath, bytes(*key), 644)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
crypted, err := cryptopasta.Encrypt(r, key)
|
if ra, re := ioutil.ReadFile(aeskeypath); re != nil {
|
||||||
|
return e
|
||||||
|
} else {
|
||||||
|
crypted, err := cryptopasta.Encrypt(r, key(ra))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ioutil.WriteFile(i2pkeypath, crypted, 644)
|
ioutil.WriteFile(i2pkeypath, crypted, 644)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
91
etc/init.d/samcatd
Normal file
91
etc/init.d/samcatd
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: samcatd
|
||||||
|
# Required-Start: $local_fs $network $named $time $syslog
|
||||||
|
# Required-Stop: $local_fs $network $named $time $syslog
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Description: <DESCRIPTION>
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
SCRIPT='/usr/local/bin/samcatd -f /etc/samcatd/tunnels.ini'
|
||||||
|
RUNAS=samcatd
|
||||||
|
|
||||||
|
PIDFILE=/var/run/samcatd/samcatd.pid
|
||||||
|
RUNFOLDER=/var/run/samcatd
|
||||||
|
LOGFILE=/var/log/samcatd/samcatd.log
|
||||||
|
|
||||||
|
start() {
|
||||||
|
if [ -f "$PIDFILE" ]; then
|
||||||
|
echo 'Service already running' >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo 'Starting destination-isolating proxy service…' >&2
|
||||||
|
start-stop-daemon -S -b -q -d "$RUNFOLDER" -g "$RUNAS" -c "$RUNAS" -p "$PIDFILE" \
|
||||||
|
--startas /bin/bash -- -c "exec $SCRIPT > $LOGFILE 2>&1"
|
||||||
|
echo $! > "$PIDFILE"
|
||||||
|
echo "Service started: $SCRIPT" >&2
|
||||||
|
cat "$PIDFILE" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
if [ ! -f "$PIDFILE" ]; then
|
||||||
|
echo 'Service not running' >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo 'Stopping destination-isolating proxy service…' >&2
|
||||||
|
start-stop-daemon -K -q -d "$RUNFOLDER" -g "$RUNAS" -c "$RUNAS" -p "$PIDFILE" \
|
||||||
|
--startas /bin/bash -- -c "exec $SCRIPT > $LOGFILE 2>&1"
|
||||||
|
echo "Service stopped: $SCRIPT" >&2
|
||||||
|
rm -f "$PIDFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
status() {
|
||||||
|
if [ -f "$PIDFILE" ]; then
|
||||||
|
start-stop-daemon -T -q -d "$RUNFOLDER" -g "$RUNAS" -c "$RUNAS" -p "$PIDFILE" \
|
||||||
|
--startas /bin/bash -- -c "exec $SCRIPT > $LOGFILE 2>&1"
|
||||||
|
echo 'Currently open pipes:' >&2
|
||||||
|
ls /var/run/samcatd/* >&2
|
||||||
|
tail $LOGFILE >&2
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
echo 'Service not running' >&2
|
||||||
|
ls /var/run/samcatd >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo 'Starting destination-isolating proxy service…' >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstall() {
|
||||||
|
echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] "
|
||||||
|
local SURE
|
||||||
|
read SURE
|
||||||
|
if [ "$SURE" = "yes" ]; then
|
||||||
|
stop
|
||||||
|
rm -f "$PIDFILE"
|
||||||
|
echo "Notice: log file is not be removed: '$LOGFILE'" >&2
|
||||||
|
update-rc.d -f samcatd remove
|
||||||
|
rm -fv "$0"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status
|
||||||
|
;;
|
||||||
|
uninstall)
|
||||||
|
uninstall
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart|uninstall}"
|
||||||
|
esac
|
61
etc/samcatd/tunnels.ini
Normal file
61
etc/samcatd/tunnels.ini
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
## Defaults, these are only invoked with the -start option or if labeled tunnels
|
||||||
|
## are not present(samcatd instructions)
|
||||||
|
|
||||||
|
inbound.length = 3
|
||||||
|
outbound.length = 6
|
||||||
|
inbound.lengthVariance = 0
|
||||||
|
outbound.lengthVariance = 0
|
||||||
|
inbound.backupQuantity = 3
|
||||||
|
outbound.backupQuantity = 3
|
||||||
|
inbound.quantity = 5
|
||||||
|
outbound.quantity = 5
|
||||||
|
inbound.allowZeroHop = false
|
||||||
|
outbound.allowZeroHop = false
|
||||||
|
i2cp.encryptLeaseSet = false
|
||||||
|
gzip = true
|
||||||
|
i2cp.reduceOnIdle = true
|
||||||
|
i2cp.reduceIdleTime = 3000000
|
||||||
|
i2cp.reduceQuantity = 2
|
||||||
|
i2cp.enableWhiteList = false
|
||||||
|
i2cp.enableBlackList = false
|
||||||
|
|
||||||
|
[sam-forwarder]
|
||||||
|
type = server
|
||||||
|
host = 127.0.0.1
|
||||||
|
port = 8081
|
||||||
|
inbound.length = 3
|
||||||
|
outbound.length = 6
|
||||||
|
keys = forwarder
|
||||||
|
|
||||||
|
[sam-forwarder-two]
|
||||||
|
type = client
|
||||||
|
host = 127.0.0.1
|
||||||
|
port = 8082
|
||||||
|
inbound.length = 6
|
||||||
|
outbound.length = 3
|
||||||
|
keys = forwarder-two
|
||||||
|
|
||||||
|
[sam-forwarder-three]
|
||||||
|
type = udpclient
|
||||||
|
host = 127.0.0.1
|
||||||
|
port = 8083
|
||||||
|
inbound.length = 3
|
||||||
|
outbound.length = 6
|
||||||
|
keys = forwarder-three
|
||||||
|
|
||||||
|
[sam-forwarder-four]
|
||||||
|
type = udpserver
|
||||||
|
host = 127.0.0.1
|
||||||
|
port = 8084
|
||||||
|
inbound.length = 6
|
||||||
|
outbound.length = 3
|
||||||
|
keys = forwarder-four
|
||||||
|
|
||||||
|
[sam-forwarder-five]
|
||||||
|
type = http
|
||||||
|
host = 127.0.0.1
|
||||||
|
port = 8085
|
||||||
|
inbound.length = 3
|
||||||
|
outbound.length = 6
|
||||||
|
keys = forwarder-five
|
@ -27,20 +27,23 @@ func Encrypt(i2pkeypath, aeskeypath string) error {
|
|||||||
if r, e := ioutil.ReadFile(i2pkeypath); e != nil {
|
if r, e := ioutil.ReadFile(i2pkeypath); e != nil {
|
||||||
return e
|
return e
|
||||||
} else {
|
} else {
|
||||||
var key *[32]byte
|
|
||||||
if _, err := os.Stat(aeskeypath); os.IsNotExist(err) {
|
if _, err := os.Stat(aeskeypath); os.IsNotExist(err) {
|
||||||
key = cryptopasta.NewEncryptionKey()
|
key := cryptopasta.NewEncryptionKey()
|
||||||
ioutil.WriteFile(aeskeypath, bytes(*key), 644)
|
ioutil.WriteFile(aeskeypath, bytes(*key), 644)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
crypted, err := cryptopasta.Encrypt(r, key)
|
if ra, re := ioutil.ReadFile(aeskeypath); re != nil {
|
||||||
|
return e
|
||||||
|
} else {
|
||||||
|
crypted, err := cryptopasta.Encrypt(r, key(ra))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ioutil.WriteFile(i2pkeypath, crypted, 644)
|
ioutil.WriteFile(i2pkeypath, crypted, 644)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user