Giter Club home page Giter Club logo

unix_socket_tunnel's Introduction

unix_socket_tunnel

unix domain socket tunnel utility.

Requirements

Ruby is required because this utility is ruby script.

Description

This script tunnels unix domain socket to another path. It is supposed to tunnel a socket of ssh-agent.

  1. Default is quiet. It displays the log on the screen with the -v or -l option.
  2. It monitors the parent process and exits when the parent process is finished. It is supposed to start in the background from login shell. It is able to change the process ID to be monitored with the -w option.
  3. The default umask(2) is 0077, and the tunnel destination socket refuses access from group and other. It is able to change umask with the -u option.
  4. It makes sure that the tunnel destination directory is owned. It is able to ignore its owned with --no-dir-owned option.
  5. It checks the security of the tunnel destination directory. It is able to change security check level with --dir-access-deny-mode-mask option.

Usage

$ unix_socket_tunnel -h
Usage: unix_socket_tunnel [options] CONNECT_PATH LISTEN_PATH
    -v, --verbose
    -l, --log-level=LEVEL
    -w, --watch-pid=PID
        --accept-timeout=SECONDS
        --io-chunk-size=BYTES
    -u, --umask=OCTETS
    -m, --unix-socket-mode=OCTETS
        --[no-]dir-owned
        --dir-access-deny-mode-mask=OCTETS

Example

Setting to use ssh-agent in GNU screen. Ssh-agent has already started up at login.

.screenrc:

setenv SCREEN_SESSION 1

.bashrc:

# ssh-agent forwarding in GNU Screen session
if [ -n "$PS1" ]; then          # for interactive shell
  saved_ssh_agent_sock="${HOME}/.ssh/agent_sock"
  unix_socket_tunnel="${HOME}/git_work/unix_socket_tunnel/unix_socket_tunnel"

  if [ -n "${SCREEN_SESSION}" ]; then # add to .screenrc: setenv SCREEN_SESSION 1
    export SSH_AUTH_SOCK="${saved_ssh_agent_sock}"
  elif shopt -q login_shell && [ -n "${SSH_AUTH_SOCK}" ] && [ -S "${SSH_AUTH_SOCK}" ]; then
    rm -f "${saved_ssh_agent_sock}"
    "${unix_socket_tunnel}" "${SSH_AUTH_SOCK}" "${saved_ssh_agent_sock}" &
  fi
fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.