# GSocket

GSocket (opens new window)


# Required Packages

Run on both client and server

# RHEL/CentOS

dnf install make gcc openssl-devel autoconf git wget

# Debian/Ubuntu

apt update && apt install -y make gcc libssl-dev autoconf git wget

# Install

wget -O gsocket.sh https://raw.githubusercontent.com/hackerschoice/gsocket/master/install.sh
. gsocket.sh
make install

# Server Side

# Generate Key

gsocket -g

# Service

/etc/systemd/system/gs-sshd.service

DANGER

Make sure you replace <KEY> with your own key on line 11











 








[Unit]
Description=OpenSSH server daemon
Documentation=man:sshd(8) man:sshd_config(5)
After=network.target sshd-keygen.target
Wants=sshd-keygen.target

[Service]
Type=notify
EnvironmentFile=-/etc/crypto-policies/back-ends/opensshserver.config
EnvironmentFile=-/etc/sysconfig/sshd
ExecStart=/usr/local/bin/gsocket -s <KEY> /usr/sbin/sshd -D $OPTIONS $CRYPTO_POLICY
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target
chmod 600 /etc/systemd/system/gs-sshd.service
systemctl daemon-reload
systemctl enable --now gs-sshd

# Client Side

# Bash Aliases

~/.bash_aliases

function gssh() {
  local ssh_args="-o StrictHostKeyChecking=no"
  . ~/.gsocket
  if [ ! ${!1} = "" ]; then
    gsocket -s ${!1} ssh ${ssh_args} ${@:2} ${user}@gsocket
  else
    gsocket ssh ${ssh_args} $@ ${user}@gsocket
  fi
}

# .gsocket file

~/.gsocket

user=username
name1=key1
name2=key2

# Login

:~$ gssh name1
gsocket: =Encryption     : SRP-AES-256-CBC-SHA-End2End (Prime: 4096 bits)
Last login: Tue Nov 29 20:50:32 2022 from 127.0.0.1
name1@host:~$
Last Updated: 2023/01/28 17:16+00:00