The remote Ubuntu host has an active Ubuntu Pro subscription.
#%NASL_MIN_LEVEL 80900
include("compat.inc");
if (description)
{
script_id(198218);
script_version("1.1");
script_set_attribute(attribute:"plugin_modification_date", value:"2024/05/31");
script_name(english:"Ubuntu Pro Subscription Detection");
script_set_attribute(attribute:"synopsis", value:
"The remote Ubuntu host has an active Ubuntu Pro subscription.");
script_set_attribute(attribute:"description", value:
"The remote Ubuntu host has an active Ubuntu Pro subscription.");
script_set_attribute(attribute:"solution", value:"n/a");
script_set_attribute(attribute:"risk_factor",value:"None");
script_set_attribute(attribute:"plugin_publication_date", value:"2024/05/31");
script_set_attribute(attribute:"see_also", value:"https://documentation.ubuntu.com/pro/");
script_set_attribute(attribute:"plugin_type",value:"local");
script_end_attributes();
script_category(ACT_GATHER_INFO);
script_family(english:"Ubuntu Local Security Checks");
script_copyright(english:"Ubuntu Security Notice (C) 2024 Canonical, Inc. / NASL script (C) 2024 and is owned by Tenable, Inc. or an Affiliate thereof.");
script_dependencies("ssh_get_info.nasl");
script_require_keys("Host/Ubuntu/UA-status");
exit(0);
}
include('json.inc');
include('install_func.inc');
var exit_msg = 'This machine is NOT attached to an Ubuntu Pro subscription.';
var json_status = get_kb_item_or_exit('Host/Ubuntu/UA-status', msg:exit_msg);
var read_json = json_read(json_status);
var pro_version = read_json[0].version;
var pro_services = read_json[0].services;
var pro_type = read_json[0].contract.name;
var pro_path = read_json[0].config.data_dir;
var report = 'This machine is attached to an Ubuntu Pro subscription.\n\n';
if (!empty_or_null(pro_type))
report += 'Subscription Contract Type : ' + pro_type + '\n';
if (!empty_or_null(pro_path))
report += 'Binary Path : ' + pro_path + '\n';
if (!empty_or_null(pro_version))
report += 'Binary Version : ' + pro_version + '\n';
var service;
if (!empty_or_null(pro_services))
{
report += '\nEnabled Ubuntu Pro Services :\n';
foreach service (pro_services)
{
if (service.entitled == 'yes' && service.status == 'enabled')
{
report += ' - ' + service.name + '\n';
replace_kb_item(name:'Host/Ubuntu/Pro/Services/' + service.name, value:1);
}
}
}
security_report_v4(
port : 0,
severity : SECURITY_NOTE,
extra : report
);