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

(maint) tidy build steps, fix permissions and add uninstall recipe #9

Open
wants to merge 6 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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ RUN mkdir /root/.ssh && \
chmod 700 /root/.ssh && \
ssh-keygen -A
COPY ssh-find-agent.sh /root/ssh-find-agent.sh
COPY docker-entrypoint.sh /
EXPOSE 22
VOLUME ["/root/.ssh/authorized_keys"]
ENTRYPOINT ["/usr/bin/tini","--"]
ENTRYPOINT ["/sbin/tini", "--", "/docker-entrypoint.sh"]
CMD ["/usr/sbin/sshd","-D"]
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ BINDIR ?= $(PREFIX)/bin

install:
@if [ ! -d "$(PREFIX)" ]; then echo Error: need a $(PREFIX) directory; exit 1; fi
@mkdir -p $(PREFIX)/share/pinata-ssh-agent
cp Dockerfile $(PREFIX)/share/pinata-ssh-agent
cp ssh-build.sh $(PREFIX)/share/pinata-ssh-agent/ssh-build
cp ssh-find-agent.sh $(PREFIX)/share/pinata-ssh-agent/ssh-find-agent.sh
@mkdir -p $(BINDIR)
cp pinata-build-sshd.sh $(BINDIR)/pinata-build-sshd
cp pinata-ssh-forward.sh $(BINDIR)/pinata-ssh-forward
cp pinata-ssh-mount.sh $(BINDIR)/pinata-ssh-mount

uninstall:
@if [ ! -d "$(BINDIR)" ]; then echo Error: $(BINDIR) directory does not exist; exit 1; fi
rm $(BINDIR)/pinata-ssh-forward
rm $(BINDIR)/pinata-ssh-mount
4 changes: 4 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e
chown root:root /root/.ssh/authorized_keys
exec "$@"
2 changes: 0 additions & 2 deletions pinata-build-sshd.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/bin/sh

cd /usr/local/share/pinata-ssh-agent
docker build -t pinata-sshd .
2 changes: 1 addition & 1 deletion pinata-ssh-forward.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ IP=`docker inspect --format '{{(index (index .NetworkSettings.Ports "22/tcp") 0)
ssh-keyscan -p ${LOCAL_PORT} ${IP} > ${LOCAL_STATE}/known_hosts 2>/dev/null

ssh -f -o "UserKnownHostsFile=${LOCAL_STATE}/known_hosts" \
-A -p ${LOCAL_PORT} root@${IP} \
-A -S none -p ${LOCAL_PORT} root@${IP} \
/root/ssh-find-agent.sh

echo 'Agent forwarding successfully started.'
Expand Down
5 changes: 0 additions & 5 deletions ssh-build.sh

This file was deleted.