Add the onion, carrot, celery, and garlic to the pan and cook, stirring occasionally, until the vegetables are beginning to lightly brown, 2 to 3 minutes. Add the cinnamon sticks, star anise, juniper berries, coriander, cloves, thyme, and rosemary and cook, stirring, until well incorporated and aromatic, about 1 minute. Add the wine, stirring to lift up any flavorful bits from the bottom of the pan. Simmer until the wine is reduced by about half, 3 to 5 minutes, then add the duck stock. Bring the liquid to a low boil, then return the duck legs, skin side up, to the pan in a single layer. Most of the duck skin should be above the level of the liquid, so that it crisps as it cooks. Put the pan (uncovered) in the oven and braise until the meat is very tender when pierced with a fork, about 1 1/2 hours.