Skip to content

Commit

Permalink
update tor-relay
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
  • Loading branch information
jessfraz committed Sep 24, 2018
1 parent 3a10b08 commit 55513d4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
16 changes: 9 additions & 7 deletions tor-relay/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ set -e
set -o pipefail

for relaytype in bridge middle exit; do
sed -i 's/${RELAY_NICKNAME}/'"$RELAY_NICKNAME"'/g' "/etc/tor/torrc.$relaytype"
sed -i 's/${CONTACT_GPG_FINGERPRINT}/'"$CONTACT_GPG_FINGERPRINT"'/g' "/etc/tor/torrc.$relaytype"
sed -i 's/${CONTACT_NAME}/'"$CONTACT_NAME"'/g' "/etc/tor/torrc.$relaytype"
sed -i 's/${CONTACT_EMAIL}/'"$CONTACT_EMAIL"'/g' "/etc/tor/torrc.$relaytype"
sed -i 's/${RELAY_BANDWIDTH_RATE}/'"$RELAY_BANDWIDTH_RATE"'/g' "/etc/tor/torrc.$relaytype"
sed -i 's/${RELAY_BANDWIDTH_BURST}/'"$RELAY_BANDWIDTH_BURST"'/g' "/etc/tor/torrc.$relaytype"
sed -i 's/${RELAY_PORT}/'"$RELAY_PORT"'/g' "/etc/tor/torrc.$relaytype"
file="/etc/tor/torrc.${relaytype}"

sed -i "s/RELAY_NICKNAME/${RELAY_NICKNAME}/g" "$file"
sed -i "s/CONTACT_GPG_FINGERPRINT/${CONTACT_GPG_FINGERPRINT}/g" "$file"
sed -i "s/CONTACT_NAME/${CONTACT_NAME}/g" "$file"
sed -i "s/CONTACT_EMAIL/${CONTACT_EMAIL}/g" "$file"
sed -i "s/RELAY_BANDWIDTH_RATE/${RELAY_BANDWIDTH_RATE}/g" "$file"
sed -i "s/RELAY_BANDWIDTH_BURST/${RELAY_BANDWIDTH_BURST}/g" "$file"
sed -i "s/RELAY_PORT/${RELAY_PORT}/g" "$file"
done

exec tor -f "/etc/tor/torrc.${RELAY_TYPE}"
10 changes: 5 additions & 5 deletions tor-relay/torrc.bridge
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
## See https://www.torproject.org/docs/tor-doc-relay for details.

## Required: what port to advertise for incoming Tor connections.
ORPort ${RELAY_PORT}
ORPort RELAY_PORT
## If you want to listen on a port other than the one advertised in
## ORPort (e.g. to advertise 443 but bind to 9090), you can do it as
## follows. You'll need to do ipchains or other port forwarding
Expand All @@ -97,7 +97,7 @@ ORPort ${RELAY_PORT}
# OutboundBindAddress 10.0.0.5

## A handle for your relay, so people don't have to refer to it by key.
Nickname ${RELAY_NICKNAME}
Nickname RELAY_NICKNAME

## Define these to limit how much relayed traffic you will allow. Your
## own traffic is still unthrottled. Note that RelayBandwidthRate must
Expand All @@ -107,8 +107,8 @@ Nickname ${RELAY_NICKNAME}
## 2^20, etc.
#RelayBandwidthRate 100 KBytes # Throttle traffic to 100KB/s (800Kbps)
#RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)
RelayBandwidthRate ${RELAY_BANDWIDTH_RATE}
RelayBandwidthBurst ${RELAY_BANDWIDTH_BURST}
RelayBandwidthRate RELAY_BANDWIDTH_RATE
RelayBandwidthBurst RELAY_BANDWIDTH_BURST

## Use these to restrict the maximum traffic per day, week, or month.
## Note that this threshold applies separately to sent and received bytes,
Expand All @@ -131,7 +131,7 @@ RelayBandwidthBurst ${RELAY_BANDWIDTH_BURST}
## it's an email address and/or generate a new address for this purpose.
#ContactInfo Random Person <nobody AT example dot com>
## You might also include your PGP or GPG fingerprint if you have one:
ContactInfo ${CONTACT_GPG_FINGERPRINT} ${CONTACT_NAME} ${CONTACT_EMAIL}
ContactInfo CONTACT_GPG_FINGERPRINT CONTACT_NAME CONTACT_EMAIL

## Uncomment this to mirror directory information for others. Please do
## if you have enough bandwidth.
Expand Down
10 changes: 5 additions & 5 deletions tor-relay/torrc.exit
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
## See https://www.torproject.org/docs/tor-doc-relay for details.

## Required: what port to advertise for incoming Tor connections.
ORPort ${RELAY_PORT}
ORPort RELAY_PORT
## If you want to listen on a port other than the one advertised in
## ORPort (e.g. to advertise 443 but bind to 9090), you can do it as
## follows. You'll need to do ipchains or other port forwarding
Expand All @@ -97,7 +97,7 @@ ORPort ${RELAY_PORT}
# OutboundBindAddress 10.0.0.5

## A handle for your relay, so people don't have to refer to it by key.
Nickname ${RELAY_NICKNAME}
Nickname RELAY_NICKNAME

## Define these to limit how much relayed traffic you will allow. Your
## own traffic is still unthrottled. Note that RelayBandwidthRate must
Expand All @@ -107,8 +107,8 @@ Nickname ${RELAY_NICKNAME}
## 2^20, etc.
#RelayBandwidthRate 100 KBytes # Throttle traffic to 100KB/s (800Kbps)
#RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)
RelayBandwidthRate ${RELAY_BANDWIDTH_RATE}
RelayBandwidthBurst ${RELAY_BANDWIDTH_BURST}
RelayBandwidthRate RELAY_BANDWIDTH_RATE
RelayBandwidthBurst RELAY_BANDWIDTH_BURST

## Use these to restrict the maximum traffic per day, week, or month.
## Note that this threshold applies separately to sent and received bytes,
Expand All @@ -131,7 +131,7 @@ RelayBandwidthBurst ${RELAY_BANDWIDTH_BURST}
## it's an email address and/or generate a new address for this purpose.
#ContactInfo Random Person <nobody AT example dot com>
## You might also include your PGP or GPG fingerprint if you have one:
ContactInfo ${CONTACT_GPG_FINGERPRINT} ${CONTACT_NAME} ${CONTACT_EMAIL}
ContactInfo CONTACT_GPG_FINGERPRINT CONTACT_NAME CONTACT_EMAIL

## Uncomment this to mirror directory information for others. Please do
## if you have enough bandwidth.
Expand Down
10 changes: 5 additions & 5 deletions tor-relay/torrc.middle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
## See https://www.torproject.org/docs/tor-doc-relay for details.

## Required: what port to advertise for incoming Tor connections.
ORPort ${RELAY_PORT}
ORPort RELAY_PORT
## If you want to listen on a port other than the one advertised in
## ORPort (e.g. to advertise 443 but bind to 9090), you can do it as
## follows. You'll need to do ipchains or other port forwarding
Expand All @@ -97,7 +97,7 @@ ORPort ${RELAY_PORT}
# OutboundBindAddress 10.0.0.5

## A handle for your relay, so people don't have to refer to it by key.
Nickname ${RELAY_NICKNAME}
Nickname RELAY_NICKNAME

## Define these to limit how much relayed traffic you will allow. Your
## own traffic is still unthrottled. Note that RelayBandwidthRate must
Expand All @@ -107,8 +107,8 @@ Nickname ${RELAY_NICKNAME}
## 2^20, etc.
#RelayBandwidthRate 100 KBytes # Throttle traffic to 100KB/s (800Kbps)
#RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)
RelayBandwidthRate ${RELAY_BANDWIDTH_RATE}
RelayBandwidthBurst ${RELAY_BANDWIDTH_BURST}
RelayBandwidthRate RELAY_BANDWIDTH_RATE
RelayBandwidthBurst RELAY_BANDWIDTH_BURST

## Use these to restrict the maximum traffic per day, week, or month.
## Note that this threshold applies separately to sent and received bytes,
Expand All @@ -131,7 +131,7 @@ RelayBandwidthBurst ${RELAY_BANDWIDTH_BURST}
## it's an email address and/or generate a new address for this purpose.
#ContactInfo Random Person <nobody AT example dot com>
## You might also include your PGP or GPG fingerprint if you have one:
ContactInfo ${CONTACT_GPG_FINGERPRINT} ${CONTACT_NAME} ${CONTACT_EMAIL}
ContactInfo CONTACT_GPG_FINGERPRINT CONTACT_NAME CONTACT_EMAIL

## Uncomment this to mirror directory information for others. Please do
## if you have enough bandwidth.
Expand Down

0 comments on commit 55513d4

Please sign in to comment.