mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 11:31:49 +01:00
Environment variables (#331)
* Adding relay name env variable and env variables description in markdown file * Fixing env variable usage and adding relay type env variable * Adding bandwidth related environment variables
This commit is contained in:
parent
db6699304d
commit
3cdd8ce273
|
@ -31,6 +31,16 @@ COPY torrc.bridge /etc/tor/torrc.bridge
|
||||||
COPY torrc.middle /etc/tor/torrc.middle
|
COPY torrc.middle /etc/tor/torrc.middle
|
||||||
COPY torrc.exit /etc/tor/torrc.exit
|
COPY torrc.exit /etc/tor/torrc.exit
|
||||||
|
|
||||||
|
# copy the run script
|
||||||
|
COPY run.sh /run.sh
|
||||||
|
RUN chmod u+rwx /run.sh
|
||||||
|
|
||||||
|
# default environment variables
|
||||||
|
ENV RELAY_NICKNAME hacktheplanet
|
||||||
|
ENV RELAY_TYPE middle
|
||||||
|
ENV RELAY_BANDWIDTH_RATE 100 KBytes
|
||||||
|
ENV RELAY_BANDWIDTH_BURST 200 KBytes
|
||||||
|
|
||||||
# make sure files are owned by tor user
|
# make sure files are owned by tor user
|
||||||
RUN chown -R tor /etc/tor
|
RUN chown -R tor /etc/tor
|
||||||
|
|
||||||
|
@ -40,4 +50,4 @@ RUN mkdir /var/lib/tor/.tor
|
||||||
VOLUME /var/lib/tor/.tor
|
VOLUME /var/lib/tor/.tor
|
||||||
RUN chown -R tor /var/lib/tor/.tor
|
RUN chown -R tor /var/lib/tor/.tor
|
||||||
|
|
||||||
ENTRYPOINT [ "tor" ]
|
ENTRYPOINT [ "/run.sh" ]
|
||||||
|
|
11
tor-relay/README.md
Normal file
11
tor-relay/README.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
### Environment variables
|
||||||
|
|
||||||
|
| Name | Description | Default value |
|
||||||
|
| ---------------------------- |:----------------------------------------------------------------------------:| -------------:|
|
||||||
|
| **RELAY_TYPE** | The type of relay (bridge, middle or exit) | middle |
|
||||||
|
| **RELAY_NICKNAME** | The nickname of your relay | hacktheplanet |
|
||||||
|
| **CONTACT_GPG_FINGERPRINT** | Your GPG ID or fingerprint | none |
|
||||||
|
| **CONTACT_NAME** | Your name | none |
|
||||||
|
| **CONTACT_EMAIL** | Your contact email | none |
|
||||||
|
| **RELAY_BANDWIDTH_RATE** | Limit how much traffic will be allowed through your relay (must be > 20KB/s) | 100 KBytes |
|
||||||
|
| **RELAY_BANDWIDTH_BURST** | Allow temporary bursts up to a certain amount | 200 KBytes |
|
12
tor-relay/run.sh
Normal file
12
tor-relay/run.sh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
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"
|
||||||
|
done
|
||||||
|
|
||||||
|
tor -f /etc/tor/torrc.${RELAY_TYPE}
|
|
@ -97,7 +97,7 @@ ORPort 9001
|
||||||
# OutboundBindAddress 10.0.0.5
|
# OutboundBindAddress 10.0.0.5
|
||||||
|
|
||||||
## A handle for your relay, so people don't have to refer to it by key.
|
## A handle for your relay, so people don't have to refer to it by key.
|
||||||
Nickname hacktheplanet
|
Nickname ${RELAY_NICKNAME}
|
||||||
|
|
||||||
## Define these to limit how much relayed traffic you will allow. Your
|
## Define these to limit how much relayed traffic you will allow. Your
|
||||||
## own traffic is still unthrottled. Note that RelayBandwidthRate must
|
## own traffic is still unthrottled. Note that RelayBandwidthRate must
|
||||||
|
@ -107,6 +107,8 @@ Nickname hacktheplanet
|
||||||
## 2^20, etc.
|
## 2^20, etc.
|
||||||
#RelayBandwidthRate 100 KBytes # Throttle traffic to 100KB/s (800Kbps)
|
#RelayBandwidthRate 100 KBytes # Throttle traffic to 100KB/s (800Kbps)
|
||||||
#RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)
|
#RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)
|
||||||
|
RelayBandwidthRate ${RELAY_BANDWIDTH_RATE}
|
||||||
|
RelayBandwidthBurst ${RELAY_BANDWIDTH_BURST}
|
||||||
|
|
||||||
## Use these to restrict the maximum traffic per day, week, or month.
|
## Use these to restrict the maximum traffic per day, week, or month.
|
||||||
## Note that this threshold applies separately to sent and received bytes,
|
## Note that this threshold applies separately to sent and received bytes,
|
||||||
|
|
|
@ -97,7 +97,7 @@ ORPort 9001
|
||||||
# OutboundBindAddress 10.0.0.5
|
# OutboundBindAddress 10.0.0.5
|
||||||
|
|
||||||
## A handle for your relay, so people don't have to refer to it by key.
|
## A handle for your relay, so people don't have to refer to it by key.
|
||||||
Nickname hacktheplanet
|
Nickname ${RELAY_NICKNAME}
|
||||||
|
|
||||||
## Define these to limit how much relayed traffic you will allow. Your
|
## Define these to limit how much relayed traffic you will allow. Your
|
||||||
## own traffic is still unthrottled. Note that RelayBandwidthRate must
|
## own traffic is still unthrottled. Note that RelayBandwidthRate must
|
||||||
|
@ -107,6 +107,8 @@ Nickname hacktheplanet
|
||||||
## 2^20, etc.
|
## 2^20, etc.
|
||||||
#RelayBandwidthRate 100 KBytes # Throttle traffic to 100KB/s (800Kbps)
|
#RelayBandwidthRate 100 KBytes # Throttle traffic to 100KB/s (800Kbps)
|
||||||
#RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)
|
#RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)
|
||||||
|
RelayBandwidthRate ${RELAY_BANDWIDTH_RATE}
|
||||||
|
RelayBandwidthBurst ${RELAY_BANDWIDTH_BURST}
|
||||||
|
|
||||||
## Use these to restrict the maximum traffic per day, week, or month.
|
## Use these to restrict the maximum traffic per day, week, or month.
|
||||||
## Note that this threshold applies separately to sent and received bytes,
|
## Note that this threshold applies separately to sent and received bytes,
|
||||||
|
@ -199,7 +201,7 @@ ExitPolicy accept *:563 # NNTP over SSL
|
||||||
ExitPolicy accept *:587 # SUBMISSION (authenticated clients [MUA's like Thunderbird] send mail over STARTTLS SMTP here)
|
ExitPolicy accept *:587 # SUBMISSION (authenticated clients [MUA's like Thunderbird] send mail over STARTTLS SMTP here)
|
||||||
ExitPolicy accept *:636 # LDAP over SSL
|
ExitPolicy accept *:636 # LDAP over SSL
|
||||||
ExitPolicy accept *:706 # SILC
|
ExitPolicy accept *:706 # SILC
|
||||||
ExitPolicy accept *:749 # kerberos
|
ExitPolicy accept *:749 # kerberos
|
||||||
ExitPolicy accept *:873 # rsync
|
ExitPolicy accept *:873 # rsync
|
||||||
ExitPolicy accept *:902-904 # VMware
|
ExitPolicy accept *:902-904 # VMware
|
||||||
ExitPolicy accept *:981 # Remote HTTPS management for firewall
|
ExitPolicy accept *:981 # Remote HTTPS management for firewall
|
||||||
|
@ -229,8 +231,8 @@ ExitPolicy accept *:5222-5223 # XMPP, XMPP over SSL
|
||||||
ExitPolicy accept *:5228 # Android Market
|
ExitPolicy accept *:5228 # Android Market
|
||||||
ExitPolicy accept *:5900 # VNC
|
ExitPolicy accept *:5900 # VNC
|
||||||
ExitPolicy accept *:6660-6669 # IRC
|
ExitPolicy accept *:6660-6669 # IRC
|
||||||
ExitPolicy accept *:6679 # IRC SSL
|
ExitPolicy accept *:6679 # IRC SSL
|
||||||
ExitPolicy accept *:6697 # IRC SSL
|
ExitPolicy accept *:6697 # IRC SSL
|
||||||
ExitPolicy accept *:8000 # iRDMI
|
ExitPolicy accept *:8000 # iRDMI
|
||||||
ExitPolicy accept *:8008 # HTTP alternate
|
ExitPolicy accept *:8008 # HTTP alternate
|
||||||
ExitPolicy accept *:8074 # Gadu-Gadu
|
ExitPolicy accept *:8074 # Gadu-Gadu
|
||||||
|
|
|
@ -97,7 +97,7 @@ ORPort 9001
|
||||||
# OutboundBindAddress 10.0.0.5
|
# OutboundBindAddress 10.0.0.5
|
||||||
|
|
||||||
## A handle for your relay, so people don't have to refer to it by key.
|
## A handle for your relay, so people don't have to refer to it by key.
|
||||||
Nickname hacktheplanet
|
Nickname ${RELAY_NICKNAME}
|
||||||
|
|
||||||
## Define these to limit how much relayed traffic you will allow. Your
|
## Define these to limit how much relayed traffic you will allow. Your
|
||||||
## own traffic is still unthrottled. Note that RelayBandwidthRate must
|
## own traffic is still unthrottled. Note that RelayBandwidthRate must
|
||||||
|
@ -107,6 +107,8 @@ Nickname hacktheplanet
|
||||||
## 2^20, etc.
|
## 2^20, etc.
|
||||||
#RelayBandwidthRate 100 KBytes # Throttle traffic to 100KB/s (800Kbps)
|
#RelayBandwidthRate 100 KBytes # Throttle traffic to 100KB/s (800Kbps)
|
||||||
#RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)
|
#RelayBandwidthBurst 200 KBytes # But allow bursts up to 200KB (1600Kb)
|
||||||
|
RelayBandwidthRate ${RELAY_BANDWIDTH_RATE}
|
||||||
|
RelayBandwidthBurst ${RELAY_BANDWIDTH_BURST}
|
||||||
|
|
||||||
## Use these to restrict the maximum traffic per day, week, or month.
|
## Use these to restrict the maximum traffic per day, week, or month.
|
||||||
## Note that this threshold applies separately to sent and received bytes,
|
## Note that this threshold applies separately to sent and received bytes,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user