You are on page 1of 9

2017/9/18 Atlassian -

Atlassian
Shauway (/u/77c090dd9fd8)
2017.03.16 19:25 271 1131 1 3 1
(/u/77c090dd9fd8)

Atlassian

Confluence 6.0.6

Jira Software 7.3.3

Bitbucket 4.14.2

Bamboo 5.15.3

Crucible & FishEye 4.3.1

License

Confluence

Description=Confluence (Data Center)


ServerID=BSVW-4XDC-RWIW-M083
Organisation=Your Organisation
ContactEMail=example@example.com
LicenseTypeName=COMMERCIAL
NumberOfUsers=-1
Subscription=true
Evaluation=false
PurchaseDate=2017-03-14
CreationDate=2017-03-14
LicenseExpiryDate=unlimited
MaintenanceExpiryDate=253402257599855
LicenseID=LIDSEN-L9418768
SEN=SEN-L9418768
licenseVersion=2

conf.LicenseEdition=ENTERPRISE
conf.DataCenter=false
conf.active=true
conf.NumberOfUsers=-1
conf.Starter=false
conf.LicenseTypeName=COMMERCIAL

1. conf.DataCenter=true LicenseExpiryDate unlimited


LicenseValidator
confluence-${version}.jar
com.atlassian.confluence.license.validator.DataCenterLicenseExpiryValidator

2. conf.DataCenter=true LicenseConfluence

http://www.jianshu.com/p/20dbcf85f962 1/9
2017/9/18 Atlassian -

Jira Software

Description=JIRA Software (Data Center)


ServerID=BSVW-4XDC-RWIW-M083
Organisation=Your Organisation
ContactEMail=example@example.com
LicenseTypeName=COMMERCIAL
NumberOfUsers=-1
Subscription=true
Evaluation=false
PurchaseDate=2017-03-15
CreationDate=2017-03-15
LicenseExpiryDate=253402257599855
MaintenanceExpiryDate=253402257599855
LicenseID=LIDSEN-L9423264
SEN=SEN-L9423264
licenseVersion=2

greenhopper.LicenseEdition=ENTERPRISE
jira.NumberOfUsers=-1
jira.product.jira-software.active=true
jira.product.jira-software.DataCenter=false
jira.LicenseEdition=ENTERPRISE
greenhopper.LicenseTypeName=COMMERCIAL
jira.product.jira-software.NumberOfUsers=-1
jira.DataCenter=false
jira.product.jira-software.Starter=false
greenhopper.enterprise=true
jira.active=true
jira.LicenseTypeName=COMMERCIAL
greenhopper.active=true

Bitbucket ( Stash)

Description=Bitbucket (Data Center)


ServerID=BSVW-4XDC-RWIW-M083
Organisation=Your Organisation
ContactEMail=example@example.com
LicenseTypeName=COMMERCIAL
NumberOfUsers=-1
Subscription=true
Evaluation=false
PurchaseDate=2017-03-14
CreationDate=2017-03-14
LicenseExpiryDate=unlimited
MaintenanceExpiryDate=253402257599855
LicenseID=LIDSEN-L9418768
SEN=SEN-L9418768
licenseVersion=2

stash.LicenseTypeName=COMMERCIAL
stash.DataCenter=false
stash.active=true
stash.NumberOfUsers=-1
stash.Starter=false

Bamboo

http://www.jianshu.com/p/20dbcf85f962 2/9
2017/9/18 Atlassian -

Description=Bamboo (Server) unlimited Remote Agents


ServerID=BSVW-4XDC-RWIW-M083
Organisation=Your Organisation
ContactEMail=example@example.com
LicenseTypeName=COMMERCIAL
NumberOfUsers=-1
Subscription=true
Evaluation=false
PurchaseDate=2017-03-14
CreationDate=2017-03-14
LicenseExpiryDate=unlimited
MaintenanceExpiryDate=253402257599855
LicenseID=LIDSEN-L9418768
SEN=SEN-L9418768
licenseVersion=2

bamboo.LicenseEdition=ENTERPRISE
bamboo.NumberOfBambooLocalAgents=-1
bamboo.active=true
bamboo.NumberOfBambooRemoteAgents=-1
bamboo.NumberOfBambooPlans=-1
bamboo.LicenseTypeName=COMMERCIAL

Crucible & FishEye

Description=Crucible (Server)
ServerID=B164-53DN-93PE-5MRN
Organisation=Your Organisation
ContactEMail=example@example.com
LicenseTypeName=COMMERCIAL
NumberOfUsers=-1
Subscription=true
Evaluation=false
PurchaseDate=2017-03-14
CreationDate=2017-03-14
LicenseExpiryDate=unlimited
MaintenanceExpiryDate=4102401599852
LicenseID=LIDSEN-L9418768
SEN=SEN-L9418768
licenseVersion=2

crucible.LicenseTypeName=COMMERCIAL
crucible.Starter=false
crucible.NumberOfUsers=-1
crucible.active=true

Description=FishEye (Server)
ServerID=B164-53DN-93PE-5MRN
Organisation=Your Organisation
ContactEMail=example@example.com
LicenseTypeName=COMMERCIAL
NumberOfUsers=-1
Subscription=true
Evaluation=false
PurchaseDate=2017-03-14
CreationDate=2017-03-14
LicenseExpiryDate=unlimited
MaintenanceExpiryDate=4102401599852
LicenseID=LIDSEN-L9418768
SEN=SEN-L9418768
licenseVersion=2

fisheye.active=true
fisheye.Starter=false
fisheye.LicenseTypeName=COMMERCIAL
fisheye.NumberOfUsers=-1

License

Licensebasee64

License
License X02
31

base64

http://www.jianshu.com/p/20dbcf85f962 3/9
2017/9/18 Atlassian -

4
License 5
zipLicense

SHA1withDSA

com.atlassian.extras.decoder.v2.Version2LicenseDecoder#checkAndGetLicenseText(String)

com.atlassian.extras.decoder.v2.Version2LicenseDecoder

$INSTALL_DIR/confluence/WEB-INF/lib/atlassian-extras-decoder-
Confluence
v2-3.2.jar

Jira Software $INSTALL_DIR/atlassian-jira/WEB-INF/lib/atlassian-extras-3.2.jar

$INSTALL_DIR/atlassian-bitbucket/WEB-INF/lib/atlassian-extras-
Bitbucket
decoder-v2-3.3.0.jar

$INSTALL_DIR/atlassian-bamboo/WEB-INF/lib/atlassian-extras-
Bamboo
decoder-v2-3.3.0.jar

Crucible &
$INSTALL_DIR/lib/atlassian-extras-2.5.jar
FishEye

1. com.atlassian.extras.decoder.v2.Version2LicenseDecoder

2. LicenseLicense

--> --> --> jarclass

License

http://www.jianshu.com/p/20dbcf85f962 4/9
2017/9/18 Atlassian -

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
import java.util.Scanner;
import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;

/**
* @author Shauway <shauway@qq.com>
*/
public class AtlassianLicenseGenerator {
public static final String CONFLUENCE_SERVER_LICENSE_DESC = "Confluence (Server)";
public static final String CONFLUENCE_DATA_CENTER_LICENSE_DESC = "Confluence (Data Center)"
public static final String JIRA_SOFTWARE_SERVER_LICENSE_DESC = "Jira Software (Server)";
public static final String JIRA_SOFTWARE_DATA_CENTER_LICENSE_DESC = "Jira Software (Data Center)"
public static final String BITBUCKET_SERVER_LICENSE_DESC = "Bitbucket (Server)";
public static final String BITBUCKET_DATA_CENTER_LICENSE_DESC = "Bitbucket (Data Center)"
public static final String BAMBOO_SERVER_LICENSE_DESC = "Bamboo (Server) Unlimited Remote Agents"
public static final String CRUCIBLE_SERVER_LICENSE_DESC = "Crucible (Server)";
public static final String FISH_EYE_SERVER_LICENSE_DESC = "FishEye (Server)";
static String COMMON_LICENSE_CONTENT = "Description=$$licenseDesc$$\n" +
"ServerID=$$serverid$$\n" +
"Organisation=$$org$$\n" +
"ContactEMail=$$email$$\n" +
"LicenseTypeName=COMMERCIAL\n" +
"NumberOfUsers=-1\n" +
"Subscription=true\n" +
"Evaluation=false\n" +
"PurchaseDate=2017-03-14\n" +
"CreationDate=2017-03-14\n" +
"LicenseExpiryDate=$$license_expiry_date$$\n" +
"MaintenanceExpiryDate=$$maintenance_expiry_date$$\n" +
"LicenseID=LIDSEN-L9418768\n" +
"SEN=SEN-L9418768\n" +
"licenseVersion=2\n";
static String CONFLUENCE_SPECIAL_LICENSE_CONTENT = "conf.LicenseEdition=ENTERPRISE\n" +
"conf.DataCenter=$$data_center$$\n" +
"conf.active=true\n" +
"conf.NumberOfUsers=-1\n" +
"conf.Starter=false\n" +
"conf.LicenseTypeName=COMMERCIAL";
static String JIRA_SPECIAL_LICENSE_CONTENT = "greenhopper.LicenseEdition=ENTERPRISE\n" +
"jira.NumberOfUsers=-1\n" +
"jira.product.jira-software.active=true\n" +
"jira.product.jira-software.DataCenter=false\n" +
"jira.LicenseEdition=ENTERPRISE\n" +
"greenhopper.LicenseTypeName=COMMERCIAL\n" +
"jira.product.jira-software.NumberOfUsers=-1\n" +
"jira.DataCenter=$$data_center$$\n" +
"jira.product.jira-software.Starter=false\n" +
"greenhopper.enterprise=true\n" +
"jira.active=true\n" +
"jira.LicenseTypeName=COMMERCIAL\n" +
"greenhopper.active=true";
static String BITBUCKET_SPECIAL_LICENSE_CONTENT = "stash.LicenseTypeName=COMMERCIAL\n" +
"stash.DataCenter=$$data_center$$\n" +
"stash.active=true\n" +
"stash.NumberOfUsers=-1\n" +
"stash.Starter=false";
static String BAMBOO_SPECIAL_LICENSE_CONTENT = "bamboo.LicenseEdition=ENTERPRISE\n" +
"bamboo.NumberOfBambooLocalAgents=-1\n" +
"bamboo.active=true\n" +
"bamboo.NumberOfBambooRemoteAgents=-1\n" +
"bamboo.NumberOfBambooPlans=-1\n" +
"bamboo.LicenseTypeName=COMMERCIAL";
static String CRUCIBLE_SPECIAL_LICENSE_CONTENT = "crucible.LicenseTypeName=COMMERCIAL\n" +
"crucible.Starter=false\n" +
"crucible.NumberOfUsers=-1\n" +
"crucible.active=true";
static String FISH_SPECIAL_LICENSE_CONTENT = "fisheye.active=true\n" +
"fisheye.Starter=false\n" +
"fisheye.LicenseTypeName=COMMERCIAL\n" +
"fisheye.NumberOfUsers=-1";

static String LINE_SEPARATOR = System.getProperty("line.separator");


static Scanner scanner = new Scanner(System.in);

public static void main(String[] args) throws Exception {
StringBuffer prompt = new StringBuffer();
prompt.append("Select license type:").append(LINE_SEPARATOR);

http://www.jianshu.com/p/20dbcf85f962 5/9
2017/9/18 Atlassian -
prompt.append("\t11: ").append(CONFLUENCE_SERVER_LICENSE_DESC).append(LINE_SEPARATOR);
prompt.append("\t12: ").append(CONFLUENCE_DATA_CENTER_LICENSE_DESC).append(LINE_SEPARATOR);
prompt.append("\t21: ").append(JIRA_SOFTWARE_SERVER_LICENSE_DESC).append(LINE_SEPARATOR);
prompt.append("\t22: ").append(JIRA_SOFTWARE_DATA_CENTER_LICENSE_DESC).append(LINE_SEPARATOR);
prompt.append("\t31: ").append(BITBUCKET_SERVER_LICENSE_DESC).append(LINE_SEPARATOR);
prompt.append("\t32: ").append(BITBUCKET_DATA_CENTER_LICENSE_DESC).append(LINE_SEPARATOR);
prompt.append("\t4: ").append(BAMBOO_SERVER_LICENSE_DESC).append(LINE_SEPARATOR);
prompt.append("\t5: ").append(CRUCIBLE_SERVER_LICENSE_DESC).append(LINE_SEPARATOR);
prompt.append("\t6: ").append(FISH_EYE_SERVER_LICENSE_DESC).append(LINE_SEPARATOR);
System.out.print(prompt);
System.out.print(">> Input selected license type code: ");
int licenseTypeCode = scanner.nextInt();
switch (licenseTypeCode) {
case 11:
COMMON_LICENSE_CONTENT = COMMON_LICENSE_CONTENT.replace("$$licenseDesc$$", CONFLUENCE_SERVER_LICENSE_DESC)
.replace("$$license_expiry_date$$", "unlimited")
.replace("$$maintenance_expiry_date$$", "253402257599855");
CONFLUENCE_SPECIAL_LICENSE_CONTENT = CONFLUENCE_SPECIAL_LICENSE_CONTENT.replace(
break;
case 12:
COMMON_LICENSE_CONTENT = COMMON_LICENSE_CONTENT.replace("$$licenseDesc$$", CONFLUENCE_DATA_CENTER_LICENSE_DESC)
.replace("$$license_expiry_date$$", "253402257599855")
.replace("$$maintenance_expiry_date$$", "253402257599855");
CONFLUENCE_SPECIAL_LICENSE_CONTENT = CONFLUENCE_SPECIAL_LICENSE_CONTENT.replace(
break;
case 21:
COMMON_LICENSE_CONTENT = COMMON_LICENSE_CONTENT.replace("$$licenseDesc$$", JIRA_SOFTWARE_SERVER_LICENSE_DESC)
.replace("$$license_expiry_date$$", "unlimited")
.replace("$$maintenance_expiry_date$$", "253402257599855");
JIRA_SPECIAL_LICENSE_CONTENT = JIRA_SPECIAL_LICENSE_CONTENT.replace("$$data_center$$"
break;
case 22:
COMMON_LICENSE_CONTENT = COMMON_LICENSE_CONTENT.replace("$$licenseDesc$$", JIRA_SOFTWARE_DATA_CENTER_LICENSE_DESC)
.replace("$$license_expiry_date$$", "253402257599855")
.replace("$$maintenance_expiry_date$$", "253402257599855");
JIRA_SPECIAL_LICENSE_CONTENT = JIRA_SPECIAL_LICENSE_CONTENT.replace("$$data_center$$"
break;
case 31:
COMMON_LICENSE_CONTENT = COMMON_LICENSE_CONTENT.replace("$$licenseDesc$$", BITBUCKET_SERVER_LICENSE_DESC)
.replace("$$license_expiry_date$$", "unlimited")
.replace("$$maintenance_expiry_date$$", "253402257599855");
BITBUCKET_SPECIAL_LICENSE_CONTENT = BITBUCKET_SPECIAL_LICENSE_CONTENT.replace(
break;
case 32:
COMMON_LICENSE_CONTENT = COMMON_LICENSE_CONTENT.replace("$$licenseDesc$$", BITBUCKET_DATA_CENTER_LICENSE_DESC)
.replace("$$license_expiry_date$$", "253402257599855")
.replace("$$maintenance_expiry_date$$", "253402257599855");
BITBUCKET_SPECIAL_LICENSE_CONTENT = BITBUCKET_SPECIAL_LICENSE_CONTENT.replace(
break;
case 4:
COMMON_LICENSE_CONTENT = COMMON_LICENSE_CONTENT.replace("$$licenseDesc$$", BAMBOO_SERVER_LICENSE_DESC)
.replace("$$license_expiry_date$$", "unlimited")
.replace("$$maintenance_expiry_date$$", "4102401599852");
break;
case 5:
COMMON_LICENSE_CONTENT = COMMON_LICENSE_CONTENT.replace("$$licenseDesc$$", CRUCIBLE_SERVER_LICENSE_DESC)
.replace("$$license_expiry_date$$", "unlimited")
.replace("$$maintenance_expiry_date$$", "4102401599852");
break;
case 6:
COMMON_LICENSE_CONTENT = COMMON_LICENSE_CONTENT.replace("$$licenseDesc$$", FISH_EYE_SERVER_LICENSE_DESC)
.replace("$$license_expiry_date$$", "unlimited")
.replace("$$maintenance_expiry_date$$", "4102401599852");
break;
default:
System.out.println("Invalid license type code!");
System.exit(1);
}
System.out.print(">> Input your server id: ");
String serverId = scanner.next();
System.out.print(">> Input your organisation name: ");
String organisation = scanner.next();
System.out.print(">> Input your email address: ");
String email = scanner.next();
COMMON_LICENSE_CONTENT = COMMON_LICENSE_CONTENT.replace("$$serverid$$", serverId)
.replace("$$org$$", organisation).replace("$$email$$", email);
String licenseContent = null;
switch (licenseTypeCode) {
case 11:
case 12:
licenseContent = COMMON_LICENSE_CONTENT + CONFLUENCE_SPECIAL_LICENSE_CONTENT;
break;
case 21:
case 22:

licenseContent = COMMON_LICENSE_CONTENT + JIRA_SPECIAL_LICENSE_CONTENT;
break;
case 31:

http://www.jianshu.com/p/20dbcf85f962 6/9
2017/9/18 Atlassian -
case 32:
licenseContent = COMMON_LICENSE_CONTENT + BITBUCKET_SPECIAL_LICENSE_CONTENT;
break;
case 4:
licenseContent = COMMON_LICENSE_CONTENT + BAMBOO_SPECIAL_LICENSE_CONTENT;
break;
case 5:
licenseContent = COMMON_LICENSE_CONTENT + CRUCIBLE_SPECIAL_LICENSE_CONTENT;
break;
case 6:
licenseContent = COMMON_LICENSE_CONTENT + FISH_SPECIAL_LICENSE_CONTENT;
break;
}
System.out.println();
System.out.println("Your license content. Enjoy it!");
System.out.println();
System.out.println(getLicense(licenseContent));
System.out.println();
System.out.println(licenseContent);
}

static PublicKey publicKey;


static PrivateKey privateKey;
static byte[] licenseTextPrefix = {13, 14, 12, 10, 15};

static {
try {
KeyFactory keyFactory = KeyFactory.getInstance("DSA");
publicKey = keyFactory.generatePublic(new X509EncodedKeySpec(Base64.getUrlDecoder().decode(
privateKey = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(Base64.getUrlDecoder().decode(
} catch (Exception e) {
}
}

static String getLicense(String licenseContent) throws Exception {


byte[] licenseTextBytes = licenseContent.getBytes("UTF-8"); //

Deflater deflater = new Deflater(Deflater.BEST_COMPRESSION);


ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(baos2, deflater);
deflaterOutputStream.write(licenseTextBytes);
deflaterOutputStream.close();
byte[] licenseTextBytesZiped = baos2.toByteArray(); //

Signature signature = Signature.getInstance("SHA1withDSA");


signature.initSign(privateKey);
signature.update(licenseTextPrefix);
signature.update(licenseTextBytesZiped);
byte[] sign = signature.sign();

ByteArrayOutputStream baos = new ByteArrayOutputStream();


DataOutputStream dos = new DataOutputStream(baos);
dos.writeInt(licenseTextBytesZiped.length + licenseTextPrefix.length);
dos.write(licenseTextPrefix);
dos.write(licenseTextBytesZiped);
dos.write(sign);

dos.close();
byte[] licenseContentBytes = baos.toByteArray();
String licenseContentBase64 = Base64.getEncoder().encodeToString(licenseContentBytes);
String licenseContentWithVersion = licenseContentBase64 + "X02";
return licenseContentWithVersion + Integer.toString(licenseContentBase64.length(), 31
}
}

(/nb/6329352)

Shauway (/u/77c090dd9fd8)

1399 5 6
(/u/77c090dd9fd8)

http://www.jianshu.com/p/20dbcf85f962 7/9
2017/9/18 Atlassian -

(/sign_in?utm_source=desktop&utm_medium=not-signed-in-like-button) 3

(http://cwb.assets.jianshu.io/notes/images/10245937/weibo

(/sign_in?utm_source=desktop&utm_medium=not-signed-in-comment-form)

greatdino_fa73 (/u/549618cee23f)
2 2017.05.27 09:26
(/u/549618cee23f)

(/c/9488dde3fd81?utm_source=desktop&utm_medium=notes-
included-collection)

DevOps (/c/e604c60c62aa?utm_source=desktop&utm_medium=notes-
included-collection)

(/)

WEB (/p/a3aa793726fc?utm_campaign=male
IP ddns 80443
WEB http://: ddns

Shauway (/u/77c090dd9fd8?
utm_campaign=maleskine&utm_content=user&utm_medium=pc_all_hots&utm_source=recommendation)

Jetty9.3.xHTTP (/p/912c98f112d8?utm_campaign=male
Client <--SSL --> Nginx <-- proxy_set_header X-Client-Cert $ssl_client_cert; --> Jetty Nginx
SSLX-Client-CertJetty X-Client-Cert Jetty

Shauway (/u/77c090dd9fd8?
utm_campaign=maleskine&utm_content=user&utm_medium=pc_all_hots&utm_source=recommendation)

1002 (/p/f63ff335ff3 (/p/f63ff335ff3e?


utm_campaign=maleskine&utm_content=note&utm_mediu

(/u/21a7a893f4b7?
utm_campaign=maleskine&utm_content=user&utm_medium=pc_all_hots&utm_source=recommendation)

90% (/p/6ca0b98076fd?ut (/p/6ca0b98076fd?


utm_campaign=maleskine&utm_content=note&utm_mediu
2011

(/u/5bf74a1ac836?
utm_campaign=maleskine&utm_content=user&utm_medium=pc_all_hots&utm_source=recommendation)

http://www.jianshu.com/p/20dbcf85f962 8/9
2017/9/18 Atlassian -

PPT (/p/c8536ab29f1f?ut (/p/c8536ab29f1f?


utm_campaign=maleskine&utm_content=note&utm_mediu
PPT

PTT (/u/47b9764d2127?

utm_campaign=maleskine&utm_content=user&utm_medium=pc_all_hots&utm_source=recommendation)

/ App

(/sign_in?utm_source=desktop&utm_medium=note-bottom-bind)
(/apps/download?utm_source=desktop&utm_medium=click-note-bottom-bind)

http://www.jianshu.com/p/20dbcf85f962 9/9

You might also like