Remove remote shell support

See gh-7044
This commit is contained in:
Stephane Nicoll
2016-10-11 17:59:25 +02:00
parent 66a3df454f
commit c5cc626d48
36 changed files with 5 additions and 2498 deletions

View File

@@ -1042,26 +1042,6 @@ content into your application; rather pick only the properties that you need.
management.info.git.enabled=true # Enable git info.
management.info.git.mode=simple # Mode to use to expose git information.
# REMOTE SHELL ({sc-spring-boot-actuator}/autoconfigure/ShellProperties.{sc-ext}[ShellProperties])
management.shell.auth.type=simple # Authentication type. Auto-detected according to the environment.
management.shell.auth.jaas.domain=my-domain # JAAS domain.
management.shell.auth.key.path= # Path to the authentication key. This should point to a valid ".pem" file.
management.shell.auth.simple.user.name=user # Login user.
management.shell.auth.simple.user.password= # Login password.
management.shell.auth.spring.roles=ADMIN # Comma-separated list of required roles to login to the CRaSH console.
management.shell.command-path-patterns=classpath*:/commands/**,classpath*:/crash/commands/** # Patterns to use to look for commands.
management.shell.command-refresh-interval=-1 # Scan for changes and update the command if necessary (in seconds).
management.shell.config-path-patterns=classpath*:/crash/* # Patterns to use to look for configurations.
management.shell.disabled-commands=jpa*,jdbc*,jndi* # Comma-separated list of commands to disable.
management.shell.disabled-plugins= # Comma-separated list of plugins to disable. Certain plugins are disabled by default based on the environment.
management.shell.ssh.auth-timeout = # Number of milliseconds after user will be prompted to login again.
management.shell.ssh.enabled=true # Enable CRaSH SSH support.
management.shell.ssh.idle-timeout = # Number of milliseconds after which unused connections are closed.
management.shell.ssh.key-path= # Path to the SSH server key.
management.shell.ssh.port=2000 # SSH port.
management.shell.telnet.enabled=false # Enable CRaSH telnet support. Enabled by default if the TelnetPlugin is available.
management.shell.telnet.port=5000 # Telnet port.
# TRACING ({sc-spring-boot-actuator}/trace/TraceProperties.{sc-ext}[TraceProperties])
management.trace.include=request-headers,response-headers,cookies,errors # Items to be included in the trace.

View File

@@ -124,7 +124,6 @@ When you're ready to push your Spring Boot application to production, we've got
* *Connection options:*
<<production-ready-features.adoc#production-ready-monitoring, HTTP>> |
<<production-ready-features.adoc#production-ready-jmx, JMX>> |
<<production-ready-features.adoc#production-ready-remote-shell, SSH>>
* *Monitoring:*
<<production-ready-features.adoc#production-ready-metrics, Metrics>> |
<<production-ready-features.adoc#production-ready-auditing, Auditing>> |

View File

@@ -5,8 +5,8 @@
--
Spring Boot includes a number of additional features to help you monitor and manage your
application when it's pushed to production. You can choose to manage and monitor your
application using HTTP endpoints, with JMX or even by remote shell (SSH or Telnet).
Auditing, health and metrics gathering can be automatically applied to your application.
application using HTTP endpoints or with JMX. Auditing, health and metrics gathering can
be automatically applied to your application.
Actuator HTTP endpoints are only available with a Spring MVC-based application. In
particular, it will not work with Jersey <<howto.adoc#howto-use-actuator-with-jersey,
@@ -802,148 +802,6 @@ If you are using Jolokia but you don't want Spring Boot to configure it, simply
[[production-ready-remote-shell]]
== Monitoring and management using a remote shell (deprecated)
Spring Boot supports an integrated Java shell called '`CRaSH`'. You can use CRaSH to
`ssh` or `telnet` into your running application. To enable remote shell support, add
the following dependency to your project:
[source,xml,indent=0]
----
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-remote-shell</artifactId>
</dependency>
----
TIP: If you want to also enable telnet access you will additionally need a dependency
on `org.crsh:crsh.shell.telnet`.
NOTE: CRaSH requires to run with a JDK as it compiles commands on the fly. If a basic
`help` command fails, you are probably running with a JRE.
[[production-ready-connecting-to-the-remote-shell]]
=== Connecting to the remote shell
By default the remote shell will listen for connections on port `2000`. The default user
is `user` and the default password will be randomly generated and displayed in the log
output. If your application is using Spring Security, the shell will use
<<boot-features-security, the same configuration>> by default. If not, a simple
authentication will be applied and you should see a message like this:
[indent=0]
----
Using default password for shell access: ec03e16c-4cf4-49ee-b745-7c8255c1dd7e
----
Linux and OSX users can use `ssh` to connect to the remote shell, Windows users can
download and install http://www.putty.org/[PuTTY].
[indent=0,subs="attributes"]
----
$ ssh -p 2000 user@localhost
user@localhost's password:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v{spring-boot-version}) on myhost
----
Type `help` for a list of commands. Spring Boot provides `metrics`, `beans`, `autoconfig`
and `endpoint` commands.
[[production-ready-remote-shell-credentials]]
==== Remote shell credentials
You can use the `management.shell.auth.simple.user.name` and
`management.shell.auth.simple.user.password` properties to configure custom connection
credentials. It is also possible to use a '`Spring Security`' `AuthenticationManager` to
handle login duties. See the
{dc-spring-boot-actuator}/autoconfigure/CrshAutoConfiguration.{dc-ext}[`CrshAutoConfiguration`]
and {dc-spring-boot-actuator}/autoconfigure/ShellProperties.{dc-ext}[`ShellProperties`]
Javadoc for full details.
[[production-ready-extending-the-remote-shell]]
=== Extending the remote shell
The remote shell can be extended in a number of interesting ways.
[[production-ready-remote-commands]]
==== Remote shell commands
You can write additional shell commands using Groovy or Java (see the CRaSH documentation
for details). By default Spring Boot will search for commands in the following locations:
* `+classpath*:/commands/**+`
* `+classpath*:/crash/commands/**+`
TIP: You can change the search path by settings a `shell.command-path-patterns` property.
NOTE: If you are using an executable archive, any classes that a shell command depends
upon must be packaged in a nested jar rather than directly in the executable jar or war.
Here is a simple '`hello`' command that could be loaded from
`src/main/resources/commands/hello.groovy`
[source,groovy,indent=0]
----
package commands
import org.crsh.cli.Command
import org.crsh.cli.Usage
import org.crsh.command.InvocationContext
class hello {
@Usage("Say Hello")
@Command
def main(InvocationContext context) {
return "Hello"
}
}
----
Spring Boot adds some additional attributes to `InvocationContext` that you can access
from your command:
[cols="2,3"]
|===
| Attribute Name | Description
|`spring.boot.version`
|The version of Spring Boot
|`spring.version`
|The version of the core Spring Framework
|`spring.beanfactory`
|Access to the Spring `BeanFactory`
|`spring.environment`
|Access to the Spring `Environment`
|===
[[production-ready-remote-shell-plugins]]
==== Remote shell plugins
In addition to new commands, it is also possible to extend other CRaSH shell features.
All Spring Beans that extend `org.crsh.plugin.CRaSHPlugin` will be automatically
registered with the shell.
For more information please refer to the http://www.crashub.org/[CRaSH reference
documentation].
[[production-ready-metrics]]
== Metrics
Spring Boot Actuator includes a metrics service with '`gauge`' and '`counter`' support.

View File

@@ -29,7 +29,7 @@ boolean isTechnicalStarter(def starter) {
}
boolean isProductionStarter(def starter) {
starter.name in ['spring-boot-starter-actuator', 'spring-boot-starter-remote-shell']
starter.name in ['spring-boot-starter-actuator']
}
boolean isStarter(def dependencies) {