#!/bin/sh # sslh startup script # PROVIDE: sslh # REQUIRE: LOGIN FILESYSTEMS ldconfig sshd # KEYWORD: shutdown # # Add the following to /etc/rc.conf[.local] to enable this service: # sslh_enable="YES" # # You can fine tune other variables too: # sslh_mode="fork | select | ev" # fork: stable but slow performance # select: higher performance, few hundreds of connections # ev: uses libev as a backend, thousands of connections # sslh_fib: routing table number sslh_precmd() { if command -v check_namevarlist > /dev/null 2>&1; then check_namevarlist fib && return 0 fi sysctl net.fibs > /dev/null 2>&1 || return 0 sslh_fib=${sslh_fib:-"NONE"} case "$sslh_fib" in [Nn][Oo][Nn][Ee]) ;; *) command="setfib -F ${sslh_fib} ${command}" ;; esac } . /etc/rc.subr name="sslh" rcvar=sslh_enable start_precmd="sslh_precmd" load_rc_config $name sslh_enable=${sslh_enable:-"NO"} sslh_mode=${sslh_mode:-"fork"} required_files="%%PREFIX%%/etc/${name}.conf" for value in listening openvpntarget sshtarget sshtimeout ssltarget \ tinctarget xmpptarget; do eval "[ -n \"\${sslh_${value}}\" ]" && \ warn "${name}_${value} no longer used: configuration file available" done command="%%PREFIX%%/sbin/${name}-${sslh_mode}" command_args="-F%%PREFIX%%/etc/${name}.conf" run_rc_command "$1"