mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
fix(ec2): stage user data outside guest temporary mounts (#3736)
* fix(ec2): stage user data outside guest temporary mounts * docs(ec2): correct user-data script staging path
This commit is contained in:
1 parent
ef12a83418
commit
03603aeacd
3 files changed
+29
-6
No files matched your search
@@ -77,7 +77,8 @@ import java.util.zip.GZIPInputStream;
|
||||
public class Ec2ContainerManager {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(Ec2ContainerManager.class);
|
||||
private static final String USER_DATA_SCRIPT_PATH = "/tmp/user-data.sh";
|
||||
// Guest-created /tmp mounts hide files copied through Docker's archive API.
|
||||
private static final String USER_DATA_SCRIPT_PATH = "/var/lib/user-data.sh";
|
||||
private static final Pattern MIME_BOUNDARY = Pattern.compile("(?im)^content-type:\\s*multipart/[^;]+;\\s*boundary=\"?([^\";\\n\\r]+)\"?.*$");
|
||||
private static final List<String> ALLOWED_SSHD_PATHS = List.of("/usr/sbin/sshd", "/usr/local/sbin/sshd", "/sbin/sshd");
|
||||
/** Exit code the sshd install probe uses for "sshd is present but scp is not". See startSshd. */
|
||||
@@ -1471,7 +1472,7 @@ public class Ec2ContainerManager {
|
||||
byte[] script = scriptContent.getBytes(StandardCharsets.UTF_8);
|
||||
byte[] tar = buildSingleFileTar("user-data.sh", script, 0755);
|
||||
dockerClient.copyArchiveToContainerCmd(containerId)
|
||||
.withRemotePath("/tmp")
|
||||
.withRemotePath("/var/lib")
|
||||
.withTarInputStream(new ByteArrayInputStream(tar))
|
||||
.exec();
|
||||
|
||||
|
||||
Reference in new issue
Block a user