<p dir="ltr">Fantastic thank you! </p>
<div class="gmail_quote">On 16 Mar 2016 12:21 a.m., "Fraser Tweedale" <<a href="mailto:ftweedal@redhat.com">ftweedal@redhat.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Mar 15, 2016 at 09:39:12AM +0000, Alessandro De Maria wrote:<br>
> Thank you Martin that's very helpful.<br>
><br>
> The annoying thing about cut/paste from web ui is that the cert is not<br>
> wrapped at 60 chars like it should be, but I guess I'll have to wait for<br>
> the save certificate functionality.<br>
> Any idea of then that's planned for?<br>
><br>
> Regards<br>
> Alessandro<br>
><br>
Hi Alessandro,<br>
<br>
The easiest way to get the cert is with the `ipa user-show` (if<br>
it was saved to the IPA direct after issuance, which is controlled<br>
by the `store` option Martin mentioned). E.g.:<br>
<br>
    ipa user-show alice --out=cert.pem<br>
<br>
Which will save alice's certificate(s) to the file `cert.pem`.<br>
<br>
If you copy the data from the web UI and save it to a file, the<br>
following will convert it to PEM:<br>
<br>
    base64 -d < cert.txt | openssl x509 -inform DER > cert.pem<br>
<br>
Finally, to configure a profile to issue certificates with a<br>
validity of X days, the relevant profile configuration is:<br>
<br>
    policyset.serverCertSet.2.constraint.class_id=validityConstraintImpl<br>
    <a href="http://policyset.serverCertSet.2.constraint.name" rel="noreferrer" target="_blank">policyset.serverCertSet.2.constraint.name</a>=Validity Constraint<br>
    policyset.serverCertSet.2.constraint.params.range=740<br>
    policyset.serverCertSet.2.constraint.params.notBeforeCheck=false<br>
    policyset.serverCertSet.2.constraint.params.notAfterCheck=false<br>
    policyset.serverCertSet.2.default.class_id=validityDefaultImpl<br>
    <a href="http://policyset.serverCertSet.2.default.name" rel="noreferrer" target="_blank">policyset.serverCertSet.2.default.name</a>=Validity Default<br>
    policyset.serverCertSet.2.default.params.range=X<br>
    policyset.serverCertSet.2.default.params.startTime=0<br>
<br>
Replace `X` above with the desired lifetime in days.  (Note that the<br>
index (`2`, above) may be different for different profiles.)<br>
<br>
Cheers,<br>
Fraser<br>
<br>
> On 15 March 2016 at 08:50, Martin Babinsky <<a href="mailto:mbabinsk@redhat.com">mbabinsk@redhat.com</a>> wrote:<br>
><br>
> > On 03/15/2016 08:39 AM, Alessandro De Maria wrote:<br>
> ><br>
> >> Hello,<br>
> >><br>
> >> I would like to have authenticated users to upload a csr request and<br>
> >> have their certificate automatically signed. Their certificate would<br>
> >> expire in x days.<br>
> >><br>
> >> Given the short life of the certificate, I would then like them to be<br>
> >> able to easily download the certificate.<br>
> >><br>
> >> Any suggestion on how to do it?<br>
> >> I would prefer the shell script approach but also having it self<br>
> >> serviced on the web ui would be great.<br>
> >><br>
> >> Regards<br>
> >><br>
> >><br>
> >> --<br>
> >> Alessandro De Maria<br>
> >> <a href="mailto:alessandro.demaria@gmail.com">alessandro.demaria@gmail.com</a> <mailto:<a href="mailto:alessandro.demaria@gmail.com">alessandro.demaria@gmail.com</a>><br>
> >><br>
> >><br>
> >><br>
> > Hi Alessandro,<br>
> ><br>
> > for FreeIPA 4.2+ you can use the following links as a guide to set up a<br>
> > custom profile and CA ACL rules so that users can request certificates for<br>
> > themselves:<br>
> ><br>
> > <a href="http://www.freeipa.org/page/V4/User_Certificates#How_to_Test" rel="noreferrer" target="_blank">http://www.freeipa.org/page/V4/User_Certificates#How_to_Test</a><br>
> ><br>
> > <a href="https://blog-ftweedal.rhcloud.com/2015/08/user-certificates-and-custom-profiles-with-freeipa-4-2/" rel="noreferrer" target="_blank">https://blog-ftweedal.rhcloud.com/2015/08/user-certificates-and-custom-profiles-with-freeipa-4-2/</a><br>
> ><br>
> > The user then can generate CSR request e.g. using OpenSSL and use 'ipa<br>
> > cert-request' to send it to IPA CA. If you specify 'store=True' when adding<br>
> > the custom certificate profile, the certificate will be added to the user<br>
> > entry as 'usercertificate;binary' attribute which he can view from<br>
> > CLI/WebUI as PEM and save it to a file by copy-pasting it (The<br>
> > functionality to save the certificate directly to a file is under<br>
> > development).<br>
> ><br>
> > It should be possible to modify the certificate profile to restrict the<br>
> > maximum validity of the issued certificate but I have no knowledge about<br>
> > that. I have CC'ed Fraser Tweedale (the blog post author), he may help you<br>
> > with this.<br>
> ><br>
> > --<br>
> > Martin^3 Babinsky<br>
> ><br>
> > --<br>
> > Manage your subscription for the Freeipa-users mailing list:<br>
> > <a href="https://www.redhat.com/mailman/listinfo/freeipa-users" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/freeipa-users</a><br>
> > Go to <a href="http://freeipa.org" rel="noreferrer" target="_blank">http://freeipa.org</a> for more info on the project<br>
> ><br>
><br>
><br>
><br>
> --<br>
> Alessandro De Maria<br>
> <a href="mailto:alessandro.demaria@gmail.com">alessandro.demaria@gmail.com</a><br>
<br>
> --<br>
> Manage your subscription for the Freeipa-users mailing list:<br>
> <a href="https://www.redhat.com/mailman/listinfo/freeipa-users" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/freeipa-users</a><br>
> Go to <a href="http://freeipa.org" rel="noreferrer" target="_blank">http://freeipa.org</a> for more info on the project<br>
<br>
</blockquote></div>