<?xml version="1.0" encoding="UTF-8"?>
<module version="2.0">
	<meta>
		<identity>
			<uri>urn:com:ten60:netkernel:fulcrum:ssh</uri>
			<version>1.2.1</version>
		</identity>
		<info>
			<name>Fulcrum / SSH</name>
			<description>Fulcrum for SSH Transport on port 8022</description>
		</info>
	</meta>
	<system>
		<dynamic/>
	</system>
	<rootspace name="SSHFulcrum" public="false" private-filter="false">
		<endpoint>
			<prototype>SSHTransport</prototype>
			<config>
				<port>8022</port>
				<PKIAuthenticationRequest>
					<identifier>active:openSSHPublicKeyAuthenticator</identifier>
					<argument name="username">arg:username</argument>
					<argument name="publickey">arg:publickey</argument>
				</PKIAuthenticationRequest>
				<passwordAuthenticationRequest>
					<identifier>active:sshPasswordAuth</identifier>
					<argument name="username">arg:username</argument>
					<argument name="password">arg:password</argument>
				</passwordAuthenticationRequest>
				<greetingRequest>
					<identifier>active:sshGreeting</identifier>
					<argument name="username">arg:username</argument>
				</greetingRequest>
				<commandCompletionRequest>
					<identifier>active:sshCompletions</identifier>
				</commandCompletionRequest>
			</config>
		</endpoint>
		<import>
			<uri>urn:com:ten60:netkernel:tpt:ssh</uri>
		</import>
		<overlay>
			<prototype>Throttle</prototype>
			<config>
				<concurrency>2</concurrency>
	  			<queue>500</queue>
	  		</config>
			<space name="Throttled C2Q500 - Dynamic Imports">
				<!--Dynamic Imports-->
				<endpoint>
					<prototype>SimpleImportDiscovery</prototype>
					<grammar>active:SimpleImportDiscovery</grammar>
					<type>SSHFulcrum</type>
				</endpoint>
				<endpoint>
					<prototype>DynamicImport</prototype>
					<config>active:SimpleImportDiscovery</config>
				</endpoint>
				<mapper>
					<config>
						<!--Default Greeting if user does not import an implementation-->
						<endpoint>
							<grammar>
								<active>
									<identifier>active:sshGreeting</identifier>
									<argument name="username"/>
								</active>
							</grammar>
							<request>
								<identifier>data:,%09NetKernel SSHFulcrum v1.0%0A</identifier>
							</request>
						</endpoint>
						<!--Default Completions if user does not import an implementation-->
						<endpoint>
							<grammar>
								<active>
									<identifier>active:sshCompletions</identifier>
								</active>
							</grammar>
							<request>
								<identifier>data:,exit%0Aclear%0A</identifier>
							</request>
						</endpoint>
						<!--
					 		Prevent any default access to layer1 stuff like filesystem or exec - limiter is wrapped in mapper so that the prototype
					 		is resolved in the mapped space and cannot leak through from any possible  dynamic imports
						-->
						<endpoint>
							<grammar><group name="anything"><regex>(file:|active:(exec|wormhole|fls|java|(attach|cut)GoldenThread)).*</regex></group></grammar>
							<request>
								<identifier>GoDirectlyToJail</identifier>
							</request>
						</endpoint>
					</config>
					<space name="Filter Limiter Jail">
						<accessor>
							<prototype>Limiter</prototype>
							<grammar>GoDirectlyToJail</grammar>
						</accessor>
						<import>
							<uri>urn:org:netkernel:ext:layer1</uri>
						</import>
					</space>
				</mapper>
				<import>
					<uri>urn:org:netkernel:ext:layer1</uri>
				</import>
			</space>
		</overlay>
		<import>
			<uri>urn:org:netkernel:ext:layer1</uri>
		</import>
	</rootspace>
</module>
