Skip to content

Commit

Permalink
check that billing-data-service files are not modified
Browse files Browse the repository at this point in the history
  • Loading branch information
mcalmer committed Aug 16, 2023
1 parent 5c72f8d commit 8f59d36
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions java/code/src/com/suse/cloud/CloudPaygManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.redhat.rhn.domain.credentials.Credentials;
import com.redhat.rhn.domain.credentials.CredentialsFactory;
import com.redhat.rhn.manager.content.ContentSyncManager;
import com.redhat.rhn.manager.satellite.SystemCommandExecutor;
import com.redhat.rhn.taskomatic.TaskomaticApi;
import com.redhat.rhn.taskomatic.TaskomaticApiException;

Expand Down Expand Up @@ -246,6 +247,19 @@ private boolean detectIsCompliant() {
return false;
}

// files of this package should not be modified
String[] cmd = {"/usr/bin/rpm", "-V", "billing-data-service"};
SystemCommandExecutor scexec = new SystemCommandExecutor();
int retcode = scexec.execute(cmd);
if (retcode != 0) {
// 5 means checksum changed / file is modified. Example "S.5....T. /path/to/file"
if (scexec.getLastCommandOutput().lines().anyMatch(l -> l.charAt(2) == '5')) {
LOG.error("Billing Data Service has modifications");
LOG.info(scexec.getLastCommandOutput());
return false;
}
}

// we only need to check compliance for SUMA PAYG
try {
if (!requestUrl("http://localhost:18888/").equals("online")) {
Expand Down

0 comments on commit 8f59d36

Please sign in to comment.