Skip to content

Instantly share code, notes, and snippets.

@drscream
Created May 27, 2018 20:24
Show Gist options
  • Save drscream/ce7b4855bbd63805c5128ff0e86eebfb to your computer and use it in GitHub Desktop.
Save drscream/ce7b4855bbd63805c5128ff0e86eebfb to your computer and use it in GitHub Desktop.
illumos SmartOS SMF manifest to configure and provide a simple ssh tunnel solution!
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='application/sshtunnel' type='service' version='0'>
<dependency name='net-physical' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/physical'/>
</dependency>
<dependency name='filesystem' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<exec_method name='start' type='method' exec='/usr/bin/ssh -N -p %{jumphost/port} -L %{bind/address}:%{bind/port}:%{endpoint/address}:%{endpoint/port} %{jumphost/address}' timeout_seconds='0'/>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='10'/>
<exec_method name='refresh' type='method' exec=':kill -HUP' timeout_seconds='60'/>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='contract'/>
<propval name='ignore_error' type='astring' value='core,signal'/>
</property_group>
<instance name='default' enabled='false'>
<method_context working_directory='/root'>
<method_credential user='root' group='root'/>
</method_context>
<property_group name='jumphost' type='application'>
<propval name='address' type='astring' value='jumphost.example.com'/>
<propval name='port' type='integer' value='22'/>
</property_group>
<property_group name='bind' type='application'>
<propval name='address' type='astring' value='127.0.0.1'/>
<propval name='port' type='integer' value='4443'/>
</property_group>
<property_group name='endpoint' type='application'>
<propval name='address' type='astring' value='endpoint.example.com'/>
<propval name='port' type='integer' value='443'/>
</property_group>
</instance>
<instance name='remote-exchange' enabled='false'>
<method_context working_directory='/home/myuser'>
<method_credential user='myuser' group='example'/>
</method_context>
<property_group name='jumphost' type='application'>
<propval name='address' type='astring' value='user@remote'/>
<propval name='port' type='integer' value='22'/>
</property_group>
<property_group name='bind' type='application'>
<propval name='address' type='astring' value='127.0.0.1'/>
<propval name='port' type='integer' value='1993'/>
</property_group>
<property_group name='endpoint' type='application'>
<propval name='address' type='astring' value='exchange.remote.xxx.tld'/>
<propval name='port' type='integer' value='993'/>
</property_group>
</instance>
<stability value='Evolving'/>
<template>
<common_name>
<loctext xml:lang='C'>SSH Tunnel</loctext>
</common_name>
</template>
</service>
</service_bundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment