public static SecurityWrapper GetClassLevel(boolean pooled) { Connection con = null; SecurityWrapper c = new SecurityWrapper(); if (pooled) { con = Utility.getConfigurationDBConnection(); } else { con = Utility.getConfigurationDB_NONPOOLED_Connection(); } PreparedStatement cmd =null; ResultSet rs = null; try { cmd = con.prepareStatement("select classification,caveat from globalpolicies;"); rs = cmd.executeQuery(); if (rs.next()) { c.setCaveats(rs.getString("caveat")); c.setClassification(ClassificationType.fromValue(rs.getString("classification"))); } } catch (Exception ex) { log.log(Level.WARN,null, ex); } finally { DBUtils.safeClose(rs); DBUtils.safeClose(cmd); DBUtils.safeClose(con); } return c; }
/** * adds an item to the audit log, this is a wrapper function * * @param classname * @param method * @param username * @param memo * @param classification, if null, not specified will be used, otherwise a * prettyprint version of the classificaiton level will be used * @param messageContext */ public static void logItem(String classname, String method, String username, String memo, SecurityWrapper classification, MessageContext messageContext) { if (classification == null || classification.getClassification() == null || classification.getCaveats() == null) { logItem(classname, method, username, memo, unspecified, messageContext); } else { logItem(classname, method, username, memo, Utility.ICMClassificationToString(classification.getClassification()) + " " + classification.getCaveats(), messageContext); } } public static final String unspecified = "UNSPECIFIED";
/** * Create an instance of {@link SecurityWrapper } * */ public SecurityWrapper createSecurityWrapper() { return new SecurityWrapper(); }
/** * throws an illegal argument exception if the object is null or not * specified, caveats is options * * @param w */ public static void validateClassification(SecurityWrapper w) { if (w == null || w.getClassification() == null) { throw new IllegalArgumentException("A classification level must be specified"); } }
protected SecurityWrapper getClassLevelFromDB() { Connection con = Utility.getConfigurationDBConnection(); PreparedStatement com = null; ResultSet rs = null; try { com = con.prepareStatement("select classification, caveat from globalpolicies;"); rs = com.executeQuery(); if (rs.next()) { ClassificationType t = ClassificationType.fromValue(rs.getString(1)); String cav = rs.getString(2); return new SecurityWrapper(t, cav); } else { log.log(Level.ERROR, "unable to determine current classification level, defaulting to UNCLASSIFIED"); return new SecurityWrapper(ClassificationType.U, "None"); } } catch (SQLException ex) { log.log(Level.ERROR, "error determining classification level from config db", ex); log.log(Level.ERROR, "unable to determine current classification level, defaulting to UNCLASSIFIED"); return new SecurityWrapper(ClassificationType.U, "None"); } finally { DBUtils.safeClose(rs); DBUtils.safeClose(com); DBUtils.safeClose(con); } }
throw new IllegalArgumentException("request is empty"); if (req.get(0) == null || req.get(0).getClassification() == null || req.get(0).getClassification().getClassification() == null) { throw new IllegalArgumentException("a classificaiton level must be specified for at least the first item");
ResultSet results = null; try { SecurityWrapper ret = new SecurityWrapper(); ret.setClassification(ClassificationType.fromValue(results.getString("classification"))); ret.setCaveats(results.getString("caveat")); results.close(); comm.close();
private SecurityWrapper getCurrentOperatingClassificationLevel() { try { SecurityWrapper t = getGlobalPolicyFromDB().getClassification(); log.log(Level.INFO, "PCS, current security classification is " + Utility.ICMClassificationToString(t.getClassification()) + " " + t.getCaveats()); return t; } catch (Exception ex) { log.log(Level.ERROR, "Unable to determine current classification level. Is the database available?", ex); } throw new IllegalAccessError(); }
SecurityWrapper wrap = new SecurityWrapper(ClassificationType.fromValue(results.getString("classification")), results.getString("caveat")); ret.setClassification(wrap); comm.execute(); ret.setRecordedMessageCap(1024000); ret.setClassification(new SecurityWrapper(ClassificationType.U, "None")); ret.setAgentsEnabled(true); } catch (SQLException ex) {
ResultSet results = null; PreparedStatement comm = null; SecurityWrapper ret = new SecurityWrapper(); try { ret.setClassification(ClassificationType.fromValue(results.getString("classification"))); ret.setCaveats(results.getString("caveat"));
request.setClassification(security); t = t.replaceAll("%CLASSIFICATION%", (Utility.ICMClassificationToString(request.getClassification().getClassification()) + " Caveat: " + request.getClassification().getCaveats()));
req.setClassification(new SecurityWrapper(ClassificationType.U, "none")); GetGlobalPolicyResponseMsg servicePolicy = cfg.pcsport.getGlobalPolicy(req); req.setClassification(new SecurityWrapper(ClassificationType.U, "none")); GetGlobalPolicyResponseMsg servicePolicy = cfg.pcsport.getGlobalPolicy(req);
ResultSet results = null; PreparedStatement comm = null; SecurityWrapper ret = new SecurityWrapper(); try { ret.setClassification(ClassificationType.fromValue(results.getString("classification"))); ret.setCaveats(results.getString("caveat"));
request.setClassification(security); t = t.replaceAll("%CLASSIFICATION%", (Utility.ICMClassificationToString(request.getClassification().getClassification()) + " Caveat: " + request.getClassification().getCaveats()));
response.getPolicy().setPolicyRefreshRate(df.newDuration(results.getLong("PolicyRefreshRate"))); response.getPolicy().setRecordedMessageCap(results.getInt("RecordedMessageCap")); SecurityWrapper wrap = new SecurityWrapper(ClassificationType.fromValue(results.getString("classification")), results.getString("caveat")); response.setClassification(wrap); comm.execute(); response.getPolicy().setRecordedMessageCap(1024000); response.getPolicy().setClassification(new SecurityWrapper(ClassificationType.U, "")); response.getPolicy().setAgentsEnabled(true); } catch (SQLException ex) {
request.setClassification(security); t = t.replaceAll("%CLASSIFICATION%", (Utility.ICMClassificationToString(request.getClassification().getClassification()) + " Caveat: " + request.getClassification().getCaveats()));
req.setClassification(new SecurityWrapper(ClassificationType.U, "")); req.setDomainName(domainname); req.setHostname(hostname);
request.setClassification(security); t = t.replaceAll("%CLASSIFICATION%", (Utility.ICMClassificationToString(request.getClassification().getClassification()) + " Caveat: " + request.getClassification().getCaveats()));
request.setClassification(security); t = t.replaceAll("%CLASSIFICATION%", (Utility.ICMClassificationToString(request.getClassification().getClassification()) + " Caveat: " + request.getClassification().getCaveats()));
request.setClassification(security); t = t.replaceAll("%CLASSIFICATION%", (Utility.ICMClassificationToString(request.getClassification().getClassification()) + " Caveat: " + request.getClassification().getCaveats()));