bnhf / openvpn-admin-plus

Docker-based web interface (with golang backend) for monitoring and admin of an OpenVPN TAP/TUN server setup with PiVPN or other OpenVPN server installations. This project has been renamed from pivpn-tap-web-ui, to reflect its new broader scope.
MIT License
141 stars 23 forks source link

Certificate expiration feature #28

Open karabelnikov opened 1 year ago

karabelnikov commented 1 year ago

@bnhf

Scott, I suggest adding a certificate expiration check to our project. I.e., if the certificate expired at the current UTC +TZ time on the server, then the icon changes in the "Status" column in the "Status" table, the label changes to red in the "Expiration" column, and a button appears in the "Certificates" column delete.

screencapture-192-168-10-60-8080-certificates-2022-12-12-03_17_24

I guess need to introduce a function .Expiration which will check the validity of the certificate. Roughly what it looks like in certificate.html

{{if eq .Revocation .Expiration ""}}
  <td>
    <img src="/static/img/check-circle-fill.svg" width="16" height="16" alt="Valid">
  </td>
{{else}}
  <td>
    <img src="/static/img/x-circle-fill.svg" width="16" height="16" alt="Invalid">
  </td>
{{end}}
{{if eq .Revocation .Expiration ""}}
  <td>
    <span class="label label-success">{{ dateformat .ExpirationT "2006-01-02 15:04"}}</span>
  </td>
{{else}}
  <td>
  <span class="label label-danger">{{ dateformat .ExpirationT "2006-01-02 15:04"}}</span>
  </td>
{{end}}
{{if eq .Revocation .Expiration ""}}
  <td></td>
{{else}}
  <td>
    <a class="btn btn-danger btn-sm" href="{{urlfor "CertificatesController.Remove" ":key" .Details.Name ":serial" .Serial}}">Remove</a>
  </td>
{{end}}

Also, need the "Remove" button to delete all files associated with the given configuration name (name.crt, name.key, name.req, serial.pem, name.conf and name.ovpn). Since the certificate has expired, it is in fact invalid and you cannot connect with it. Accordingly, he does not need to make a revoke and does not need to be added to the recall list either.

What do you think? I think this is a great feature for our project.