-
Notifications
You must be signed in to change notification settings - Fork 0
Fake entitlement/product certificate generation for candlepin
ajaykumarns/cert-gen
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Certificate Generation/Modification ---------------------------------- This project allows you to create/modify x509 certificates generated by Candlepin. PRE-REQUISITES: -------------- Install buildr (using 'gem install buildr') and run 'buildr package' to build the project. If you have buildr version < 1.4, you will need the following workaround: Edit /usr/lib/ruby/gems/1.8/gems/buildr-{version}/lib/buildr/scala/compiler.rb and change line with 'DEFAULT_VERSION' to: DEFAULT_VERSION = '2.8.0.RC6' FEATURES: --------- 1. Edit existing entries on the certificate 2. Delete entries 3. Add new entries to some parts of the certificate. 4. View entries All of the above using commandline. However, the code is flexible enough to be incorporated into gui for future versions. BEGIN: ------ First, start the program using the following command ./cert-gen.sh <existing certificate.pem> If you see any class not found exception, probably you forgot to run 'buildr package'. Also, if you believe cert-gen is not working properly; look into the logs /tmp/certgen.log When everything is in order, you should see "Certificate has been successfully loaded! Enter help for more options" Type in 'help' to view the list of commands you can perform. edit - Edit value(s) within the certificate print - Print current level values print-all - Print all the available fields/values within the current entity back - Go back one level save - Save the certificate to file add - Add new item to the currently selected entity delete - Delete existing entity or index help - Print help quit - Quit the utility Try entering 'p' or 'print'. Based on your certificate contents you should something similar to below. cert-gen>p Certificate |__startDate = Mon Jul 12 17:14:50 EDT 2010 |__endDate = Tue Jul 12 17:14:50 EDT 2011 |__serial = 1516540967 |__subjectDN = CN=8d39a4ec-9d10-4e0f-9437-be07f77ac2e6, UID=5de2d583-3d64-4ca9-b133-88492459edb6, OU=d4e49048-58d9-4f7b-a8f5-ac5ca5df0abc |__customExtensions |__order | |__Order | |__name = Red Hat ENterprise Linux Server | |__orderNo = 12345 | |__quantity = 100 | |__entitlementStartDt = Mon Jul 12 17:14:50 EDT 2010 | |__entitlementEndDt = Tue Jul 12 17:14:50 EDT 2011 | |__contractNumber = 152341643 | |__quantityUsed = 4 |__contents | |__Content | | |__physical = yes | |__Content | |__label = n1 |__roles | |__Role | |__name = SampleName | |__label = label1 | |__quantity = 12 |__products You can edit contents by typing in 'e' or 'edit'. You should see something similar to below. [0].contents [1].customExtensions [2].endDate [3].order [4].products [5].publicKey [6].roles [7].serial [8].startDate [9].subjectDN [10].system Enter the numbers to edit the field cert-gen>0 As in above, enter the number so that you can edit that particular item. Lets start with editing an array of values. For example 'contents' is an array of values. DELETE: ------ Let's try delete first. cert-gen>delete Enter index to delete(q to cancel): 0 0 deleted So a whole entry within the array got deleted. ADD & EDIT: ---------- We can also add new values to the array. Try using the command 'add'. cert-gen>add Loaded entity...Content cert-gen>e [0].name [1].label [2].physical [3].flexGuest [4].vendorId [5].downloadUrl [6].gpgKeyUrl [7].enabled Enter the numbers to edit the field cert-gen>0 cert-gen>value=SampleName1 Value updated to SampleName1 cert-gen>e [0].name [1].label [2].physical [3].flexGuest [4].vendorId [5].downloadUrl [6].gpgKeyUrl [7].enabled Enter the numbers to edit the field cert-gen>1 cert-gen>value=Label1 Value updated to Label1 cert-gen>p Content |__name = SampleName1 |__label = Label1 BACK: ----- When you are editing a particular field, you can go back (i.e) to the parent of the current field and continue editing it. For example, right now we are editing certificate/contents/1. To go back to the certificate level you need to type in 'b' or 'back' twice... cert-gen>b //at content array level cert-gen>b //at certificate level. SAVE: ----- After doing your computations, you can save the modified certificate to disk using 'save' command. Here is how it works: cert-gen>save cert-gen>Enter the file name to save the modified certificate into: /tmp/fake.pem extensions size : 13 Modified certificate saved successfully to /tmp/fake.pem However, note that this does not prevent you from continuing your editing work on the certificate. You can continue modifying the certificate to your choice and save it into another file. QUIT: ----- Quit the application. If you are in the middle of editing, you can type in 'q' to cancel the editing as well. FUTURE GOALS: ------------ *) Support xpath kind of editing. *) Refactor code to remove stupid hacks *) Allow more customization *) Try to make the code into highly generic 'object editing framework'
About
Fake entitlement/product certificate generation for candlepin
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published