Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client mode support #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion DOCK1

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ EXPOSE 6380
RUN apt-get update && apt-get install -y stunnel4

VOLUME /stunnel
ADD ./stunnel.conf /stunnel/
ADD ./generateconfig.sh /
ADD ./start.sh /

CMD [ "/start.sh" ]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ docker run -d \
runnable/redis-stunnel
```

### Environment variables
Use the following env variables to modify your stunnel configuration :

- REDIS_PORT_6379_TCP_ADDR : hostname of Redis server endpoint
- REDIS_PORT_6379_TCP_PORT : port of Redis server endpoint
- REDIS_STUNNEL_CLIENT_MODE : [yes|no] client vs server mode

## Testing the Setup

To test the `stunnel` setup, run the following NodeJS script. It should print out `[]` (an empty list) if it is a clean Redis server, but would otherwise print out all the keys on the server.
Expand Down
15 changes: 15 additions & 0 deletions generateconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

clientMode="${REDIS_STUNNEL_CLIENT_MODE:-no}"

#define the template config.
cat << EOF
cert = /stunnel/private.pem
pid = /var/run/stunnel.pid
foreground = yes
[redis]
accept = 0.0.0.0:6380
; connect and client config are added by start.sh
client = $clientMode
connect = $REDIS_PORT_6379_TCP_ADDR:$REDIS_PORT_6379_TCP_PORT
EOF
2 changes: 1 addition & 1 deletion start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

echo "connect = $REDIS_PORT_6379_TCP_ADDR:$REDIS_PORT_6379_TCP_PORT" >> /stunnel/stunnel.conf
./generateconfig.sh > /stunnel/stunnel.conf
stunnel4 /stunnel/stunnel.conf
6 changes: 0 additions & 6 deletions stunnel.conf

This file was deleted.

3 changes: 0 additions & 3 deletions test/dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion test/index.js

This file was deleted.