-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
7.90.5 and higher - error #4
Comments
Thanks for reporting this issue! It seems like the obfuscated name has changed in the latest version so the agent injected the wrong place. I will made a fix sometime later today. Probably I will use the method mentioned in issue #2. If there is performance issue caused by the fix, I may change it back to my original method. For now, you can downgrade to a order version to keep your service up, and then after I fix this issue you can upgrade to the latest version again. |
Oh hi! package icu.lama.artifactory.agent.patches;
import javassist.CtClass;
import javassist.CtField;
import javassist.Modifier;
import javassist.NotFoundException;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
public class PatcherLicenseParser extends ClassPatch {
public PatcherLicenseParser() {
super("org.jfrog.license.api.LicenseParser", "org.jfrog.license.api.LicenseManager");
}
@Override
byte[] onTransform(String className, CtClass clazz, byte[] classBuf) throws Throwable {
var overrides = "";
var publicKeyFieldD = tryGetDeclaredField(clazz, "d"); // Было c, стало d
if (publicKeyFieldD != null) {
publicKeyFieldD.setModifiers(Modifier.PRIVATE + Modifier.STATIC);
overrides += "d = icu.lama.artifactory.agent.AgentMain.PUBLIC_KEY;";
}
var publicKeyFieldE = tryGetDeclaredField(clazz, "e"); // Было d, стало e
if (publicKeyFieldE != null) {
publicKeyFieldE.setModifiers(Modifier.PRIVATE + Modifier.STATIC);
overrides += "e = icu.lama.artifactory.agent.AgentMain.PUBLIC_KEY;";
}
var publicKeyFieldF = tryGetDeclaredField(clazz, "f"); // Новое поле f
if (publicKeyFieldF != null) {
publicKeyFieldF.setModifiers(Modifier.PRIVATE + Modifier.STATIC);
overrides += "f = icu.lama.artifactory.agent.AgentMain.PUBLIC_KEY;";
}
var publicKeyFieldNObf = tryGetDeclaredField(clazz, "jfrogPublicKey");
if (publicKeyFieldNObf != null) {
publicKeyFieldNObf.setModifiers(Modifier.PRIVATE + Modifier.STATIC);
overrides += "jfrogPublicKey = icu.lama.artifactory.agent.AgentMain.PUBLIC_KEY;";
}
var clinitMethod = Arrays.stream(clazz.getDeclaredBehaviors()).filter((it) -> "<clinit>".equals(it.getMethodInfo().getName())).findAny();
if (!clinitMethod.isPresent()) {
throw new Throwable("Corrupted class!");
}
clinitMethod.get().insertAfter(overrides);
clazz.detach();
return clazz.toBytecode();
}
private @Nullable CtField tryGetDeclaredField(CtClass clazz, String field) {
try {
return clazz.getDeclaredField(field);
} catch (NotFoundException e) {
return null;
}
}
} Its works but get some error when init
|
Thanks for the report. I will investigate on this. Can you also provide the license as well? |
Sure. Im not changing Keygen, so:
I pass the licenses in advance in values.yaml (via HELM). |
942ef8d should work on the latest version. However, I have trouble deploying Artifactory, so I can't really test it. I will keep this issue open until I or maybe you can help me tested out. |
@Lama3L9R But there is still an error in the logs. I pass the keys in advance in 1 file during deployment. The first block of the error in the file is related to the keys that I pass in advance in the file. |
Thanks for reporting! Since I had trouble deploying the server, I can't debug those errors, since I have never got a chance to let Artifactpry verify my license. When I run Artifactory on my machine, the router component seems malfunctioning, which caused |
Yes, I am using a separate server for this. services:
postgres:
image: postgres:13
container_name: artifactory-postgres
environment:
POSTGRES_DB: artifactory
POSTGRES_USER: artifactory
POSTGRES_PASSWORD: password
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
artifactory:
image: releases-docker.jfrog.io/jfrog/artifactory-pro:7.90.6
container_name: artifactory
ports:
- "8081:8081"
- "8082:8082"
depends_on:
- postgres
volumes:
- artifactory-data:/var/opt/jfrog/artifactory
- ./ArtifactoryAgent-1.0-SNAPSHOT-all.jar:/opt/jfrog/artifactory/var/bootstrap/ArtifactoryAgent-1.0-SNAPSHOT-all.jar
environment:
- JF_ROUTER_ENTRYPOINTS_EXTERNALPORT=8082
- JF_SHARED_DATABASE_TYPE=postgresql
- JF_SHARED_DATABASE_DRIVER=org.postgresql.Driver
- JF_SHARED_DATABASE_URL=jdbc:postgresql://postgres:5432/artifactory
- JF_SHARED_DATABASE_USERNAME=artifactory
- JF_SHARED_DATABASE_PASSWORD=password
- EXTRA_JAVA_OPTIONS=-javaagent:/opt/jfrog/artifactory/var/bootstrap/ArtifactoryAgent-1.0-SNAPSHOT-all.jar
restart: unless-stopped
ulimits:
nproc: 65535
nofile:
soft: 32000
hard: 40000
volumes:
artifactory-data:
postgres-data: By the way, the agent's position inside the container doesn't actually matter; it can be run from other locations as well. |
@Lama3L9R Hey! |
@Lama3L9R Hi |
Sorry, I was so busy these days. I really want focus on this project but I have to do other things. I will post the agent fix binaries later today. Maybe for that error, if it doesn't really affect anything, let's just ignore it for now. |
I am ready to actively collaborate in testing; we could exchange Telegram contacts, for example. The error doesn't seem to have an impact, but I still don't fully understand it. I add the keys in advance during deployment. |
Hi |
There shouldn't be any war files at all. Use the agent as a Java Agent ( |
Oops, accidentally pressed on close with comment. This issue will mainly focus on those weird exceptions from now. |
Sure, @hereLamadaemon on Telegram |
With Agent from master it works on 7.90.5. However console.log contains license-related WARN:
|
I think this is probably because there are two copies of LicenseManager in Artifactory, and one of them is obfuscated version and another one is the normal one. I found this when I first released this crack, but at that time, if you don't patch the normal one, it will not work. In the current version, this is not a problem. So my point is, this issue is probably because Artifactory's code is terribly bad.As long as the agent is working, it should be fine. |
The text was updated successfully, but these errors were encountered: