Skip to content

Commit

Permalink
Merge pull request #1012 from gravitational/rjones/signal-handler
Browse files Browse the repository at this point in the history
Fix ^C ignored issue on CentOS 6.8.
  • Loading branch information
russjones authored May 24, 2017
2 parents ef210f6 + 2bf011c commit ce563f3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ func (process *TeleportProcess) connectToAuthService(role teleport.Role) (*Conne
// NewTeleport takes the daemon configuration, instantiates all required services
// and starts them under a supervisor, returning the supervisor object
func NewTeleport(cfg *Config) (*TeleportProcess, error) {
// before we do anything reset the SIGINT handler back to the default
utils.ResetInterruptSignalHandler()

if err := validateConfig(cfg); err != nil {
return nil, trace.Wrap(err, "Configuration error")
}
Expand Down
20 changes: 20 additions & 0 deletions lib/utils/signal.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package utils

/*
#include <signal.h>
void resetInterruptSignalHandler() {
signal(SIGINT, SIG_DFL);
}
*/
import "C"

// ResetInterruptSignal will reset the handler for SIGINT back to the default
// handler. We need to do this because when sysvinit launches Teleport on some
// operating systems (like CentOS 6.8) it configures Teleport to ignore SIGINT
// signals. See the following for more details:
//
// http://garethrees.org/2015/08/07/ping/
// https://github.com/openssh/openssh-portable/commit/4e0f5e1ec9b6318ef251180dbca50eaa01f74536
func ResetInterruptSignalHandler() {
C.resetInterruptSignalHandler()
}

0 comments on commit ce563f3

Please sign in to comment.