Files
computer-playbook/roles/svc-net-tor/templates/torrc.j2
kevinveenbirkenbachandClaude Opus 5 aa6bbe3b20 feat(lint): render the software identity from its declared variables
SOFTWARE_NAME, SOFTWARE_DOMAIN, SOFTWARE_URL and ORGANIZATION are declared once in group_vars/all/00_general.yml and derive from each other. Eleven templates wrote the value instead, so a rename would reach the four declarations and every consumer that reads them, and silently miss the literal.

The lint reads the name from the declaration rather than carrying it, and searches case-insensitively: the domain is the name lowered, the URL is https:// plus the domain and the organization is the name again, so one literal finds the value of all four. A hit is reported with the variable it should have been, derived from the scheme in front of it and its case. The escape is nocheck: software-identity, same line or the one above.

Every migrated template renders the same bytes as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 21:38:45 +02:00

43 lines
1.3 KiB
Django/Jinja

# Managed by {{ SOFTWARE_NAME }} (roles/svc-net-tor) — do not edit by hand.
RunAsDaemon 0
Log notice stdout
DataDirectory {{ lookup('volume', 'svc-net-tor', 'tor_data').target }}
SocksPort {{ lookup('tor_socks', '0.0.0.0') }}
{% for _cidr in NETWORK_INTERNAL_CIDRS %}
SocksPolicy accept {{ _cidr }}
{% endfor %}
SocksPolicy reject *
ControlPort 127.0.0.1:9051
CookieAuthentication 1
{% if not (TOR_USE_ENTRY_GUARDS | bool) %}
UseEntryGuards 0
{% endif %}
{% if TOR_FLAVOR == 'chutney' %}
%include /run/tor/chutney-net.conf
{% endif %}
{% if TOR_EGRESS_ROUTER_ENABLED | bool %}
AutomapHostsOnResolve 1
AutomapHostsSuffixes .onion
VirtualAddrNetworkIPv4 {{ TOR_EGRESS_VIRTUAL_NET_IPV4 }}
{% if DEPLOYMENT_MODE == 'swarm' %}
TransPort 0.0.0.0:{{ TOR_TRANS_PORT }}
DNSPort 0.0.0.0:{{ TOR_DNS_PORT }}
{% else %}
TransPort 127.0.0.1:{{ TOR_TRANS_PORT }}
DNSPort 127.0.0.1:{{ TOR_DNS_PORT }}
{% if TOR_CONTAINER_DNS_HOST | length > 0 %}
TransPort {{ TOR_CONTAINER_DNS_HOST }}:{{ TOR_TRANS_PORT }}
DNSPort {{ TOR_CONTAINER_DNS_HOST }}:{{ TOR_DNS_PORT }}
{% endif %}
{% endif %}
{% endif %}
HiddenServiceDir /var/lib/tor/infinito/node/
HiddenServiceVersion 3
{% for _p in TOR_ONION_EXTRA_PORTS %}
HiddenServicePort {{ _p.onion_port }} {{ TOR_HS_BACKEND_HOST }}:{{ _p.target.rsplit(':', 1) | last }}
{% endfor %}