2024-06-14
Multi-Domain (SAN/UCC) SSL certificates
Reference URL:
What is a Multi-Domain Wildcard SSL Certificate?
A multi-domain wildcard SSL certificate is the perfect solution for situations where you need to secure multi-level subdomains. It allows encrypting multiple levels of subdomains with one certificate. Like the wildcard certificate, it can work whether the sites are on the same or separate servers.
----------
With a wildcard SSL certificate, the solution is a bit simpler. You can purchase 7 wildcard SSL certificates, to protect:
*.domain.com
*. blog.domain.com
*.preview.domain.com
*.project1.preview.domain.com
*.project2.preview.domain.com
*.project3.preview.domain.com
*.project4.preview.domain.com
That’s still a lot of certificates to purchase and manage. A multi-domain wildcard SSL certificate allows you to purchase a single SSL certificate, and add the above 7 sites as SANs (subject alternative names) to the SSL certificate. This allows you to save a lot of money and hassle by purchasing and installing a single SSL certificate.
Bottom line: If you have multiple levels of subdomains, a multi-domain wildcard SSL certificate is your best option!
----------
Choose Multi-Domain Wildcard SSL Certificate If You Want to...
Secure your website using impenetrable 256-bit symmetric encryption strength
Secure up to 250 fully qualified domain names
Secure unlimited sub-domains
Have unlimited server licenses
Save money, time and efforts
Streamline your SSL management
Authenticate your site using domain or organization validation
----------
SAN (Subject Alternative Names) is the previous keyword i found:
to hv
*.youtube.com
supported in
*.google.com ssl
----------
this round i found:
Multi-Domain (SAN/UCC) SSL certificates
is the one with SAN supported
They’re also called Unified Communications SSL certificates
2024-05-29
2024-05-23
Systemctl add new service.
Create the background service file
[Unit] Description=my-service nginx example # You may want to start after your network is ready After=network-online.target Wants=network-online.target [Service] ExecStart=/usr/bin/env docker run --name nginx --rm -p 8080:80 docker.io/nginx:alpine Restart=Always PIDFile=/tmp/my_service_pid [Install] WantedBy=network-online.target
How to create a systemd service
# Create the service file vim /etc/systemd/system/my-service.service # (if you change an existent file, you must reload the daemon config) # Reload daemon config systemctl daemon-reload # Enable systemctl enable my-service.service # Start systemctl start my-service.service # (if you need to restart) # Restart systemctl restart my-service.service
multi-user.target.wants
Reference URL: https://www.tecmint.com/create-new-service-units-in-systemd/
/etc/systemd/system/multi-user.target.wants/
You can see some link files of unit services and some directories of the “wants” of a target. For example, what the multi-user target wants to be loaded when the boot procedure reaches its level, is listed in the directory with name /etc/systemd/system/multi-user.target.wants/.
As you can see it doesn’t contain only services but also other targets which are also collections of services.
Let’s make a service unit with the name connection.service.
# vim connection.service
and type the following (hit “i” for insert mode), save it, and exit (with “esc” and “:wq!” ) :
[Unit] Description = making network connection up After = network.target [Service] ExecStart = /root/scripts/conup.sh [Install] WantedBy = multi-user.target
2024-05-14
iText write to outputstream
You should change the declaration of out to be of type ByteArrayOutputStream rather than just OutputStream. Then you can call ByteArrayOutputStream.toByteArray() to get the bytes, and construct a ByteArrayInputStream wrapping that.
As an aside, I wouldn't catch Exception like that, and I'd use a try-with-resources statement to close the document, assuming it implements AutoCloseable. It's also a good idea to follow Java naming conventions. So for example, you might have:
public InputStream createPdf() throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try (Document doc = new Document(PageSize.A4, 50, 50, 50, 50)) {
PdfWriter writer = PdfWriter.getInstance(doc, out);
doc.open();
PdfPTable table = new PdfPTable(1);
PdfPCell cell = new PdfPCell(new Phrase("First PDF"));
cell.setBorder(Rectangle.NO_BORDER);
cell.setRunDirection(PdfWriter.RUN_DIRECTION_LTR);
table.addCell(cell);
doc.add(table);
}
return new ByteArrayInputStream(out.toByteArray());
}
-----------------------------
/****/package test.com.report.daily;import static org.junit.jupiter.api.Assertions.*;import java.io.ByteArrayOutputStream;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import java.nio.file.Files;import java.nio.file.Paths;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Calendar;import org.apache.commons.lang3.StringUtils;import org.junit.jupiter.api.AfterEach;import org.junit.jupiter.api.BeforeAll;import org.junit.jupiter.api.Test;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import com.itextpdf.kernel.geom.PageSize;import com.itextpdf.kernel.pdf.PdfDocument;import com.itextpdf.kernel.pdf.PdfReader;import com.itextpdf.kernel.pdf.PdfWriter;import com.itextpdf.kernel.pdf.canvas.parser.PdfTextExtractor;import com.itextpdf.layout.Document;import com.itextpdf.layout.element.Paragraph;import com.itextpdf.layout.element.Text;/*** @author Billson C**/class TestByteArrayOf_iTextPdfToFile{private static final Logger _LOG = LoggerFactory.getLogger(TestByteArrayOf_iTextPdfToFile.class);String pathRoot = "C:\\samples\\";@BeforeAllstatic void setUpBeforeClass() throws Exception {}@AfterEachvoid tearDown() throws Exception {}String pathSeperator = "/";DateFormat _DTF = new SimpleDateFormat("HHmm");@Testvoid test() throws IOException {String currentPathFolder = null;String currentPathFile = null;String currentTimingGenerated = _DTF.format(Calendar.getInstance().getTime());currentPathFolder = StringUtils.join(pathRoot, pathSeperator, currentTimingGenerated, pathSeperator// , currentPortLocationCode);Files.createDirectories(Paths.get(currentPathFolder));String dash = "-";String filename = StringUtils.join("bytearray-of-itext-pdf-to-file", ".", "pdf");String content = StringUtils.join("The filename of this file is: ", filename);currentPathFile = StringUtils.join(currentPathFolder, pathSeperator, filename);File fPdf = new File(currentPathFile);try (FileOutputStream fosPdf = new FileOutputStream(fPdf);) {byte[] aryByte = _getAryByteOfPdf(content);fosPdf.write(aryByte);// outputStream.writeTo(fosPdf);} catch (Exception e) {_LOG.error("Error while test|{}", e.getMessage(), e);}assertTrue(fPdf.exists());// TO DO: suppose to check file content equal to filenameString contentFromPdf = PdfTextExtractor.getTextFromPage(new PdfDocument(new PdfReader(fPdf)).getFirstPage());_LOG.debug("contentFromPdf|{}", contentFromPdf);assertEquals(content, contentFromPdf);}/*** @param content*/protected byte[] _getAryByteOfPdf(String content) {try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();PdfWriter pdfWriter = new PdfWriter(outputStream);// PdfWriter pdfWriter = new PdfWriter(currentPathFile);Document document = new Document(new PdfDocument(pdfWriter// new PdfWriter("./hello-pdf.pdf")), PageSize.A4.rotate())) {document.add(new Paragraph(new Text(content)));document.close();return outputStream.toByteArray();} catch (Exception e) {e.printStackTrace();return null;}}}
Subscribe to:
Posts (Atom)