-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from riotkit-org/feature/type-local
Version 2.0 (compatible with current stable)
- Loading branch information
Showing
13 changed files
with
449 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM alpine:3.9 | ||
|
||
COPY ./ /rn | ||
|
||
RUN apk add --update bash autossh openssh-client netcat-openbsd grep \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& mkdir -p /home/revproxy \ | ||
&& addgroup -g 1005 revproxy \ | ||
&& adduser -D -u 1005 -h /home/revproxy -G revproxy revproxy \ | ||
&& chown -R revproxy:revproxy /home/revproxy | ||
|
||
VOLUME "/rn/conf.d" | ||
VOLUME "/home/revproxy/.ssh" | ||
WORKDIR "/rn" | ||
|
||
ENTRYPOINT ["/rn/docker-entrypoint.sh"] | ||
CMD ["/rn/bin/bind-network.sh --healthcheck-loop"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
SUDO=sudo | ||
|
||
all: build build_arm | ||
|
||
build: | ||
${SUDO} docker build . -t wolnosciowiec/reverse-networking | ||
|
||
build_arm: | ||
${SUDO} docker build -f ./armhf.Dockerfile . -t wolnosciowiec/reverse-networking:armhf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM balenalib/armv7hf-alpine:3.9 | ||
|
||
COPY ./ /rn | ||
|
||
RUN [ "cross-build-start" ] | ||
RUN apk add --update bash autossh openssh-client netcat-openbsd grep \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& mkdir -p /home/revproxy \ | ||
&& addgroup -g 1005 revproxy \ | ||
&& adduser -D -u 1005 -h /home/revproxy -G revproxy revproxy \ | ||
&& chown -R revproxy:revproxy /home/revproxy | ||
RUN [ "cross-build-end" ] | ||
|
||
VOLUME "/rn/conf.d" | ||
VOLUME "/home/revproxy/.ssh" | ||
WORKDIR "/rn" | ||
|
||
ENTRYPOINT ["/rn/docker-entrypoint.sh"] | ||
CMD ["/rn/bin/bind-network.sh --healthcheck-loop"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
#-------------------------------------------- | ||
# Kill all previously opened ssh sessions | ||
# | ||
# @author RiotKit Team | ||
# @see riotkit.org | ||
#-------------------------------------------- | ||
|
||
cd "$( dirname "${BASH_SOURCE[0]}" )" | ||
source include/functions.sh | ||
|
||
KNOWN_HOSTS_FILE=~/.ssh/known_hosts | ||
|
||
# | ||
# Iterate over each host and fetch it's fingerprint | ||
# | ||
# @framework method | ||
# | ||
executeIterationAction() { | ||
config_file_name=$1 | ||
|
||
if contains_fingerprint ${PN_HOST} ${PN_PORT}; then | ||
echo " .. Fingerprint already present" | ||
return 0 | ||
fi | ||
|
||
echo " .. Fetching a fingerprint for ${PN_HOST}:${PN_PORT}" | ||
ssh-keyscan -p "${PN_PORT}" "${PN_HOST}" >> ${KNOWN_HOSTS_FILE} | ||
} | ||
|
||
# | ||
# $1 - hostname | ||
# $2 - port | ||
# | ||
contains_fingerprint () { | ||
content=$(cat ${KNOWN_HOSTS_FILE}) | ||
host_name=${1} | ||
|
||
# non-standard port is differently formatted | ||
if [[ "${2}" != "22" ]]; then | ||
host_name="[${1}]:${2}" | ||
fi | ||
|
||
if [[ "${content}" == *"${host_name} ssh-"* ]] \ | ||
|| [[ "${content}" == *"${host_name} ecdsa"* ]] \ | ||
|| [[ "${content}" == *"${host_name},"* ]]; then | ||
return 0 | ||
fi | ||
|
||
return 1 | ||
} | ||
|
||
echo " >> Fetching hosts fingerprint first time" | ||
cat ${KNOWN_HOSTS_FILE} | ||
iterateOverConfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.