• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System BSD

Protect SSH Access Using Spiped On OpenBSD

How VPS by How VPS
September 1, 2019
in BSD
0
0
SHARES
51
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Want to contribute?


Since SSH access is the most important entry point for administrating your server, it has become a widely used attack vector.

Basic steps to secure SSH include: disabling root access, turning password authentication off altogether (and using keys instead), and changing ports (little to do with security except minimizing common port scanners and log spam).

The next step would be a PF firewall solution with connection tracking. This solution would manage connection states, and block any IP that has too many connections. This works great, and is very easy to do with PF, but the SSH daemon is still exposed to Internet.

How about making SSH completely inaccessible from the outside? This is where spiped comes in. From the homepage:

Spiped (pronounced “ess-pipe-dee”) is a utility for creating symmetrically encrypted and authenticated pipes between socket addresses, so that one may connect to one address (e.g., a UNIX socket on localhost) and transparently have a connection established to another address (e.g., a UNIX socket on a different system). This is similar to ‘ssh -L’ functionality, but does not use SSH and requires a pre-shared symmetric key.

Great! Luckily for us, it has a high quality OpenBSD package which does all the prep work for us, so we can start by installing it:

sudo pkg_add spiped

This also installs a nice init script for us, so we can go ahead and enable it:

sudo rcctl enable spiped

And finally start it:

sudo rcctl start spiped

The init script makes sure that the key is created for us (which we will need on a local machine in a bit).

What we need to do now, is to disable sshd from listening on public address, block port 22 and allow port 8022 (which is by default used in spiped init script).

Open /etc/ssh/sshd_config file and change (and uncomment) the ListenAddress line to read 127.0.0.1:

ListenAddress 127.0.0.1

If you’re using PF rules for port blocking, make sure to pass port 8022 (and you can leave port 22 blocked), e.g:

pass in on egress proto tcp from any to any port 8022

Be sure to reload the rules to make it active:

sudo pfctl -f /etc/pf.conf

Now all we need is to copy the generated spiped key (/etc/spiped/spiped.key) from the server to a local machine and adjust our SSH configuration, something along the following lines:

Host HOSTNAME
ProxyCommand spipe -t %h:8022 -k ~/.ssh/spiped.key

You need to have spipe/spiped installed on a local machine too, obviously. If you’ve copied the key and adjusted the names/paths, then you should be able to connect with that ProxyCommand line in your ~/.ssh/config file.

After you have confirmed that it’s working, we can restart sshd on a server:

sudo rcctl restart sshd

And that’s it! Now you have completely eliminated one large attack vector, and you have one less service listening on a public interface. Your SSH connections should now appear to have come from localhost, for example:

username    ttyp0    localhost                Thu Nov 06 07:58   still logged in

A benefit to using Vultr is that each Vultr VPS offers a nice online VNC-type client available which we can use in-case we accidentally lock ourselves out. Experiment away!

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

Setup and Configure Murmur (Mumble Server) On FreeBSD 11

Next Post

How to Install BookStack on FreeBSD 12

Next Post

How to Install BookStack on FreeBSD 12

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet