This repository has been archived by the owner on Jul 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLetsEncrypt.java
69 lines (48 loc) · 1.7 KB
/
LetsEncrypt.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package profile;
import java.util.Vector;
import core.iface.IUnit;
import core.model.NetworkModel;
import core.model.ServerModel;
import core.profile.AStructuredProfile;
import core.unit.fs.FileUnit;
import core.unit.pkg.InstalledUnit;
public class LetsEncrypt extends AStructuredProfile {
public LetsEncrypt(ServerModel me, NetworkModel networkModel) {
super("letsencrypt", me, networkModel);
}
protected Vector<IUnit> getInstalled() {
Vector<IUnit> units = new Vector<IUnit>();
units.addElement(new InstalledUnit("certbot", "proceed", "certbot"));
return units;
}
protected Vector<IUnit> getPersistentConfig() {
Vector<IUnit> units = new Vector<IUnit>();
String config = "";
config += "rsa-key-size = 4096\n";
config += "email = " + networkModel.getData().getAdminEmail();
units.addElement(new FileUnit("certbot_default_config", "certbot_installed", config, "/etc/letsencrypt/cli.ini"));
return units;
}
protected Vector<IUnit> getLiveConfig() {
Vector<IUnit> units = new Vector<IUnit>();
//First, are we a web proxy?
return units;
}
// private Vector<IUnit> getCert(String name, String machineName, String path, String[] domains) {
// Vector<IUnit> units = new Vector<IUnit>();
//String invocation = "certbot"
// + " certonly" //Just issue cert
// + " --agree-tos" //ToS are for suckers
// + " -n" //force non-interactive
// + " -d " + String.join(",", domains) //Domains"
// + " --cert-name " + machineName
// + " --cert-path /media/data/tls/"
// ;
// return units;
// }
public Vector<IUnit> getNetworking() {
Vector<IUnit> units = new Vector<IUnit>();
me.addRequiredEgress("acme-v01.api.letsencrypt.org");
return units;
}
}