private void validate(Artifact a) throws CadiException { StringBuilder sb = new StringBuilder(); if(a.getDir()==null) { sb.append("File Artifacts require a path"); } if(a.getAppName()==null) { if(sb.length()>0) { sb.append('\n'); } sb.append("File Artifacts require an AAF Namespace"); } if(sb.length()>0) { throw new CadiException(sb.toString()); } }
private void validate(Artifact a) throws CadiException { StringBuilder sb = new StringBuilder(); if(a.getDir()==null) { sb.append("File Artifacts require a path"); } if(a.getAppName()==null) { if(sb.length()>0) { sb.append('\n'); } sb.append("File Artifacts require an AAF Namespace"); } if(sb.length()>0) { throw new CadiException(sb.toString()); } }
File f = new File(dir,arti.getAppName()+".props"); if(f.exists()) { if(first) { f = new File(dir,arti.getAppName()+".chal"); if(f.exists()) { f.delete();
File dir = new File(a.getDir()); Properties props = new Properties(); FileInputStream fis = new FileInputStream(new File(dir,a.getAppName()+".props")); try { props.load(fis); FileOutputStream fos = new FileOutputStream(a.getDir()+'/'+a.getAppName()+".msg"); try { fos.write(msg.getBytes());
File dir = new File(a.getDir()); Properties props = new Properties(); FileInputStream fis = new FileInputStream(new File(dir,a.getAppName()+".props")); try { props.load(fis); FileOutputStream fos = new FileOutputStream(a.getDir()+'/'+a.getAppName()+".msg"); try { fos.write(msg.getBytes());
File f = new File(dir,arti.getAppName()+".props"); if(f.exists()) { if(first) { f = new File(dir,arti.getAppName()+".chal"); if(f.exists()) { f.delete();
if(!allowed) { Future<String> pf = aafcon.client(CM_VER).read("/cert/may/" + a.getAppName() + ".certman|"+a.getCa()+"|showpass","*/*"); if(pf.get(TIMEOUT)) { allowed = true; File dir = new File(a.getDir()); Properties props = new Properties(); FileInputStream fis = new FileInputStream(new File(dir,a.getAppName()+".props")); try { props.load(fis); fis.close(); fis = new FileInputStream(new File(dir,a.getAppName()+".chal")); props.load(fis); } finally { File f = new File(dir,a.getAppName()+".keyfile"); if(f.exists()) { Symm symm = Symm.obtain(f);
if(!allowed) { Future<String> pf = aafcon.client(CM_VER).read("/cert/may/" + a.getAppName() + ".certman|"+a.getCa()+"|showpass","*/*"); if(pf.get(TIMEOUT)) { allowed = true; File dir = new File(a.getDir()); Properties props = new Properties(); FileInputStream fis = new FileInputStream(new File(dir,a.getAppName()+".props")); try { props.load(fis); fis.close(); fis = new FileInputStream(new File(dir,a.getAppName()+".chal")); props.load(fis); } finally { File f = new File(dir,a.getAppName()+".keyfile"); if(f.exists()) { Symm symm = Symm.obtain(f);
arti.setAppName(AAFSSO.cons.readLine("Namespace (%s): ",a.getAppName())); arti.setDir(AAFSSO.cons.readLine("Directory (%s): ", a.getDir())); arti.setOsUser(AAFSSO.cons.readLine("OS User (%s): ", a.getOsUser()));
arti.setAppName(AAFSSO.cons.readLine("Namespace (%s): ",a.getAppName())); arti.setDir(AAFSSO.cons.readLine("Directory (%s): ", a.getDir())); arti.setOsUser(AAFSSO.cons.readLine("OS User (%s): ", a.getOsUser()));
@Override public boolean _place(Trans trans, CertInfo certInfo, Artifact arti) throws CadiException { File fks = new File(dir,arti.getAppName()+'.'+kst); try { KeyStore jks = KeyStore.getInstance(kst); addProperty(Config.CADI_KEYFILE,arti.getDir()+'/'+arti.getAppName() + ".keyfile"); fks = new File(dir,arti.getAppName()+".trust."+kst); jks = KeyStore.getInstance(kst);
@Override public boolean _place(Trans trans, CertInfo certInfo, Artifact arti) throws CadiException { File fks = new File(dir,arti.getAppName()+'.'+kst); try { KeyStore jks = KeyStore.getInstance(kst); addProperty(Config.CADI_KEYFILE,arti.getDir()+'/'+arti.getAppName() + ".keyfile"); fks = new File(dir,arti.getAppName()+".trust."+kst); jks = KeyStore.getInstance(kst);
if(symm==null) { File f = new File(dir,arti.getAppName() + ".keyfile"); if(!f.exists()) { write(f,Chmod.to400,Symm.baseCrypt().keygen());
try { String filename = arti.getAppName()+".check.sh"; File f1 = new File(dir,filename); String email = arti.getNotification() + '\n'; "# Generated by Certificate Manager " + Chrono.timeStamp()+'\n', "DIR="+arti.getDir()+'\n', "APP="+arti.getAppName()+'\n', "EMAIL="+email, "CP=\""+classpath.toString()+"\"\n", File f2 = new File(dir,arti.getAppName()+".crontab.sh"); write(f2,Chmod.to644, "#!/bin/bash " + f1.getCanonicalPath()+'\n', "TFILE=\"/tmp/cmcron$$.temp\"\n", "DIR=\""+arti.getDir()+"\"\n", "CF=\""+arti.getAppName()+" Certificate Check Script\"\n", "SCRIPT=\""+f1.getCanonicalPath()+"\"\n", cronScript
if(symm==null) { File f = new File(dir,arti.getAppName() + ".keyfile"); if(!f.exists()) { write(f,Chmod.to400,Symm.baseCrypt().keygen());
try { String filename = arti.getAppName()+".check.sh"; File f1 = new File(dir,filename); String email = arti.getNotification() + '\n'; "# Generated by Certificate Manager " + Chrono.timeStamp()+'\n', "DIR="+arti.getDir()+'\n', "APP="+arti.getAppName()+'\n', "EMAIL="+email, "CP=\""+classpath.toString()+"\"\n", File f2 = new File(dir,arti.getAppName()+".crontab.sh"); write(f2,Chmod.to644, "#!/bin/bash " + f1.getCanonicalPath()+'\n', "TFILE=\"/tmp/cmcron$$.temp\"\n", "DIR=\""+arti.getDir()+"\"\n", "CF=\""+arti.getAppName()+" Certificate Check Script\"\n", "SCRIPT=\""+f1.getCanonicalPath()+"\"\n", cronScript
AAFSSO.cons.printf("Namespace: %s\n",a.getAppName()); AAFSSO.cons.printf("Directory: %s\n",a.getDir()); AAFSSO.cons.printf("O/S User: %s\n",a.getOsUser());
AAFSSO.cons.printf("Namespace: %s\n",a.getAppName()); AAFSSO.cons.printf("Directory: %s\n",a.getDir()); AAFSSO.cons.printf("O/S User: %s\n",a.getOsUser());
@Override public boolean _place(Trans trans, CertInfo certInfo, Artifact arti) throws CadiException { try { // Setup Public Cert File f = new File(dir,arti.getAppName()+".crt"); write(f,Chmod.to644,certInfo.getCerts().get(0),C_R); // Setup Private Key f = new File(dir,arti.getAppName()+".key"); write(f,Chmod.to400,certInfo.getPrivatekey(),C_R); } catch (Exception e) { throw new CadiException(e); } return true; } }
@Override public boolean _place(Trans trans, CertInfo certInfo, Artifact arti) throws CadiException { try { // Setup Public Cert File f = new File(dir,arti.getAppName()+".crt"); write(f,Chmod.to644,certInfo.getCerts().get(0),C_R); // Setup Private Key f = new File(dir,arti.getAppName()+".key"); write(f,Chmod.to400,certInfo.getPrivatekey(),C_R); } catch (Exception e) { throw new CadiException(e); } return true; } }