|
|
@ -19,7 +19,7 @@ const RuleScope = {
|
|
|
|
const DetailSection = new Lang.Class({
|
|
|
|
const DetailSection = new Lang.Class({
|
|
|
|
Name: 'DetailSection',
|
|
|
|
Name: 'DetailSection',
|
|
|
|
|
|
|
|
|
|
|
|
_init: function() {
|
|
|
|
_init: function(sandboxed) {
|
|
|
|
this.actor = new St.BoxLayout({ style_class: 'fw-details-section' });
|
|
|
|
this.actor = new St.BoxLayout({ style_class: 'fw-details-section' });
|
|
|
|
this._left = new St.BoxLayout({ vertical: true, style_class: 'fw-details-left'});
|
|
|
|
this._left = new St.BoxLayout({ vertical: true, style_class: 'fw-details-left'});
|
|
|
|
this._right = new St.BoxLayout({ vertical: true });
|
|
|
|
this._right = new St.BoxLayout({ vertical: true });
|
|
|
@ -32,6 +32,11 @@ const DetailSection = new Lang.Class({
|
|
|
|
this.origin = this._addDetails("Origin:");
|
|
|
|
this.origin = this._addDetails("Origin:");
|
|
|
|
this.user = this._addDetails("User:");
|
|
|
|
this.user = this._addDetails("User:");
|
|
|
|
this.group = this._addDetails("Group:");
|
|
|
|
this.group = this._addDetails("Group:");
|
|
|
|
|
|
|
|
this.sandboxed = sandboxed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sandboxed) {
|
|
|
|
|
|
|
|
this.sandbox = this._addDetails("Sandbox:");
|
|
|
|
|
|
|
|
}
|
|
|
|
this.optstring = this._addDetails("");
|
|
|
|
this.optstring = this._addDetails("");
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
@ -43,7 +48,7 @@ const DetailSection = new Lang.Class({
|
|
|
|
return msg;
|
|
|
|
return msg;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
setDetails: function(ip, path, pid, uid, gid, user, group, origin, proto, optstring) {
|
|
|
|
setDetails: function(ip, path, pid, uid, gid, user, group, origin, proto, optstring, sandbox) {
|
|
|
|
this.ipAddr.text = ip;
|
|
|
|
this.ipAddr.text = ip;
|
|
|
|
this.path.text = path;
|
|
|
|
this.path.text = path;
|
|
|
|
|
|
|
|
|
|
|
@ -73,6 +78,10 @@ const DetailSection = new Lang.Class({
|
|
|
|
this.group.text = "gid:" + gid.toString();
|
|
|
|
this.group.text = "gid:" + gid.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sandbox != "") {
|
|
|
|
|
|
|
|
this.sandbox.text = sandbox;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.optstring.text = optstring
|
|
|
|
this.optstring.text = optstring
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -130,7 +139,7 @@ Signals.addSignalMethods(OptionListItem.prototype);
|
|
|
|
const OptionList = new Lang.Class({
|
|
|
|
const OptionList = new Lang.Class({
|
|
|
|
Name: 'OptionList',
|
|
|
|
Name: 'OptionList',
|
|
|
|
|
|
|
|
|
|
|
|
_init: function(pid_known) {
|
|
|
|
_init: function(pid_known, sandboxed) {
|
|
|
|
this.actor = new St.BoxLayout({vertical: true, style_class: 'fw-option-list'});
|
|
|
|
this.actor = new St.BoxLayout({vertical: true, style_class: 'fw-option-list'});
|
|
|
|
if (pid_known) {
|
|
|
|
if (pid_known) {
|
|
|
|
this.buttonGroup = new ButtonGroup("Forever", "Session", "Once", "PID");
|
|
|
|
this.buttonGroup = new ButtonGroup("Forever", "Session", "Once", "PID");
|
|
|
@ -140,6 +149,7 @@ const OptionList = new Lang.Class({
|
|
|
|
this.actor.add_child(this.buttonGroup.actor);
|
|
|
|
this.actor.add_child(this.buttonGroup.actor);
|
|
|
|
this.items = [];
|
|
|
|
this.items = [];
|
|
|
|
this._selected;
|
|
|
|
this._selected;
|
|
|
|
|
|
|
|
this.tlsGuard = true;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
setOptionText: function(idx, text) {
|
|
|
|
setOptionText: function(idx, text) {
|
|
|
@ -150,6 +160,29 @@ const OptionList = new Lang.Class({
|
|
|
|
this.items[idx].setText(text);
|
|
|
|
this.items[idx].setText(text);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addTLSOption: function(tlsGuardEnabled) {
|
|
|
|
|
|
|
|
let tlsg = new OptionListItem("Drop connection if not TLS with valid certificate",0);
|
|
|
|
|
|
|
|
tlsg.setSelected(tlsGuardEnabled);
|
|
|
|
|
|
|
|
tlsg.connect('selected', Lang.bind(this, function() {
|
|
|
|
|
|
|
|
this._toggleTLSGuard(tlsg);
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
let emptyRow = new OptionListItem("",0);
|
|
|
|
|
|
|
|
this.actor.add_child(emptyRow.actor);
|
|
|
|
|
|
|
|
this.actor.add_child(tlsg.actor);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_toggleTLSGuard: function(item) {
|
|
|
|
|
|
|
|
if (this.tlsGuard == true) {
|
|
|
|
|
|
|
|
item.actor.remove_style_pseudo_class('selected');
|
|
|
|
|
|
|
|
item.setSelected(false);
|
|
|
|
|
|
|
|
this.tlsGuard = false;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.tlsGuard = true;
|
|
|
|
|
|
|
|
item.actor.add_style_pseudo_class('selected');
|
|
|
|
|
|
|
|
item.setSelected(true)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
addOptions: function(options) {
|
|
|
|
addOptions: function(options) {
|
|
|
|
for(let i = 0; i < options.length; i++) {
|
|
|
|
for(let i = 0; i < options.length; i++) {
|
|
|
|
this._addOption(options[i], i)
|
|
|
|
this._addOption(options[i], i)
|
|
|
@ -422,7 +455,7 @@ const PromptDialog = new Lang.Class({
|
|
|
|
Name: 'PromptDialog',
|
|
|
|
Name: 'PromptDialog',
|
|
|
|
Extends: ModalDialog.ModalDialog,
|
|
|
|
Extends: ModalDialog.ModalDialog,
|
|
|
|
|
|
|
|
|
|
|
|
_init: function(invocation, pid_known) {
|
|
|
|
_init: function(invocation, pid_known, sandboxed) {
|
|
|
|
this.parent({ styleClass: 'fw-prompt-dialog' });
|
|
|
|
this.parent({ styleClass: 'fw-prompt-dialog' });
|
|
|
|
this._invocation = invocation;
|
|
|
|
this._invocation = invocation;
|
|
|
|
this.header = new PromptDialogHeader();
|
|
|
|
this.header = new PromptDialogHeader();
|
|
|
@ -432,10 +465,10 @@ const PromptDialog = new Lang.Class({
|
|
|
|
this.contentLayout.add(this.details.actor, {y_fill: false, x_fill: true});
|
|
|
|
this.contentLayout.add(this.details.actor, {y_fill: false, x_fill: true});
|
|
|
|
let box = new St.BoxLayout({ vertical: true });
|
|
|
|
let box = new St.BoxLayout({ vertical: true });
|
|
|
|
this.details.set_child(box);
|
|
|
|
this.details.set_child(box);
|
|
|
|
this.info = new DetailSection();
|
|
|
|
this.info = new DetailSection(sandboxed);
|
|
|
|
box.add_child(this.info.actor);
|
|
|
|
box.add_child(this.info.actor);
|
|
|
|
|
|
|
|
|
|
|
|
this.optionList = new OptionList(pid_known);
|
|
|
|
this.optionList = new OptionList(pid_known, sandboxed);
|
|
|
|
box.add_child(this.optionList.actor);
|
|
|
|
box.add_child(this.optionList.actor);
|
|
|
|
this.optionList.addOptions([
|
|
|
|
this.optionList.addOptions([
|
|
|
|
"Only PORT AND ADDRESS",
|
|
|
|
"Only PORT AND ADDRESS",
|
|
|
@ -443,6 +476,13 @@ const PromptDialog = new Lang.Class({
|
|
|
|
"Only PORT",
|
|
|
|
"Only PORT",
|
|
|
|
"Any Connection"]);
|
|
|
|
"Any Connection"]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sandboxed) {
|
|
|
|
|
|
|
|
this.optionList.addTLSOption(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// let tlsGuard = new OptionListItem("Drop connection if not TLS with valid certificate.",0);
|
|
|
|
|
|
|
|
//box.add_child(optionList.actor);
|
|
|
|
|
|
|
|
|
|
|
|
this._initialKeyFocusDestroyId = 1;
|
|
|
|
this._initialKeyFocusDestroyId = 1;
|
|
|
|
this.setButtons([
|
|
|
|
this.setButtons([
|
|
|
|
{ label: "Allow", action: Lang.bind(this, this.onAllow) },
|
|
|
|
{ label: "Allow", action: Lang.bind(this, this.onAllow) },
|
|
|
@ -467,9 +507,15 @@ const PromptDialog = new Lang.Class({
|
|
|
|
let verb = "DENY";
|
|
|
|
let verb = "DENY";
|
|
|
|
if(allow) {
|
|
|
|
if(allow) {
|
|
|
|
verb = "ALLOW";
|
|
|
|
verb = "ALLOW";
|
|
|
|
|
|
|
|
if (this.optionList.tlsGuard) {
|
|
|
|
|
|
|
|
verb = "ALLOW_TLSONLY";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
verb = "ALLOW";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let rule = verb + "|" + this.ruleTarget();
|
|
|
|
let rule = verb + "|" + this.ruleTarget() + "|" + this.ruleSandbox();
|
|
|
|
let scope = this.optionList.selectedScope()
|
|
|
|
|
|
|
|
|
|
|
|
let scope = this.optionList.selectedScope();
|
|
|
|
this._invocation.return_value(GLib.Variant.new('(is)', [scope, rule]));
|
|
|
|
this._invocation.return_value(GLib.Variant.new('(is)', [scope, rule]));
|
|
|
|
this._invocation = null;
|
|
|
|
this._invocation = null;
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -491,10 +537,20 @@ const PromptDialog = new Lang.Class({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
update: function(application, icon, path, address, port, ip, origin, uid, gid, user, group, pid, proto, optstring, expanded, expert, action) {
|
|
|
|
ruleSandbox: function() {
|
|
|
|
|
|
|
|
return this._sandbox;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ruleTLSGuard: function() {
|
|
|
|
|
|
|
|
return this.optionList.tlsGuard;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update: function(application, icon, path, address, port, ip, origin, uid, gid, user, group, pid, proto, optstring, sandbox, expanded, expert, action) {
|
|
|
|
this._address = address;
|
|
|
|
this._address = address;
|
|
|
|
this._port = port;
|
|
|
|
this._port = port;
|
|
|
|
this._proto = proto;
|
|
|
|
this._proto = proto;
|
|
|
|
|
|
|
|
this._sandbox = sandbox;
|
|
|
|
|
|
|
|
this._tlsGuard;
|
|
|
|
|
|
|
|
|
|
|
|
let port_str = (proto+"").toUpperCase() + " Port "+ port;
|
|
|
|
let port_str = (proto+"").toUpperCase() + " Port "+ port;
|
|
|
|
|
|
|
|
|
|
|
@ -502,6 +558,10 @@ const PromptDialog = new Lang.Class({
|
|
|
|
port_str = (proto+"").toUpperCase() + " Code "+ port;
|
|
|
|
port_str = (proto+"").toUpperCase() + " Code "+ port;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sandbox != "") {
|
|
|
|
|
|
|
|
application = application + " (sandboxed)"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.header.setTitle(application);
|
|
|
|
this.header.setTitle(application);
|
|
|
|
|
|
|
|
|
|
|
|
if (proto == "tcp") {
|
|
|
|
if (proto == "tcp") {
|
|
|
@ -548,6 +608,6 @@ const PromptDialog = new Lang.Class({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.optionList.buttonGroup._setChecked(this.optionList.scopeToIdx(action))
|
|
|
|
this.optionList.buttonGroup._setChecked(this.optionList.scopeToIdx(action))
|
|
|
|
this.info.setDetails(ip, path, pid, uid, gid, user, group, origin, proto, optstring);
|
|
|
|
this.info.setDetails(ip, path, pid, uid, gid, user, group, origin, proto, optstring, sandbox);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|