Skip to content
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

[1.28] CCT-69: Anonymous registration #3383

Draft
wants to merge 17 commits into
base: subscription-manager-1.28
Choose a base branch
from

Conversation

m-horky
Copy link
Contributor

@m-horky m-horky commented Mar 4, 2024

@m-horky m-horky requested a review from jirihnidek March 4, 2024 14:51
@m-horky m-horky force-pushed the mhorky/cct67-automatic-registration-1.28 branch from 04025e4 to 7af3f9f Compare March 5, 2024 09:12
Copy link

github-actions bot commented Mar 5, 2024

Coverage

Coverage •
FileStmtsMissCoverMissing
rhsm
   connection.py99347751%48–49, 71, 91–92, 139, 257, 271, 279, 297, 331–336, 340–349, 409, 411, 508, 511, 518–524, 529, 585, 595, 612–613, 622, 625–626, 628–629, 631, 651–653, 657–659, 663–667, 669, 671, 689–696, 698–699, 705, 707, 709–713, 715–726, 728, 731–737, 739–740, 742–743, 754–757, 768–771, 776, 797, 799, 812, 821–825, 827, 832–836, 841–844, 846–851, 855, 857–859, 861–863, 867, 869–870, 879, 881–885, 888–889, 894, 896, 941, 958–961, 988, 1010, 1016, 1019, 1022, 1025, 1049–1050, 1052–1054, 1057, 1093–1097, 1105–1106, 1108, 1117–1118, 1120, 1134, 1144–1146, 1149–1150, 1153, 1164, 1169, 1173, 1187, 1190–1191, 1193–1194, 1196–1197, 1199–1213, 1215–1217, 1219–1230, 1232, 1247–1249, 1251–1253, 1255–1258, 1263–1266, 1290, 1310–1338, 1343–1344, 1346–1348, 1351–1353, 1355–1357, 1360–1361, 1364–1365, 1368–1369, 1391–1392, 1402–1403, 1410–1411, 1417–1419, 1421, 1427–1429, 1431, 1437–1439, 1441, 1447–1448, 1451–1455, 1461–1462, 1468–1469, 1475–1476, 1482–1483, 1501–1504, 1510–1511, 1527–1533, 1535, 1541–1542, 1563–1566, 1574–1576, 1603–1604, 1606, 1608, 1611–1612, 1615–1616, 1619–1620, 1623, 1625–1626, 1629, 1640, 1642–1644, 1646, 1648, 1651, 1653–1666, 1668–1669, 1672–1675, 1678–1679, 1682–1684, 1695–1696, 1699–1700, 1702, 1704–1706, 1712–1714, 1723–1725, 1746, 1749–1750, 1753–1754, 1761, 1763–1764, 1766, 1768–1771, 1773–1775, 1778, 1780, 1787, 1789–1790, 1792, 1794–1797, 1799–1801, 1804, 1806, 1809–1810, 1816–1817, 1823–1824, 1830–1833, 1840–1844, 1846–1848, 1854–1856, 1862, 1864–1867, 1869–1870, 1876–1879, 1886–1888, 1894–1896
subscription_manager
   cache.py63212280%47, 73, 80, 86, 93, 98–100, 127–129, 142–145, 148, 191, 193, 230–233, 240–243, 256, 259–261, 277–278, 280, 289, 326–327, 362, 368, 384, 386–387, 389, 399, 447, 451, 456, 461–465, 473, 476–477, 496, 562, 567, 592, 688, 706, 743, 745–746, 772, 775, 778–784, 787, 803, 806–812, 815, 847–850, 852, 863, 883, 903–904, 942–945, 947, 973, 999–1000, 1025–1026, 1047–1048, 1052, 1056, 1058, 1066, 1105, 1132–1138, 1140, 1142, 1149–1152, 1154
   entcertlib.py2866278%36, 58–59, 62, 65, 67, 74, 77–82, 126–128, 153–161, 164, 196, 200, 202, 206, 223–225, 240, 242–243, 272, 351, 360, 410–411, 413–414, 416, 462, 474, 498, 510–514, 516–519, 521, 526–527, 529–530, 532
   identity.py1325161%59–62, 66, 71–78, 81, 84–85, 88–89, 92, 94, 97, 105–106, 111–118, 121–126, 129–131, 134, 161, 169, 193–195, 210–212, 216, 219
   identitycertlib.py360100% 
   managerlib.py48014370%67–73, 78, 81–82, 87–90, 92, 113–118, 120–125, 185–189, 244, 247–249, 251–252, 349, 357, 382, 415, 515–516, 518–522, 524–525, 529–530, 532–534, 536, 540, 542–545, 556, 558, 591, 621–623, 628–630, 634–635, 637, 654, 656–657, 665–668, 670–673, 721–724, 745, 786, 808–810, 812, 815–816, 842–844, 846, 857, 871–874, 876–879, 883–886, 888, 891, 894–895, 899–902, 904, 907–908, 910–913, 915, 919–922, 930–936, 938–939
   repolib.py3554387%75–80, 83, 88, 92, 222–223, 233–236, 238, 382–385, 387–388, 390, 392, 394–396, 407–411, 413–414, 457–460, 468–469, 476, 532, 620
subscription_manager/scripts
   rhsmcertd_worker.py20313832%50–53, 95, 100–103, 108–109, 114–117, 157, 177–179, 181–183, 187, 196, 198, 202–204, 208, 211–214, 217, 220–221, 227–229, 231–236, 238–239, 241–247, 249–250, 252–253, 263, 265, 267–268, 285, 288–289, 292, 295, 297–298, 301–303, 306, 310–317, 321–323, 326, 330–332, 334, 337, 342, 344, 346–349, 351–353, 355–356, 360, 362, 364, 366, 368–370, 372, 374, 376, 378–379, 381–385, 391–392, 396, 398, 402, 404–405, 412–413, 423–426, 431–436, 440
TOTAL22312933058% 

Tests Skipped Failures Errors Time
2375 11 💤 0 ❌ 0 🔥 41.757s ⏱️

Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current code LGTM

@m-horky m-horky force-pushed the mhorky/cct67-automatic-registration-1.28 branch from 7af3f9f to 3fadb47 Compare June 6, 2024 07:50
m-horky and others added 17 commits October 2, 2024 11:48
The code for it was removed in 3095f59 (2021-09).

(Cherry picked from 1844d95)
* Card ID: CCT-67 (main branch)
* Card ID: CCT-69 (backport)

- /cloud/authorize?version=2: New
- /consumers/{uuid}/certificates: Added 'Authorization' header

(Cherry-picked from 43f57ca)
* Card ID: CCT-67 (main branch)
* Card ID: CCT-69 (backport)

The token we receive from Candlepin is valid for two days and should be
kept even when the system is restarted. This cache files is used to
make sure it persists.

(Cherry-picked from ccc03e4)
* Card ID: CCT-67 (main branch)
* Card ID: CCT-69 (backport)

An abstraction managing anonymous entitlement certificates.

(Cherry-picked from 23db3a4)
This patch creates a system for exit codes used by the worker. This way
the C wrapper may be able to understand what happened inside of the
application and alter its behavior.

(Cherry-picked from f19eb00)
* Card ID: CCT-67 (main branch)
* Card ID: CCT-69 (backport)

This patch implements the standard and anonymous flows for automatic
cloud registration.

(Cherry-picked from eba1a76)
* Card ID: CCT-67 (main branch)
* Card ID: CCT-69 (backport)

(Cherry-picked from b70aaf8)
* Card ID: CCT-67 (main branch)
* Card ID: CCT-69 (backport)

The delay was introduced in early versions of the code when Python was
not reliable for long-running tasks. Since we want to make automatic
registration in both standard and anonymous flow to be as fast as
possible, this delay is removed.

This splay period is now performed by the Python code in case the we
have obtained the anonymous entitlement certificates; before we ask for
the identity certificate.

(Cherry-picked from cb18b79)
* Card ID: CCT-66 (main branch)
* Card ID: CCT-67 (backport)

During the first phase of anonymous cloud registration, the system has
valid entitlement certificates that aren't associated with any consumer.

We shouldn't be reporting missing identity. Previously this was an error
state that was not valid, but with automatic registration it is possible
to have a system consuming content that does not have an identity, for
a transition period before it is part of an anonymous or claimed
organization.

(Cherry-picked from 4820e5f)
Originally fixed through ENT-5549, we need this patch in RHEL 8 as well.

(Cherry-picked from bdb6a07)
Move the code that performs the waiting/delay during automatic
registration in its own function; this way it can be reused also in
other places.

This is only a code recfatoring, there is no behaviour changes.

(cherry picked from commit 85544b2)
The initial delay when performing the standard autoregistration used to
be done directly in rhsmcertd (the C daemon). When the anonymous
autoregistration was implemented, since it has to start immediately,
that delay in rhsmcertd was dropped in favour of doing it "inline"
during the autoregistration. The waiting was added only during the
anonymous autoregistration flow and not during the standard
autoregistration.

Hence, add the autoregistration wait/delay before performing the
standard autoregistration, restoring the previous behaviour.

(cherry picked from commit 0d27a59)
@ptoscano ptoscano force-pushed the mhorky/cct67-automatic-registration-1.28 branch from d691dc4 to 26e9d1d Compare October 2, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants