@VisibleForTesting void save() throws IOException, InterruptedException { try (OutputStream os = store.write()) { props.store(os, "Credential store"); } // try to protect this file from other users, if we can. store.chmod(0600); }
public DefaultConfidentialStore(File rootDir) throws IOException, InterruptedException { this.rootDir = rootDir; if (rootDir.mkdirs()) { // protect this directory. but don't change the permission of the existing directory // in case the administrator changed this. new FilePath(rootDir).chmod(0700); } TextFile masterSecret = new TextFile(new File(rootDir,"master.key")); if (!masterSecret.exists()) { // we are only going to use small number of bits (since export control limits AES key length) // but let's generate a long enough key anyway masterSecret.write(Util.toHexString(randomBytes(128))); } this.masterKey = Util.toAes128Key(masterSecret.readTrim()); }
int mode = e.getUnixMode(); if (mode!=0) // Ant returns 0 if the archive doesn't record the access mode target.chmod(mode); } catch (InterruptedException ex) { LOGGER.log(Level.WARNING, "unable to set permissions", ex);
/** * Copies this file to the specified target, with file permissions and other meta attributes intact. * @since 1.311 */ public void copyToWithPermission(FilePath target) throws IOException, InterruptedException { // Use NIO copy with StandardCopyOption.COPY_ATTRIBUTES when copying on the same machine. if (this.channel == target.channel) { act(new CopyToWithPermission(target)); return; } copyTo(target); // copy file permission target.chmod(mode()); target.setLastModifiedIfPossible(lastModified()); } private class CopyToWithPermission extends SecureFileCallable<Void> {
iapf.chmod(0640); iapf.write(randomUUID + System.lineSeparator(), "UTF-8");
@VisibleForTesting void save() throws IOException, InterruptedException { try (OutputStream os = store.write()) { props.store(os, "Credential store"); } // try to protect this file from other users, if we can. store.chmod(0600); } }
private File copyResourceIntoExecutableFile(String resourceName) throws IOException, InterruptedException { File f = new File(tmpDir,resourceName); FileUtils.copyURLToFile(getClass().getResource(resourceName), f); new FilePath(f).chmod(0755); return f; } }
public void chmod(String file, int mode) throws IOException, InterruptedException { $(file).chmod(mode); }
public void chmod(String file, int mode) throws IOException, InterruptedException { $(file).chmod(mode); }
@Override public void chmod(String file, int mode) throws IOException, InterruptedException { $(file).chmod(mode); }
/** * Copies this file to the specified target, with file permissions intact. * @since 1.311 */ public void copyToWithPermission(FilePath target) throws IOException, InterruptedException { copyTo(target); // copy file permission target.chmod(mode()); }
/** * Copies this file to the specified target, with file permissions intact. * @since 1.311 */ public void copyToWithPermission(FilePath target) throws IOException, InterruptedException { copyTo(target); // copy file permission target.chmod(mode()); }
/** * Copies this file to the specified target, with file permissions intact. * @since 1.311 */ public void copyToWithPermission(FilePath target) throws IOException, InterruptedException { copyTo(target); // copy file permission target.chmod(mode()); }
/** * Copies this file to the specified target, with file permissions intact. * * @since 1.311 */ public void copyToWithPermission(FilePath target) throws IOException, InterruptedException { copyTo(target); // copy file permission target.chmod(mode()); }
/** * Creates a read-protected directory inside {@link KeyMaterialContext#getBaseDir} suitable for storing secret files. * Be sure to {@link FilePath#deleteRecursive} this in {@link KeyMaterial#close}. */ protected final FilePath createSecretsDirectory() throws IOException, InterruptedException { FilePath dir = new FilePath(getContext().getBaseDir(), UUID.randomUUID().toString()); dir.mkdirs(); dir.chmod(0700); return dir; }
@Override protected FilePath write(DockerServerCredentials credentials, FilePath dir) throws IOException, InterruptedException { FilePath clientKey = dir.child("key.pem"); clientKey.write(credentials.getClientKey(), null); clientKey.chmod(0600); FilePath clientCert = dir.child("cert.pem"); clientCert.write(credentials.getClientCertificate(), null); clientCert.chmod(0600); FilePath serverCACert = dir.child("ca.pem"); serverCACert.write(credentials.getServerCaCertificate(), null); serverCACert.chmod(0600); return dir; }
private FilePath getRemoteKeyPath(AbstractBuild<?, ?> build, Runner runner) throws IOException, InterruptedException { String keysDir = "debian-package-builder-keys"; String relativeKeyPath = new File(keysDir, getRepo(build, runner).getKeypath()).getPath(); File absoluteKeyPath = new File (Jenkins.getInstance().getRootDir(), relativeKeyPath); FilePath localKey = new FilePath(absoluteKeyPath); FilePath remoteKey = build.getWorkspace().createTextTempFile("private", "key", localKey.readToString()); remoteKey.chmod(0600); return remoteKey; }
/** * Copies this file to the specified target, with file permissions and other meta attributes intact. * @since 1.311 */ public void copyToWithPermission(FilePath target) throws IOException, InterruptedException { copyTo(target); // copy file permission target.chmod(mode()); target.setLastModifiedIfPossible(lastModified()); }
public DefaultConfidentialStore(File rootDir) throws IOException, InterruptedException { this.rootDir = rootDir; if (rootDir.mkdirs()) { // protect this directory. but don't change the permission of the existing directory // in case the administrator changed this. new FilePath(rootDir).chmod(0700); } TextFile masterSecret = new TextFile(new File(rootDir,"master.key")); if (!masterSecret.exists()) { // we are only going to use small number of bits (since export control limits AES key length) // but let's generate a long enough key anyway masterSecret.write(Util.toHexString(randomBytes(128))); } this.masterKey = Util.toAes128Key(masterSecret.readTrim()); }
/** * Recursively flags anything that looks like an Android tools executable, as executable. * * @param toolsDir The top level Android SDK tools directory. */ private static final void setPermissions(FilePath toolsDir) throws IOException, InterruptedException { for (FilePath dir : toolsDir.listDirectories()) { setPermissions(dir); } for (FilePath f : toolsDir.list(new ToolFileFilter())) { f.chmod(0755); } }