daemon: Allow httpd without sshd

We now support turning off the SSHD, but leaving the HTTPD on.
This matches what happens when sshd.listenAddress = off in
gerrit.config, but is done much earlier in the daemon initialization.

Because the SSHD has no executor threads in this setup, we cannot
register the QoS filter that defers execution onto the SSHD workers.
We probably don't want to flat out disable QoS here, having a way to
slow down non-interactive or abusive accounts by moving them into
a smaller worker pool can be very useful, but I just don't have
the time to rework the QoS filter for the HTTP only case right now.

Change-Id: I181acef999b1bcb3c439e26b9eec45e06cd89804
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-06-09 14:22:58 -07:00
parent 6af6f5f784
commit 7af8f48af9
4 changed files with 99 additions and 9 deletions

View File

@@ -0,0 +1,29 @@
// Copyright (C) 2010 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.ssh;
import com.google.gerrit.server.ssh.SshInfo;
import com.jcraft.jsch.HostKey;
import java.util.Collections;
import java.util.List;
class NoSshInfo implements SshInfo {
@Override
public List<HostKey> getHostKeys() {
return Collections.emptyList();
}
}

View File

@@ -0,0 +1,30 @@
// Copyright (C) 2010 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.ssh;
import com.google.gerrit.common.errors.InvalidSshKeyException;
import com.google.gerrit.reviewdb.AccountSshKey;
class NoSshKeyCache implements SshKeyCache {
@Override
public void evict(String username) {
}
@Override
public AccountSshKey create(AccountSshKey.Id id, String encoded)
throws InvalidSshKeyException {
throw new InvalidSshKeyException();
}
}

View File

@@ -0,0 +1,28 @@
// Copyright (C) 2010 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.ssh;
import com.google.inject.AbstractModule;
/**
* Disables the SSH support by stubbing out relevant objects.
*/
public class NoSshModule extends AbstractModule {
@Override
protected void configure() {
bind(SshInfo.class).to(NoSshInfo.class);
bind(SshKeyCache.class).to(NoSshKeyCache.class);
}
}