Begining of Sponge port for Minecraft-SSHD

The main class and MkpasswordCommand are (hopefully) working, the config
is getting there.
This commit is contained in:
Zachery 2019-10-11 20:21:28 -05:00
parent 7c6ae57513
commit 67aa5c63ea
No known key found for this signature in database
GPG Key ID: 0C6201265CE80EEE
8 changed files with 886 additions and 571 deletions

89
Sponge-SSHD.iml Normal file
View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPONGE</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.apache.sshd:sshd-core:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.sshd:sshd-mina:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.sshd:sshd-common:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.sshd:sshd-sftp:2.3.0" level="project" />
<orderEntry type="library" name="Maven: net.i2p.crypto:eddsa:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.mina:mina-core:2.1.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.28" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-jdk14:1.7.28" level="project" />
<orderEntry type="library" name="Maven: jline:jline:2.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spongepowered:spongeapi:7.1.0" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.errorprone:error_prone_annotations:2.0.15" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.inject:guice:4.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.ben-manes.caffeine:caffeine:2.5.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.ben-manes.caffeine:guava:2.5.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spongepowered:plugin-meta:0.4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spongepowered:configurate-hocon:3.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spongepowered:configurate-core:3.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.checkerframework:checker-qual:2.4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.typesafe:config:1.3.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spongepowered:configurate-gson:3.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spongepowered:configurate-yaml:3.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.18" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.flowpowered:flow-math:1.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.flowpowered:flow-noise:1.0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm:5.2" level="project" />
<orderEntry type="library" name="Maven: pl.project13.maven:git-commit-id-plugin:maven-plugin:3.0.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-api:3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-model:3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-artifact:3.0" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-inject-plexus:1.4.2" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-inject-bean:1.4.2" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-guice:noaop:2.1.7" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-core:3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-settings:3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-settings-builder:3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-repository-metadata:3.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-model-builder:3.0" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.maven:maven-aether-provider:3.0" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-impl:1.7" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-spi:1.7" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-api:1.7" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-util:1.7" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-interpolation:1.14" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-utils:2.0.4" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-classworlds:2.2.3" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-component-annotations:1.5.5" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-sec-dispatcher:1.3" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-cipher:1.4" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-build-api:0.0.7" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.9.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.9" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.10.3" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jgit:org.eclipse.jgit:5.2.2.201904231744-r" level="project" />
<orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.54" level="project" />
<orderEntry type="library" name="Maven: com.jcraft:jzlib:1.1.1" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.javaewah:JavaEWAH:1.1.6" level="project" />
</component>
</module>

320
pom.xml
View File

@ -1,175 +1,189 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ryanmichela</groupId> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<artifactId>sshd</artifactId> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<description>Minecraft-SSHD: The SSH daemon for Minecraft servers.</description> <modelVersion>4.0.0</modelVersion>
<version>1.3.7</version>
<url>https://github.com/Justasic/Minecraft-SSHD/</url>
<properties> <groupId>com.ryanmichela</groupId>
<java.version>1.8</java.version> <artifactId>Sponge-SSHD</artifactId>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <version>1.3.7</version>
</properties> <packaging>jar</packaging>
<name>Sponge-SSHD</name>
<description>Sponge port for Minecraft-SSHD. SSH for your minecraft server!</description>
<url>https://github.com/Justasic/Minecraft-SSHD/</url>
<!-- Repositories --> <properties>
<repositories> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<repository> <maven.compiler.source>1.8</maven.compiler.source>
<id>spigot-repo</id> <maven.compiler.target>1.8</maven.compiler.target>
<url>https://hub.spigotmc.org/nexus/content/groups/public</url> </properties>
</repository>
</repositories>
<!-- License --> <repositories>
<licenses> <repository>
<license> <id>sponge</id>
<name>GPL2</name> <url>https://repo.spongepowered.org/maven</url>
<url>http://www.gnu.org/licenses/gpl-2.0.html</url> </repository>
</license> </repositories>
</licenses>
<!-- Dependencies --> <dependencies>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.14.4-R0.1-SNAPSHOT</version>
</dependency>
<dependency> <!--Just include a *few* things.-->
<groupId>org.apache.sshd</groupId> <dependency>
<artifactId>sshd-core</artifactId> <groupId>org.apache.sshd</groupId>
<version>2.3.0</version> <artifactId>sshd-core</artifactId>
<scope>compile</scope> <version>2.3.0</version>
<type>jar</type> <scope>compile</scope>
</dependency> <type>jar</type>
</dependency>
<dependency> <dependency>
<groupId>org.apache.sshd</groupId> <groupId>org.apache.sshd</groupId>
<artifactId>sshd-mina</artifactId> <artifactId>sshd-mina</artifactId>
<version>2.3.0</version> <version>2.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.sshd</groupId> <groupId>org.apache.sshd</groupId>
<artifactId>sshd-common</artifactId> <artifactId>sshd-common</artifactId>
<version>2.3.0</version> <version>2.3.0</version>
<scope>compile</scope> <scope>compile</scope>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.sshd</groupId> <groupId>org.apache.sshd</groupId>
<artifactId>sshd-sftp</artifactId> <artifactId>sshd-sftp</artifactId>
<version>2.3.0</version> <version>2.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.i2p.crypto</groupId> <groupId>net.i2p.crypto</groupId>
<artifactId>eddsa</artifactId> <artifactId>eddsa</artifactId>
<version>0.3.0</version> <version>0.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.mina</groupId> <groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId> <artifactId>mina-core</artifactId>
<version>2.1.3</version> <version>2.1.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.7.28</version> <version>1.7.28</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId> <artifactId>slf4j-jdk14</artifactId>
<version>1.7.28</version> <version>1.7.28</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jline</groupId> <groupId>jline</groupId>
<artifactId>jline</artifactId> <artifactId>jline</artifactId>
<version>2.12.1</version> <version>2.12.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId> <artifactId>log4j-core</artifactId>
<version>2.0</version> <version>2.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId> <artifactId>log4j-api</artifactId>
<version>2.1</version> <version>2.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.10</version> <version>1.10</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> <!-- include Sponge API -->
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>spongeapi</artifactId>
<version>7.1.0</version>
<scope>provided</scope>
</dependency>
<!-- Used for getting the git hash -->
<dependency>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>3.0.1</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
<!-- Build --> <build>
<build> <!-- Set our default goal to be clean and build a package -->
<defaultGoal>clean package</defaultGoal> <defaultGoal>clean package</defaultGoal>
<!-- Include our git hash in the final name -->
<finalName>${project.name}-${project.version}-${git.commit.id.abbrev}</finalName>
<resources> <!-- Plugins -->
<resource> <plugins>
<targetPath>.</targetPath> <!-- Run the get git info stuff so we have revisions and whatnot -->
<filtering>true</filtering> <plugin>
<directory>${basedir}/src/main/resources</directory> <groupId>pl.project13.maven</groupId>
<includes> <artifactId>git-commit-id-plugin</artifactId>
<include>plugin.yml</include> <version>2.2.5</version>
<include>config.yml</include>
<include>motd.txt</include>
</includes>
</resource>
</resources>
<plugins> <configuration>
<plugin> <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<artifactId>maven-assembly-plugin</artifactId> </configuration>
<version>3.1.1</version> </plugin>
<executions> <!-- Shade plugin (resolves Jar dependencies) -->
<execution> <plugin>
<phase>package</phase> <groupId>org.apache.maven.plugins</groupId>
<goals> <artifactId>maven-shade-plugin</artifactId>
<goal>single</goal> <version>3.2.1</version>
</goals> <executions>
</execution> <execution>
</executions> <phase>package</phase>
<configuration> <goals>
<finalName>${project.name}-${project.version}</finalName> <goal>shade</goal>
<appendAssemblyId>false</appendAssemblyId> </goals>
<descriptorRefs> <configuration>
<descriptorRef>jar-with-dependencies</descriptorRef> <minimizeJar>true</minimizeJar>
</descriptorRefs> <!-- Remove jar signing from other jars -->
</configuration> <filters>
</plugin> <filter>
<artifact>*:*:*:*</artifact>
<!-- Compile plugin --> <excludes>
<plugin> <exclude>META-INF/*.RSA</exclude>
<groupId>org.apache.maven.plugins</groupId> <exclude>META-INF/*.SF</exclude>
<artifactId>maven-compiler-plugin</artifactId> <exclude>META-INF/*.DSA</exclude>
<version>3.7.0</version> </excludes>
<configuration> </filter>
<source>1.8</source> </filters>
<target>1.8</target> <createDependencyReducedPom>true</createDependencyReducedPom>
<showDeprecation>true</showDeprecation> <dependencyReducedPomLocation>${java.io.tmpdir}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
</configuration> </configuration>
</plugin> </execution>
</plugins> </executions>
</build> </plugin>
<!-- Maven templates for our PomData file -->
<packaging>jar</packaging> <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
<executions>
<execution>
<id>filter-src</id>
<goals>
<goal>filter-sources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -1,14 +1,23 @@
package com.ryanmichela.sshd; package com.ryanmichela.sshd;
/*
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
*/
import java.util.Arrays; import java.util.Arrays;
import com.ryanmichela.sshd.Cryptography; import com.ryanmichela.sshd.Cryptography;
import com.ryanmichela.sshd.SshdPlugin; import com.ryanmichela.sshd.SshdPlugin;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.command.spec.CommandExecutor;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.command.TabCompleteEvent;
import org.spongepowered.api.text.Text;
class MkpasswdCommand implements CommandExecutor class MkpasswdCommand implements CommandExecutor
{ {
@ -19,16 +28,16 @@ class MkpasswdCommand implements CommandExecutor
// or hash leakages from the user to other connected users. Plus this syntax will show how // or hash leakages from the user to other connected users. Plus this syntax will show how
// to both use the command and what hashes we support which is important for people who don't // to both use the command and what hashes we support which is important for people who don't
// know how to RTFM. - Justin // know how to RTFM. - Justin
private void SendSyntax(CommandSender sender, boolean invalid) private void SendSyntax(CommandSource sender, boolean invalid)
{ {
if (invalid) if (invalid)
sender.sendMessage("\u00A7cInvalid Syntax\u00A7r"); // So, to send a message in sponge, you must use "Text.of()" for some reason.
sender.sendMessage("\u00A7a/mkpasswd <help|hash> <password>\u00A7r"); sender.sendMessage(Text.of("\u00A7cInvalid Syntax\u00A7r"));
sender.sendMessage("\u00A79Supported Hashes: SHA256, PBKDF2, BCRYPT, PLAIN\u00A7r"); sender.sendMessage(Text.of("\u00A7a/mkpasswd <help|hash> <password>\u00A7r"));
sender.sendMessage(Text.of("\u00A79Supported Hashes: SHA256, PBKDF2, BCRYPT, PLAIN\u00A7r"));
} }
@Override public boolean onCommand(CommandSource sender, TabCompleteEvent.Command command, String label, String[] args)
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
// If we're not mkpasswd, just fuck off. // If we're not mkpasswd, just fuck off.
if (!label.equalsIgnoreCase("mkpasswd")) if (!label.equalsIgnoreCase("mkpasswd"))
@ -51,7 +60,7 @@ class MkpasswdCommand implements CommandExecutor
return true; return true;
} }
boolean hasperm = (sender instanceof Player) ? ((Player)sender).hasPermission("sshd.mkpasswd") : true; boolean hasperm = (!(sender instanceof Player)) || ((Player) sender).hasPermission("sshd.mkpasswd");
if (hasperm) if (hasperm)
{ {
@ -62,7 +71,7 @@ class MkpasswdCommand implements CommandExecutor
if (algoritm.equalsIgnoreCase("PLAIN")) if (algoritm.equalsIgnoreCase("PLAIN"))
{ {
// I mean c'mon... // I mean c'mon...
sender.sendMessage("Bro really? it's literally your unencrypted password..."); sender.sendMessage(Text.of("Bro really? it's literally your unencrypted password..."));
return true; return true;
} }
else if (algoritm.equalsIgnoreCase("pbkdf2")) else if (algoritm.equalsIgnoreCase("pbkdf2"))
@ -77,16 +86,23 @@ class MkpasswdCommand implements CommandExecutor
return true; return true;
} }
sender.sendMessage("\u00A79Your Hash: " + hash + "\u00A7r"); sender.sendMessage(Text.of("\u00A79Your Hash: " + hash + "\u00A7r"));
} }
catch (Exception e) catch (Exception e)
{ {
// We're console, just print the stack trace. // We're console, just print the stack trace.
e.printStackTrace(); e.printStackTrace();
sender.sendMessage("\u00A7cAn error occured. Please check console for details.\u00A7r"); sender.sendMessage(Text.of("\u00A7cAn error occured. Please check console for details.\u00A7r"));
} }
} }
return true; return true;
} }
// so sponge needed this, still figuring out the sponge API ~ Zach
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException
{
return null;
}
} }

View File

@ -1,6 +1,5 @@
package com.ryanmichela.sshd; package com.ryanmichela.sshd;
import org.apache.commons.lang.ArrayUtils;
import org.apache.sshd.common.config.keys.AuthorizedKeyEntry; import org.apache.sshd.common.config.keys.AuthorizedKeyEntry;
import org.apache.sshd.common.config.keys.PublicKeyEntryResolver; import org.apache.sshd.common.config.keys.PublicKeyEntryResolver;
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator; import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
@ -27,7 +26,7 @@ public class PublicKeyAuthenticator implements PublickeyAuthenticator
{ {
byte[] keyBytes = key.getEncoded(); byte[] keyBytes = key.getEncoded();
File keyFile = new File(authorizedKeysDir, username); File keyFile = new File(authorizedKeysDir, username);
Integer tries = SshdPlugin.instance.getConfig().getInt("LoginRetries"); Integer tries = SshdPlugin.instance.LoginRetries;
if (keyFile.exists()) if (keyFile.exists())
{ {
@ -68,12 +67,12 @@ public class PublicKeyAuthenticator implements PublickeyAuthenticator
} }
catch (Exception e) catch (Exception e)
{ {
SshdPlugin.instance.getLogger().severe("Failed to process public key " + keyFile.getAbsolutePath() + " " + e.getMessage()); SshdPlugin.instance.getLogger().error("Failed to process public key " + keyFile.getAbsolutePath() + " " + e.getMessage());
} }
} }
else else
{ {
SshdPlugin.instance.getLogger().warning("Could not locate public key for " + username SshdPlugin.instance.getLogger().error("Could not locate public key for " + username
+ ". Make sure the user's key is named the same as their user name " + ". Make sure the user's key is named the same as their user name "
+ "without a file extension."); + "without a file extension.");
} }

View File

@ -1,10 +1,16 @@
package com.ryanmichela.sshd; package com.ryanmichela.sshd;
import com.ryanmichela.sshd.utils.Config;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.spec.CommandSpec;
import org.spongepowered.api.plugin.Plugin;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory; import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory;
import org.apache.sshd.server.SshServer; import org.apache.sshd.server.SshServer;
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
import org.bukkit.plugin.java.JavaPlugin;
import com.ryanmichela.sshd.ConsoleShellFactory; import com.ryanmichela.sshd.ConsoleShellFactory;
import com.ryanmichela.sshd.MkpasswdCommand; import com.ryanmichela.sshd.MkpasswdCommand;
@ -17,53 +23,62 @@ import java.nio.file.Files;
import java.util.Collections; import java.util.Collections;
import java.util.logging.Level; import java.util.logging.Level;
/** import com.google.inject.Inject;
* Copyright 2013 Ryan Michela import org.slf4j.Logger;
*/ import org.spongepowered.api.text.Text;
public
class SshdPlugin extends JavaPlugin @Plugin(id = "spongesshd", name = "Sponge-SSHD", version = "1.3.7", description = "Sponge port for Minecraft-SSHD. SSH for your minecraft server!")
public class SshdPlugin
{ {
String ListenAddress = "";
Integer Port = 1025;
String Mode = "";
Boolean EnableSFTP = true;
Integer LoginRetries = 3;
String PasswordType = "";
// Credentials
private SshServer sshd; private File modConfigFolder;
public static SshdPlugin instance; CommandSpec MkpasswdCommand = CommandSpec.builder()
.description(Text.of("Make a SSHD password hash"))
.permission("sshd.mkpasswd")
.build();
@Override public void onLoad() public File getDataFolder()
{
return modConfigFolder;
}
private SshServer sshd;
public static SshdPlugin instance;
@Inject
public Logger logger;
public Config config;
@Listener
public void onServerStart(GameStartedServerEvent event)
{ {
saveDefaultConfig(); instance = this;
File authorizedKeys = new File(getDataFolder(), "authorized_keys"); // Parse our config
if (!authorizedKeys.exists()) config = new Config();
authorizedKeys.mkdirs(); config.setup();
try // Now include it in our dealio here
{ this.Mode = config.configNode.getNode("Mode").getString();
File motd = new File(getDataFolder(), "motd.txt"); this.PasswordType = config.configNode.getNode("PasswordType").getString();
if (!motd.exists()) this.ListenAddress = config.configNode.getNode("ListenAddress").getString();
{ this.Port = config.configNode.getNode("Port").getInt();
InputStream link = (getClass().getResourceAsStream("/motd.txt")); this.LoginRetries = config.configNode.getNode("LoginRetries").getInt();
Files.copy(link, motd.getAbsoluteFile().toPath()); this.EnableSFTP = config.configNode.getNode("EnableSFTP").getBoolean();
}
}
catch (IOException e)
{
e.printStackTrace();
}
// Don't go any lower than INFO or SSHD will cause a stack overflow exception.
// SSHD will log that it wrote bites to the output stream, which writes
// bytes to the output stream - ad nauseaum.
getLogger().setLevel(Level.INFO);
}
@Override public void onEnable()
{
instance = this;
sshd = SshServer.setUpDefaultServer(); sshd = SshServer.setUpDefaultServer();
sshd.setPort(getConfig().getInt("Port", 1025)); sshd.setPort(this.Port);
String host = getConfig().getString("ListenAddress", "all"); String host = this.ListenAddress;
sshd.setHost(host.equals("all") ? null : host); sshd.setHost(host.equals("all") ? null : host);
File hostKey = new File(getDataFolder(), "hostkey"); File hostKey = new File(getDataFolder(), "hostkey");
File authorizedKeys = new File(getDataFolder(), "authorized_keys"); File authorizedKeys = new File(getDataFolder(), "authorized_keys");
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(hostKey.toPath())); sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(hostKey.toPath()));
@ -71,14 +86,17 @@ class SshdPlugin extends JavaPlugin
sshd.setPasswordAuthenticator(new ConfigPasswordAuthenticator()); sshd.setPasswordAuthenticator(new ConfigPasswordAuthenticator());
sshd.setPublickeyAuthenticator(new PublicKeyAuthenticator(authorizedKeys)); sshd.setPublickeyAuthenticator(new PublicKeyAuthenticator(authorizedKeys));
if (getConfig().getBoolean("EnableSFTP"))
if (this.EnableSFTP)
{ {
sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory())); sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
sshd.setFileSystemFactory( sshd.setFileSystemFactory(
new VirtualFileSystemFactory(FileSystems.getDefault().getPath(getDataFolder().getAbsolutePath()).getParent().getParent())); new VirtualFileSystemFactory(FileSystems.getDefault().getPath(getDataFolder().getAbsolutePath()).getParent().getParent()));
} }
this.getCommand("mkpasswd").setExecutor(new MkpasswdCommand()); Sponge.getCommandManager().register(instance, MkpasswdCommand, "mkpasswd");
//this.getCommand("mkpasswd").setExecutor(new MkpasswdCommand());
sshd.setCommandFactory(new ConsoleCommandFactory()); sshd.setCommandFactory(new ConsoleCommandFactory());
try try
@ -87,19 +105,14 @@ class SshdPlugin extends JavaPlugin
} }
catch (IOException e) catch (IOException e)
{ {
getLogger().log(Level.SEVERE, "Failed to start SSH server! ", e); getLogger().error("Failed to start SSH server! ", e);
} }
logger.info("Successfully running ExamplePlugin!!!");
} }
@Override public void onDisable() public Logger getLogger()
{ {
try return logger;
{
sshd.stop();
}
catch (Exception e)
{
// do nothing
}
} }
} }

View File

@ -1,29 +1,17 @@
package com.ryanmichela.sshd.implementations; package com.ryanmichela.sshd.implementations;
import com.ryanmichela.sshd.SshdPlugin; import com.ryanmichela.sshd.SshdPlugin;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ManuallyAbandonedConversationCanceller;
import org.bukkit.permissions.PermissibleBase;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import com.ryanmichela.sshd.ConsoleShellFactory; import com.ryanmichela.sshd.ConsoleShellFactory;
import com.ryanmichela.sshd.ConsoleLogFormatter; import com.ryanmichela.sshd.ConsoleLogFormatter;
import org.spongepowered.api.command.CommandSource;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
public class SSHDCommandSender implements ConsoleCommandSender, CommandSender // This is gonna be a mess.
public class SSHDCommandSender implements ConsoleCommandSender, CommandSource
{ {
private final PermissibleBase perm = new PermissibleBase(this); private final PermissibleBase perm = new PermissibleBase(this);
private final SSHDConversationTracker conversationTracker = new SSHDConversationTracker(); private final SSHDConversationTracker conversationTracker = new SSHDConversationTracker();

View File

@ -0,0 +1,124 @@
package com.ryanmichela.sshd.utils;
import ninja.leaping.configurate.loader.ConfigurationLoader;
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
import org.spongepowered.api.config.DefaultConfig;
import com.google.inject.Inject;
import com.ryanmichela.sshd.SshdPlugin;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.io.IOException;
public class Config
{
// Give us a config!
@Inject
@DefaultConfig(sharedRoot = true)
// idk what to do with this one.
private ConfigurationLoader<CommentedConfigurationNode> configLoader = HoconConfigurationLoader.builder().setPath(SshdPlugin.instance.defaultConfig).build();
public CommentedConfigurationNode configNode;
public void setup()
{
// I'm not sure if this will even work, the sponge config API is confusing.
if (!Files.exists((Path) SshdPlugin.instance.config.configLoader.getDefaultOptions()))
{
try
{
Files.createFile((Path) SshdPlugin.instance.config.configLoader.getDefaultOptions());
this.load();
this.populate();
this.save();
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
else
this.load();
}
public void load()
{
try
{
configNode = this.configLoader.load();
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
public void save()
{
try
{
this.configLoader.save(this.configNode);
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
public void populate()
{
this.configNode.getNode("ListenAddress").setValue("all").setComment
("The IP addresses(s) the SSH server will listen on. Use a comma separated list for multiple addresses.\n" +
"Leave as \"all\" for all addresses.");
this.configNode.getNode("Port").setValue("1025").setComment(
"# The port the SSH server will listen on. Note that anything above 1024 will require you to run\n" +
"# the whole minecraft server with elevated privileges, this is not recommended and you should\n" +
"# use iptables to route packets from a lower port.");
this.configNode.getNode("Mode").setValue("DEFAULT").setComment("Operational mode. Don't touch if you don't know what you're doing. Can be either DEFAULT or RPC");
this.configNode.getNode("EnableSFTP").setValue("true").setComment(
"# Enable built-in SFTP server or not. You'll be able to connect and upload/download files via SFTP protocol.\n" +
"# Might be useful for testing purposes as well , i. e. docker containers.");
this.configNode.getNode("LoginRetries").setValue("3").setComment(
"# Number of times a person can fail to use an SSH key or enter a password\n" +
"# before it terminates the connection.");
this.configNode.getNode("PasswordType").setValue("bcrypt").setComment
("########################################################################################\n" +
"# By default, only public key authentication is enabled. This is the most secure mode.\n" +
"# To authorize a user to login with their public key, install their key using the\n" +
"# OpenSSH authorized_keys file format in the authorized_users directory. Name the key\n" +
"# file with the user's username and no extension. Note: If you want to let a user have\n" +
"# many keys, you can append the keys to their file in authorized_users.\n" +
"########################################################################################\n" +
"For less secure username and password based authentication, complete the sections below.\n" +
"\n" +
"# Type of hashing to use for the passwords below.\n" +
"# Options are: PLAIN (insecure), bcrypt, pbkdf2, sha256\n" +
"#\n" +
"# You can use the console/in-game command `/mkpasswd [hash] PASSWORD` to\n" +
"# generate a password hash string then copy it for your passwords below.\n" +
"# You can also use `/mkpasswd help` to see what algorithms are supported.");
//this.configNode.getNode("").setValue("").setComment("");
/*
this.Mode = config.configNode.getNode("Mode").getString();
this.PasswordType = config.configNode.getNode("PasswordType").getString();
this.ListenAddress = config.configNode.getNode("ListenAddress").getString();
this.Port = config.configNode.getNode("Port").getInt();
this.LoginRetries = config.configNode.getNode("LoginRetries").getInt();
this.EnableSFTP = config.configNode.getNode("EnableSFTP").getBoolean();
this.configNode.getNode("mysql").setComment("MySQL database for Whitelisting");
this.configNode.getNode("mysql", "port").setValue(3306).setComment("MySQL server port");
this.configNode.getNode("mysql", "host").setValue("localhost").setComment("MySQL server to connect to");
this.configNode.getNode("mysql", "database").setValue("WhitelistSync").setComment("MySQL database for Whitelisting");
this.configNode.getNode("mysql", "username").setValue("Whitelist").setComment("MySQL username for the database");
this.configNode.getNode("mysql", "password").setValue("letmein").setComment("MySQL password for the database");
*/
}
}

View File

@ -12,339 +12,411 @@ import java.util.logging.Level;
/** /**
* Copyright 2013 Ryan Michela * Copyright 2013 Ryan Michela
*/ */
public class PluginSlf4jFactory implements ILoggerFactory { // figure out logging...
@Override public class PluginSlf4jFactory implements ILoggerFactory
public Logger getLogger(String name) { {
return new PluginSlf4jAdapter(name); @Override
} public Logger getLogger(String name)
{
public class PluginSlf4jAdapter implements Logger { return new PluginSlf4jAdapter(name);
private String name; }
private boolean isEnabled(Level level) { public class PluginSlf4jAdapter implements Logger
return SshdPlugin.instance != null && SshdPlugin.instance.getLogger().isLoggable(level); {
} private String name;
private void log(Level level, String s, Object[] objects) { private boolean isEnabled(Level level)
if (SshdPlugin.instance != null && isEnabled(level)) { {
FormattingTuple ft = MessageFormatter.arrayFormat(s, objects); // ???
SshdPlugin.instance.getLogger().log(level, ft.getMessage(), ft.getThrowable()); return SshdPlugin.instance != null && SshdPlugin.instance.logger.isLoggable(level);
} }
}
private void log(Level level, String s, Object[] objects)
private void log(Level level, String s, Throwable throwable) { {
if (SshdPlugin.instance != null && isEnabled(level)) { if (SshdPlugin.instance != null && isEnabled(level))
SshdPlugin.instance.getLogger().log(level, s, throwable); {
} FormattingTuple ft = MessageFormatter.arrayFormat(s, objects);
} SshdPlugin.instance.getLogger().log(level, ft.getMessage(), ft.getThrowable());
}
public PluginSlf4jAdapter(String name) { }
this.name = name;
} private void log(Level level, String s, Throwable throwable)
{
@Override if (SshdPlugin.instance != null && isEnabled(level))
public String getName() { {
return name; SshdPlugin.instance.logger.log(level, s, throwable);
} }
}
@Override
public boolean isTraceEnabled() { public PluginSlf4jAdapter(String name)
return isEnabled(Level.FINEST); {
} this.name = name;
}
@Override
public void trace(String s) { @Override
trace(s, new Object[]{}); public String getName()
} {
return name;
@Override }
public void trace(String s, Object o) {
trace(s, new Object[]{o}); @Override
} public boolean isTraceEnabled()
{
@Override return isEnabled(Level.FINEST);
public void trace(String s, Object o, Object o1) { }
trace(s, new Object[]{o, o1});
} @Override
public void trace(String s)
@Override {
public void trace(String s, Object[] objects) { trace(s, new Object[]{});
log(Level.FINEST, s, objects); }
}
@Override
@Override public void trace(String s, Object o)
public void trace(String s, Throwable throwable) { {
log(Level.FINEST, s, throwable); trace(s, new Object[]{o});
} }
@Override @Override
public boolean isTraceEnabled(Marker marker) { public void trace(String s, Object o, Object o1)
return isTraceEnabled(); {
} trace(s, new Object[]{o, o1});
}
@Override
public void trace(Marker marker, String s) { @Override
trace(s); public void trace(String s, Object[] objects)
} {
log(Level.FINEST, s, objects);
@Override }
public void trace(Marker marker, String s, Object o) {
trace(s, o); @Override
} public void trace(String s, Throwable throwable)
{
@Override log(Level.FINEST, s, throwable);
public void trace(Marker marker, String s, Object o, Object o1) { }
trace(s, o, o1);
} @Override
public boolean isTraceEnabled(Marker marker)
@Override {
public void trace(Marker marker, String s, Object[] objects) { return isTraceEnabled();
trace(s, objects); }
}
@Override
@Override public void trace(Marker marker, String s)
public void trace(Marker marker, String s, Throwable throwable) { {
trace(s, throwable); trace(s);
} }
@Override @Override
public boolean isDebugEnabled() { public void trace(Marker marker, String s, Object o)
return isEnabled(Level.FINE); {
} trace(s, o);
}
@Override
public void debug(String s) { @Override
debug(s, new Object[]{}); public void trace(Marker marker, String s, Object o, Object o1)
} {
trace(s, o, o1);
@Override }
public void debug(String s, Object o) {
debug(s, new Object[]{o}); @Override
} public void trace(Marker marker, String s, Object[] objects)
{
@Override trace(s, objects);
public void debug(String s, Object o, Object o1) { }
debug(s, new Object[]{o, o1});
} @Override
public void trace(Marker marker, String s, Throwable throwable)
@Override {
public void debug(String s, Object[] objects) { trace(s, throwable);
log(Level.FINE, s, objects); }
}
@Override
@Override public boolean isDebugEnabled()
public void debug(String s, Throwable throwable) { {
log(Level.FINE, s, throwable); return isEnabled(Level.FINE);
} }
@Override @Override
public boolean isDebugEnabled(Marker marker) { public void debug(String s)
return isDebugEnabled(); {
} debug(s, new Object[]{});
}
@Override
public void debug(Marker marker, String s) { @Override
debug(s); public void debug(String s, Object o)
} {
debug(s, new Object[]{o});
@Override }
public void debug(Marker marker, String s, Object o) {
debug(s, o); @Override
} public void debug(String s, Object o, Object o1)
{
@Override debug(s, new Object[]{o, o1});
public void debug(Marker marker, String s, Object o, Object o1) { }
debug(s, o, o1);
} @Override
public void debug(String s, Object[] objects)
@Override {
public void debug(Marker marker, String s, Object[] objects) { log(Level.FINE, s, objects);
debug(s, objects); }
}
@Override
@Override public void debug(String s, Throwable throwable)
public void debug(Marker marker, String s, Throwable throwable) { {
debug(s, throwable); log(Level.FINE, s, throwable);
} }
@Override @Override
public boolean isInfoEnabled() { public boolean isDebugEnabled(Marker marker)
return isEnabled(Level.INFO); {
} return isDebugEnabled();
}
@Override
public void info(String s) { @Override
info(s, new Object[]{}); public void debug(Marker marker, String s)
} {
debug(s);
@Override }
public void info(String s, Object o) {
info(s, new Object[]{o}); @Override
} public void debug(Marker marker, String s, Object o)
{
@Override debug(s, o);
public void info(String s, Object o, Object o1) { }
info(s, new Object[]{o, o1});
} @Override
public void debug(Marker marker, String s, Object o, Object o1)
@Override {
public void info(String s, Object[] objects) { debug(s, o, o1);
log(Level.INFO, s, objects); }
}
@Override
@Override public void debug(Marker marker, String s, Object[] objects)
public void info(String s, Throwable throwable) { {
log(Level.INFO, s, throwable); debug(s, objects);
} }
@Override @Override
public boolean isInfoEnabled(Marker marker) { public void debug(Marker marker, String s, Throwable throwable)
return isInfoEnabled(); {
} debug(s, throwable);
}
@Override
public void info(Marker marker, String s) { @Override
info(s); public boolean isInfoEnabled()
} {
return isEnabled(Level.INFO);
@Override }
public void info(Marker marker, String s, Object o) {
info(s, o); @Override
} public void info(String s)
{
@Override info(s, new Object[]{});
public void info(Marker marker, String s, Object o, Object o1) { }
info(s, o, o1);
} @Override
public void info(String s, Object o)
@Override {
public void info(Marker marker, String s, Object[] objects) { info(s, new Object[]{o});
info(s, objects); }
}
@Override
@Override public void info(String s, Object o, Object o1)
public void info(Marker marker, String s, Throwable throwable) { {
info(s, throwable); info(s, new Object[]{o, o1});
} }
@Override @Override
public boolean isWarnEnabled() { public void info(String s, Object[] objects)
return isEnabled(Level.WARNING); {
} log(Level.INFO, s, objects);
}
@Override
public void warn(String s) { @Override
warn(s, new Object[]{}); public void info(String s, Throwable throwable)
} {
log(Level.INFO, s, throwable);
@Override }
public void warn(String s, Object o) {
warn(s, new Object[]{o}); @Override
} public boolean isInfoEnabled(Marker marker)
{
@Override return isInfoEnabled();
public void warn(String s, Object o, Object o1) { }
warn(s, new Object[]{o, o1});
} @Override
public void info(Marker marker, String s)
@Override {
public void warn(String s, Object[] objects) { info(s);
log(Level.WARNING, s, objects); }
}
@Override
@Override public void info(Marker marker, String s, Object o)
public void warn(String s, Throwable throwable) { {
log(Level.WARNING, s, throwable); info(s, o);
} }
@Override @Override
public boolean isWarnEnabled(Marker marker) { public void info(Marker marker, String s, Object o, Object o1)
return isWarnEnabled(); {
} info(s, o, o1);
}
@Override
public void warn(Marker marker, String s) { @Override
warn(s); public void info(Marker marker, String s, Object[] objects)
} {
info(s, objects);
@Override }
public void warn(Marker marker, String s, Object o) {
warn(s, o); @Override
} public void info(Marker marker, String s, Throwable throwable)
{
@Override info(s, throwable);
public void warn(Marker marker, String s, Object o, Object o1) { }
warn(s, o, o1);
} @Override
public boolean isWarnEnabled()
@Override {
public void warn(Marker marker, String s, Object[] objects) { return isEnabled(Level.WARNING);
warn(s, objects); }
}
@Override
@Override public void warn(String s)
public void warn(Marker marker, String s, Throwable throwable) { {
warn(s, throwable); warn(s, new Object[]{});
} }
@Override @Override
public boolean isErrorEnabled() { public void warn(String s, Object o)
return isEnabled(Level.SEVERE); {
} warn(s, new Object[]{o});
}
@Override
public void error(String s) { @Override
error(s, new Object[]{}); public void warn(String s, Object o, Object o1)
} {
warn(s, new Object[]{o, o1});
@Override }
public void error(String s, Object o) {
error(s, new Object[]{o}); @Override
} public void warn(String s, Object[] objects)
{
@Override log(Level.WARNING, s, objects);
public void error(String s, Object o, Object o1) { }
error(s, new Object[]{o, o1});
} @Override
public void warn(String s, Throwable throwable)
@Override {
public void error(String s, Object[] objects) { log(Level.WARNING, s, throwable);
log(Level.SEVERE, s, objects); }
}
@Override
@Override public boolean isWarnEnabled(Marker marker)
public void error(String s, Throwable throwable) { {
log(Level.SEVERE, s, throwable); return isWarnEnabled();
} }
@Override @Override
public boolean isErrorEnabled(Marker marker) { public void warn(Marker marker, String s)
return isErrorEnabled(); {
} warn(s);
}
@Override
public void error(Marker marker, String s) { @Override
error(s); public void warn(Marker marker, String s, Object o)
} {
warn(s, o);
@Override }
public void error(Marker marker, String s, Object o) {
error(s, o); @Override
} public void warn(Marker marker, String s, Object o, Object o1)
{
@Override warn(s, o, o1);
public void error(Marker marker, String s, Object o, Object o1) { }
error(s, o, o1);
} @Override
public void warn(Marker marker, String s, Object[] objects)
@Override {
public void error(Marker marker, String s, Object[] objects) { warn(s, objects);
error(s, objects); }
}
@Override
@Override public void warn(Marker marker, String s, Throwable throwable)
public void error(Marker marker, String s, Throwable throwable) { {
error(s, throwable); warn(s, throwable);
} }
}
@Override
public boolean isErrorEnabled()
{
return isEnabled(Level.SEVERE);
}
@Override
public void error(String s)
{
error(s, new Object[]{});
}
@Override
public void error(String s, Object o)
{
error(s, new Object[]{o});
}
@Override
public void error(String s, Object o, Object o1)
{
error(s, new Object[]{o, o1});
}
@Override
public void error(String s, Object[] objects)
{
log(Level.SEVERE, s, objects);
}
@Override
public void error(String s, Throwable throwable)
{
log(Level.SEVERE, s, throwable);
}
@Override
public boolean isErrorEnabled(Marker marker)
{
return isErrorEnabled();
}
@Override
public void error(Marker marker, String s)
{
error(s);
}
@Override
public void error(Marker marker, String s, Object o)
{
error(s, o);
}
@Override
public void error(Marker marker, String s, Object o, Object o1)
{
error(s, o, o1);
}
@Override
public void error(Marker marker, String s, Object[] objects)
{
error(s, objects);
}
@Override
public void error(Marker marker, String s, Throwable throwable)
{
error(s, throwable);
}
}
} }