Skip to content

Last resort if you can't no longer reach your system via e.g. ssh

License

Notifications You must be signed in to change notification settings

nradchenko/tcpconsole

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tcpconsole: emergency console for Linux

Introduction

tcpconsole is a network emergency console for Linux (as it uses lowlevel Linux specific systemcalls). When your system no longer responds to ssh/telnet logins, you can still connect to tcpconsole (using standard telnet) and get a screendump of the physical console, the process list, do sysrq calls (for system debugging and crash recovery) and list the contents of the Linux kernel message buffer (dmesg).

The program does not do any forking and as little as possible other resource-allocation.

Please note that this is intended to be used on a management LAN only as the password is transmitted in clear-text accross the network (as using SSL would require all kinds of resources).

How it works

It uses the following techniques to become as much available as possible:

  • it locks all memory pages in physical RAM so that if one or more processes are claiming all memory, tcpconsole won't be swapped out
  • it gives itself (for that it must run as root) maximum priority (by setting its nice value to -20 and by setting the schedule priority to realtime (if available)) in case one or more processes is using all CPU time
  • it does not fork any child processes (in case the process table is full)
  • if possible it opens all required files and allocates all required memory at startup (again for when physical memory gets scarce)

Requirements

  • a decent C compiler (like gcc or tcc)
  • glibc 2.15+ / musl 1.1.5+ (or so)
  • make
  • systemd (it should work with other init systems too, but systemd is the only option for now)
  • mounted proc filesystem
  • Linux 3.4+ with the following options enabled (these are defaults nowadays unless you have a custom kernel):
    • CONFIG_MAGIC_SYSRQ=y
    • CONFIG_PRINTK=y
    • CONFIG_VT=y
    • CONFIG_VT_CONSOLE=y

Installation

make
make install

How to use

$ nc server.lan 4095
"'Password: Y0urP@s$w0rd
Enter 'h' for help
(server.lan) emergency console > 

About

Last resort if you can't no longer reach your system via e.g. ssh

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 96.6%
  • Makefile 3.4%