Allow disabling GPG key editing while leaving signed push enabled
Administrators may choose to populate GPG keys by hand, or to temporarily restrict adding new keys, without disabling signed push verification or verification of push certs stored in PatchSets. Separate the UI and REST API for editing GPG keys from the protocol machinery for verifying signed push. Change-Id: I2c921cf92a3452d44ee8cb02efd77ab7f2bd02dd
This commit is contained in:
@@ -1720,6 +1720,16 @@ If unset or empty, the documentation tab will only be shown if
|
|||||||
`/Documentation/index.html` can be reached by the browser at app load
|
`/Documentation/index.html` can be reached by the browser at app load
|
||||||
time.
|
time.
|
||||||
|
|
||||||
|
[[gerrit.editGpgKeys]]gerrit.editGpgKeys::
|
||||||
|
+
|
||||||
|
If enabled and server-side signed push validation is also
|
||||||
|
link:#receive.enableSignedPush[enabled], enable the
|
||||||
|
link:rest-api-accounts.html#list-gpg-keys[REST API endpoints] and web UI
|
||||||
|
for editing GPG keys. If disabled, GPG keys can only be added by
|
||||||
|
administrators with direct git access to All-Users.
|
||||||
|
+
|
||||||
|
Defaults to true.
|
||||||
|
|
||||||
[[gerrit.installCommitMsgHookCommand]]gerrit.installCommitMsgHookCommand::
|
[[gerrit.installCommitMsgHookCommand]]gerrit.installCommitMsgHookCommand::
|
||||||
+
|
+
|
||||||
Optional command to install the `commit-msg` hook. Typically of the
|
Optional command to install the `commit-msg` hook. Typically of the
|
||||||
|
@@ -1193,6 +1193,8 @@ meta data of all users is stored].
|
|||||||
Custom base URL where Gerrit server documentation is located.
|
Custom base URL where Gerrit server documentation is located.
|
||||||
(Documentation may still be available at /Documentation relative to the
|
(Documentation may still be available at /Documentation relative to the
|
||||||
Gerrit base path even if this value is unset.)
|
Gerrit base path even if this value is unset.)
|
||||||
|
|`edit_gpg_keys` |not set if `false`|
|
||||||
|
Whether to enable the web UI for editing GPG keys.
|
||||||
|`report_bug_url` |optional|
|
|`report_bug_url` |optional|
|
||||||
link:config-gerrit.html#gerrit.reportBugUrl[URL to report bugs].
|
link:config-gerrit.html#gerrit.reportBugUrl[URL to report bugs].
|
||||||
|`report_bug_text` |optional, not set if default|
|
|`report_bug_text` |optional, not set if default|
|
||||||
|
@@ -35,6 +35,8 @@ public class GpgModule extends FactoryModule {
|
|||||||
protected void configure() {
|
protected void configure() {
|
||||||
boolean configEnableSignedPush =
|
boolean configEnableSignedPush =
|
||||||
cfg.getBoolean("receive", null, "enableSignedPush", false);
|
cfg.getBoolean("receive", null, "enableSignedPush", false);
|
||||||
|
boolean configEditGpgKeys =
|
||||||
|
cfg.getBoolean("gerrit", null, "editGpgKeys", true);
|
||||||
boolean havePgp = BouncyCastleUtil.havePGP();
|
boolean havePgp = BouncyCastleUtil.havePGP();
|
||||||
boolean enableSignedPush = configEnableSignedPush && havePgp;
|
boolean enableSignedPush = configEnableSignedPush && havePgp;
|
||||||
bindConstant().annotatedWith(EnableSignedPush.class).to(enableSignedPush);
|
bindConstant().annotatedWith(EnableSignedPush.class).to(enableSignedPush);
|
||||||
@@ -47,6 +49,6 @@ public class GpgModule extends FactoryModule {
|
|||||||
install(new SignedPushModule());
|
install(new SignedPushModule());
|
||||||
factory(GerritPushCertificateChecker.Factory.class);
|
factory(GerritPushCertificateChecker.Factory.class);
|
||||||
}
|
}
|
||||||
install(new GpgApiModule(enableSignedPush));
|
install(new GpgApiModule(enableSignedPush && configEditGpgKeys));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -37,6 +37,7 @@ public class GerritInfo extends JavaScriptObject {
|
|||||||
public final native String allProjects() /*-{ return this.all_projects; }-*/;
|
public final native String allProjects() /*-{ return this.all_projects; }-*/;
|
||||||
public final native String allUsers() /*-{ return this.all_users; }-*/;
|
public final native String allUsers() /*-{ return this.all_users; }-*/;
|
||||||
public final native String docUrl() /*-{ return this.doc_url; }-*/;
|
public final native String docUrl() /*-{ return this.doc_url; }-*/;
|
||||||
|
public final native boolean editGpgKeys() /*-{ return this.edit_gpg_keys || false; }-*/;
|
||||||
public final native String reportBugUrl() /*-{ return this.report_bug_url; }-*/;
|
public final native String reportBugUrl() /*-{ return this.report_bug_url; }-*/;
|
||||||
public final native String reportBugText() /*-{ return this.report_bug_text; }-*/;
|
public final native String reportBugText() /*-{ return this.report_bug_text; }-*/;
|
||||||
|
|
||||||
|
@@ -539,7 +539,8 @@ public class Dispatcher {
|
|||||||
return new MySshKeysScreen();
|
return new MySshKeysScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchExact(SETTINGS_GPGKEYS, token)) {
|
if (matchExact(SETTINGS_GPGKEYS, token)
|
||||||
|
&& Gerrit.info().gerrit().editGpgKeys()) {
|
||||||
return new MyGpgKeysScreen();
|
return new MyGpgKeysScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ public abstract class SettingsScreen extends MenuScreen {
|
|||||||
if (Gerrit.info().auth().isHttpPasswordSettingsEnabled()) {
|
if (Gerrit.info().auth().isHttpPasswordSettingsEnabled()) {
|
||||||
linkByGerrit(Util.C.tabHttpAccess(), PageLinks.SETTINGS_HTTP_PASSWORD);
|
linkByGerrit(Util.C.tabHttpAccess(), PageLinks.SETTINGS_HTTP_PASSWORD);
|
||||||
}
|
}
|
||||||
if (Gerrit.info().receive().enableSignedPush()) {
|
if (Gerrit.info().gerrit().editGpgKeys()) {
|
||||||
linkByGerrit(Util.C.tabGpgKeys(), PageLinks.SETTINGS_GPGKEYS);
|
linkByGerrit(Util.C.tabGpgKeys(), PageLinks.SETTINGS_GPGKEYS);
|
||||||
}
|
}
|
||||||
linkByGerrit(Util.C.tabWebIdentities(), PageLinks.SETTINGS_WEBIDENT);
|
linkByGerrit(Util.C.tabWebIdentities(), PageLinks.SETTINGS_WEBIDENT);
|
||||||
|
@@ -238,6 +238,8 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
|
|||||||
info.reportBugUrl = cfg.getString("gerrit", null, "reportBugUrl");
|
info.reportBugUrl = cfg.getString("gerrit", null, "reportBugUrl");
|
||||||
info.reportBugText = cfg.getString("gerrit", null, "reportBugText");
|
info.reportBugText = cfg.getString("gerrit", null, "reportBugText");
|
||||||
info.docUrl = getDocUrl(cfg);
|
info.docUrl = getDocUrl(cfg);
|
||||||
|
info.editGpgKeys = toBoolean(enableSignedPush
|
||||||
|
&& cfg.getBoolean("gerrit", null, "editGpgKeys", true));
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,6 +369,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
|
|||||||
public String docUrl;
|
public String docUrl;
|
||||||
public String reportBugUrl;
|
public String reportBugUrl;
|
||||||
public String reportBugText;
|
public String reportBugText;
|
||||||
|
public Boolean editGpgKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GitwebInfo {
|
public static class GitwebInfo {
|
||||||
|
Reference in New Issue
Block a user