Skip to content

Instantly share code, notes, and snippets.

Created August 4, 2016 13:35
Show Gist options
  • Select an option

  • Save anonymous/e70e4db47f18e2f6ef8e549890b4517e to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/e70e4db47f18e2f6ef8e549890b4517e to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Aug 4, 2016.
    45 changes: 45 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    FROM ubuntu:16.04

    # Set correct environment variables.
    ENV HOME /root
    ENV PORT 2222
    ENV HOSTNAME pair.dasapp.co

    RUN apt-get update && apt-get install -y software-properties-common

    # Use libssh 0.7 https://github.com/tmate-io/tmate/issues/82#issuecomment-216165761
    RUN add-apt-repository ppa:kedazo/libssh-0.7.x

    RUN apt-get update && \
    apt-get -y install git-core build-essential pkg-config libtool libevent-dev libncurses-dev zlib1g-dev automake libssh-dev cmake ruby && \
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

    # Use the latest msgpack-c https://github.com/tmate-io/tmate/issues/82#issuecomment-216165761
    RUN git clone https://github.com/msgpack/msgpack-c.git && \
    cd msgpack-c && \
    cmake . && \
    make && \
    make install && \
    cd ..
    RUN git clone https://github.com/nviennot/tmate-slave.git /opt/tmate-slave
    RUN cd /opt/tmate-slave && \
    ./create_keys.sh && \
    ./autogen.sh && \
    ./configure && \
    make && \
    echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
    locale-gen && \
    ldconfig

    # Add the project scripts
    COPY . /opt/tmate-slave

    WORKDIR /opt/tmate-slave

    CMD ["./message.sh"]

    #RUN mkdir /etc/service/tmate-slave
    #ADD tmate-slave.sh /etc/service/tmate-slave/run

    #RUN mkdir -p /etc/my_init.d
    #ADD message.sh /etc/my_init.d/message.sh
    14 changes: 14 additions & 0 deletions message.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/bin/sh

    DSA=`ssh-keygen -l -f /opt/tmate-slave/keys/ssh_host_dsa_key 2>&1 | cut -d\ -f 2`
    RSA=`ssh-keygen -l -f /opt/tmate-slave/keys/ssh_host_rsa_key 2>&1 | cut -d\ -f 2`
    ECDSA=`ssh-keygen -l -f /opt/tmate-slave/keys/ssh_host_ecdsa_key 2>&1 | cut -d\ -f 2`
    echo Add this to your ~/.tmate.conf file
    echo set -g tmate-server-host \"$HOSTNAME\"
    echo set -g tmate-server-port \"$PORT\"
    echo set -g tmate-server-rsa-fingerprint \"$RSA\"
    echo set -g tmate-server-dsa-fingerprint \"$DSA\"
    echo set -g tmate-server-ecdsa-fingerprint \"$ECDSA\"
    echo set -g tmate-identity \"\" # Can be specified to use a different SSH key.

    /opt/tmate-slave/tmate-slave -h $HOSTNAME -p $PORT