It works!

This commit is contained in:
B.J. Dweck 2020-10-20 18:58:42 +02:00
commit ab0521b401
17 changed files with 350 additions and 0 deletions

23
broker-config/ca.crt Normal file
View File

@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIID6zCCAtOgAwIBAgIUQJye5MbZVMpOpu87TmmlN/KOBj0wDQYJKoZIhvcNAQEL
BQAwgYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJOWTERMA8GA1UEBwwITmV3IFlv
cmsxFTATBgNVBAoMDEV4YW1wbGUgSW5jLjEcMBoGA1UEAwwTY2EubXF0dC5leGFt
cGxlLmNvbTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5jb20wHhcNMjAx
MDA2MTA1OTE4WhcNMzAxMDA0MTA1OTE4WjCBhDELMAkGA1UEBhMCVVMxCzAJBgNV
BAgMAk5ZMREwDwYDVQQHDAhOZXcgWW9yazEVMBMGA1UECgwMRXhhbXBsZSBJbmMu
MRwwGgYDVQQDDBNjYS5tcXR0LmV4YW1wbGUuY29tMSAwHgYJKoZIhvcNAQkBFhFh
ZG1pbkBleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
ALVndltaj3SX1zuJB0F5woIMUZCHopkgiO027/qE10IgM6SN4lFhR7wR0B/9PXrf
zn1xTC63w9xd3GbnlJvcWhWbh/m1t2Qx2mIvOmoELY8wlY6/V6NzjSgju7mZi0u6
aitU+LXINNuGS+JhVpc54QQ8M9o0jKlnNGnEmPjv6uhbNXx3f8lw3eqSr1ZqmpGd
UQVYKsNYBVzSqsnh/sn/KnGYn/nmpsKRWeLhoslJ3zDjaM/Y4NYol11nWFIPYCk5
7rzzxES/WdWLLnZ2W59YCT54YOGFqXE7oYgReD+Og2YwnGVQQpDcvb2HyIZL/2pa
oC6avMo/eC8HbSxwUKCnj1cCAwEAAaNTMFEwHQYDVR0OBBYEFEC8a9l0rpIdUqCS
i4NJwXlqUoLeMB8GA1UdIwQYMBaAFEC8a9l0rpIdUqCSi4NJwXlqUoLeMA8GA1Ud
EwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAGzxJWZdVozskr5yie2uetpL
aAReCaHEdWudRN3wVW1Dpm2sE23x4VFiJ+Uow9k21GgtGUsAIFqRgb3/QO+ipODC
GRwZmVopkuOaHfCz+tO8xqjvGHCidhhhNFdR9uVkWHoPKsQsvap0SSk12KMtFBRo
3rmeQwPP4qEPFEwc2U0hCUMsIUvMSt3KrA/j+aMRzOXU7QIMFbcYEF1IaGJz1RMh
h1VCXaUlL2liVTWU4XgudB8rMOuETec7un9hzoBVOWHxXdRrGPaoN4+zWiLRCDXO
6wapOhkmTOXuZY/NcMMwTmdJKTEQBD6XIQamv91Ne2bT89LHpcp1LjbaCz+UAxg=
-----END CERTIFICATE-----

View File

@ -0,0 +1,9 @@
listener 8883
connection_messages true
log_type all
websockets_log_level 9
cafile /mosquitto/config/ca.crt
keyfile /mosquitto/config/mqtt.example.com.key
certfile /mosquitto/config/mqtt.example.com.crt
require_certificate true
use_identity_as_username true

View File

@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDjjCCAnYCFFfe134gzLKm3ieNbeoxCvOhwsGwMA0GCSqGSIb3DQEBCwUAMIGE
MQswCQYDVQQGEwJVUzELMAkGA1UECAwCTlkxETAPBgNVBAcMCE5ldyBZb3JrMRUw
EwYDVQQKDAxFeGFtcGxlIEluYy4xHDAaBgNVBAMME2NhLm1xdHQuZXhhbXBsZS5j
b20xIDAeBgkqhkiG9w0BCQEWEWFkbWluQGV4YW1wbGUuY29tMB4XDTIwMTAwNjEx
MDE1M1oXDTMwMTAwNDExMDE1M1owgYExCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJO
WTERMA8GA1UEBwwITmV3IFlvcmsxFTATBgNVBAoMDEV4YW1wbGUgSW5jLjEZMBcG
A1UEAwwQbXF0dC5leGFtcGxlLmNvbTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhh
bXBs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b4DjdvGg3Kjpig6ogOjxLxj8citox/B4cjRMwn99d9bdQ9UbNz
G4J4Jf184BHR5XIalGASk0Dp3iQ9aumHehuSeYrCfpJtXKlwLWU98UJOV9cXH+gT
Tb0q8wKBgQCh61d7FfhtUbKQbd8lQMrxXUDDd8tP9NkmZJ0y1Qg10s5Pl80wZo6H
3PS0ivyxDWBygcxrHOFV26kfMiBrPNtA3HY5ZWFAq1JZ7Yajseg83KSbli6V/+dE
BekdMwQk9MrLELEc1IgqgZU46yrRcKB+6Zh5MJM3bH3qzWpVCXIKCw==
-----END RSA PRIVATE KEY-----

43
docker-compose.yml Normal file
View File

@ -0,0 +1,43 @@
---
version: '3'
services:
tor:
build:
context: ./tor
args:
- SVC_PORT=1883
- SVC_HOST=mqtt.example.com
networks:
- tor_net
restart: always
mqtt.example.com:
image: eclipse-mosquitto
restart: always
volumes:
- broker_data:/mosquitto/data
- ./broker-config:/mosquitto/config
ports:
- 1883
networks:
- tor_net
- broker_net
subscriber:
build: './subscriber'
volumes:
- sub_data:/data
- ./sub-config:/etc/torch
ports:
- 3434
networks:
- broker_net
volumes:
broker_data:
sub_data:
networks:
tor_net:
broker_net:

23
sub-config/ca.crt Normal file
View File

@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIID6zCCAtOgAwIBAgIUQJye5MbZVMpOpu87TmmlN/KOBj0wDQYJKoZIhvcNAQEL
BQAwgYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJOWTERMA8GA1UEBwwITmV3IFlv
cmsxFTATBgNVBAoMDEV4YW1wbGUgSW5jLjEcMBoGA1UEAwwTY2EubXF0dC5leGFt
cGxlLmNvbTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5jb20wHhcNMjAx
MDA2MTA1OTE4WhcNMzAxMDA0MTA1OTE4WjCBhDELMAkGA1UEBhMCVVMxCzAJBgNV
BAgMAk5ZMREwDwYDVQQHDAhOZXcgWW9yazEVMBMGA1UECgwMRXhhbXBsZSB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vEFsnu77fr194GAIhabdvzMz7b7EvDzPO86iXwGRWPAoGBAPza
Km38aH+Ccpk2084H47v783fUXyS2ScbtccVZxqtn0sxEFVnwESYQjz9QovTNlqyN
Y6t6mr1M8nM8MmPwBXFa3D654xtew8zpiA/MvCDbqlXB87BeTSMJWPAERVw2XqAm
wYFg0yJXlRRgQDiiCZCxsVzppSwct/Aa6euGXpBPAoGBAPhSKDCWBIZujEFJACpK
Y3XykJdvmv10jVEHF41vq4X/mHq7o4XXO9e8Rkl+I2YHmPlkcrPcdmSZ6OQw2wTB
PZJcWFxgTfMb+6p6ho/Bof0hYpLuQP3xLS3wN/+oKkA5ASu4GBDqs1DC50pWyAYv
SJoH2p0dkJuBYEb+ncZJD+z5AoGAD6UUEQAYGyOgIZjB3DKixaPeOaDbTjM1N2jD
rFlUsJBY+6iOxaTT+s31fw5nNsxtsTmCXD7WyjWznquv1n0oaQ4dKIhp4+ymIsyk
TY32afYNgQbiJByBm1Rdu2QYQo9epXwgZvftuGdA4yTddGOaQeist7oBLUyNmP6h
UKBcw4MCgYEArWhvqZUvklgmTJi8bSyJaCuZrd7l4HxoajceQ7ujyl/N2zX+HAio
8uw46NUvsiyIk3OCI/59G5BrBtOIYq5KUTNhDdz6q0HMz1MSDRCH5Zt0Cokam+jX
j7QGOQnhTHkGv8Mabo6gmLPifPuYboFzivFGMJH8ur+38YOyGxbwvqI=
-----END RSA PRIVATE KEY-----

21
sub-config/torch-sub.conf Normal file
View File

@ -0,0 +1,21 @@
##############################################################################
# Sample torch-sub.conf file
##############################################################################
[mqtt]
#Topic is required
BrokerHost=mqtt.example.com
BrokerPort=8883
Topic=torch/+/wake
RequireCertificate=True
CaFile=ca.crt
KeyFile=subscriber.key
CertFile=subscriber.crt
[database]
#Filename is optional and defaults to 'clients.json'
Filename=torch_clients.json
[web]
#Port is optional and defaults to 8080
Port=3434

17
subscriber/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM python:3
#WORKDIR /usr/src
#RUN git clone https://git.rudefox.io/bj/torch-subscriber-simple.git
ADD torch-subscriber-simple /usr/src/torch-sub
WORKDIR /usr/src/torch-sub
RUN pip3 install --no-cache-dir -r requirements.txt && \
python3 setup.py install
WORKDIR /data
EXPOSE 8080
VOLUME [ "/etc/torch", "/data" ]
ENTRYPOINT [ "torch-sub" ]
CMD [ "--config-dir", "/etc/torch" ]

@ -0,0 +1 @@
Subproject commit c1a5bb2db0255e7dc5f27d9febeba37051cd7497

View File

@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIID6zCCAtOgAwIBAgIUQJye5MbZVMpOpu87TmmlN/KOBj0wDQYJKoZIhvcNAQEL
BQAwgYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJOWTERMA8GA1UEBwwITmV3IFlv
cmsxFTATBgNVBAoMDEV4YW1wbGUgSW5jLjEcMBoGA1UEAwwTY2EubXF0dC5leGFt
cGxlLmNvbTEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5jb20wHhcNMjAx
MDA2MTA1OTE4WhcNMzAxMDA0MTA1OTE4WjCBhDELMAkGA1UEBhMCVVMxCzAJBgNV
BAgMAk5ZMREwDwYDVQQHDAhOZXcgWW9yazEVMBMGA1UECgwMRXhhbXBsZSBJbmMu
MRwwGgYDVQQDDBNjYS5tcXR0LmV4YW1wbGUuY29tMSAwHgYJKoZIhvcNAQkBFhFh
ZG1pbkBleGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
ALVndltaj3SX1zuJB0F5woIMUZCHopkgiO027/qE10IgM6SN4lFhR7wR0B/9PXrf
zn1xTC63w9xd3GbnlJvcWhWbh/m1t2Qx2mIvOmoELY8wlY6/V6NzjSgju7mZi0u6
aitU+LXINNuGS+JhVpc54QQ8M9o0jKlnNGnEmPjv6uhbNXx3f8lw3eqSr1ZqmpGd
UQVYKsNYBVzSqsnh/sn/KnGYn/nmpsKRWeLhoslJ3zDjaM/Y4NYol11nWFIPYCk5
7r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FlUsJBY+6iOxaTT+s31fw5nNsxtsTmCXD7WyjWznquv1n0oaQ4dKIhp4+ymIsyk
TY32afYNgQbiJByBm1Rdu2QYQo9epXwgZvftuGdA4yTddGOaQeist7oBLUyNmP6h
UKBcw4MCgYEArWhvqZUvklgmTJi8bSyJaCuZrd7l4HxoajceQ7ujyl/N2zX+HAio
8uw46NUvsiyIk3OCI/59G5BrBtOIYq5KUTNhDdz6q0HMz1MSDRCH5Zt0Cokam+jX
j7QGOQnhTHkGv8Mabo6gmLPifPuYboFzivFGMJH8ur+38YOyGxbwvqI=
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,20 @@
##############################################################################
# Sample torch-sub.conf file
##############################################################################
[mqtt]
#Topic is required
BrokerHost=broker
BrokerPort=8883
Topic=torch/+/wake
CaFile=ca.crt
KeyFile=subscriber.key
CertFile=subscriber.crt
[database]
#Filename is optional and defaults to 'clients.json'
Filename=torch_clients.json
[web]
#Port is optional and defaults to 8080
Port=3434

20
tor/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM alpine
ARG SVC_HOST
ARG SVC_PORT
WORKDIR /etc/tor
RUN apk add --no-cache curl tor && \
echo -e "HiddenServiceDir /var/lib/tor/svc/\nHiddenServicePort $SVC_PORT $SVC_HOST:$SVC_PORT" > ./torrc
HEALTHCHECK --interval=60s --timeout=15s --start-period=20s \
CMD curl -s --socks5 127.0.0.1:9050 'https://check.torproject.org/' | grep -qm1 Congratulations
COPY tor.sh /usr/bin/
#VOLUME ["/var/lib/tor/svc"]
#USER tor
CMD ["tor.sh"]

5
tor/tor.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
IP_BROKER=$(nslookup broker | awk '/^Address: / { print $2 }' | tail -n1 | sed -e 's/[[:space:]]//g')
sed -i "s/broker/$IP_BROKER/g" /etc/tor/torrc
tor