<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Philipp </title>
    <description>The latest articles on DEV Community by Philipp  (@philippmayrth).</description>
    <link>https://dev.to/philippmayrth</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F606085%2Fbca3a12f-e3cd-4a8e-9005-d010b50966be.png</url>
      <title>DEV Community: Philipp </title>
      <link>https://dev.to/philippmayrth</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/philippmayrth"/>
    <language>en</language>
    <item>
      <title>Qu’est-ce que tu feras après un attack cyber</title>
      <dc:creator>Philipp </dc:creator>
      <pubDate>Fri, 09 Jul 2021 20:05:09 +0000</pubDate>
      <link>https://dev.to/philippmayrth/qu-est-ce-tu-feras-apres-un-attack-cyber-59gj</link>
      <guid>https://dev.to/philippmayrth/qu-est-ce-tu-feras-apres-un-attack-cyber-59gj</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;J’ai utilisé Cockpit CMS un logiciel avec plusieurs de problèmes sécurité. Il y a deux ans j’ai pensé il est le meilleur logiciel pour moi parce que il est simple pour utiliser est il fonctionne avec plusieurs langues aussi. J’ai lis le code et j’ai connu le problème sécurité.&lt;/p&gt;

&lt;p&gt;Il y a deux semaines j’ai reçu un émail de un spécialiste sécurité qui piraté mon installation cockpit et demande récompense. J’ai utilisé le récent logiciel encore.&lt;br&gt;
Le piratage utilisé un « NoSQL injection » bug avec le champ d’entree pour mod de passe.&lt;/p&gt;

&lt;h1&gt;
  
  
  Qu’est-ce que j’ai fais
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Bloque accès sous mod de pass avec « basic auth » dans Apache.&lt;/li&gt;
&lt;li&gt;Change tout des jeton accès et mod de pass pour tout les utilisateurs.&lt;/li&gt;
&lt;li&gt;Utilise sauvegarde parce que je ne sais pas si quelques informations être changé avec le piratage.&lt;/li&gt;
&lt;li&gt;Change tout le logiciel que j’ai crée de utiliser le nouveau « basic auth » et un Access Token de Cockpit.&lt;/li&gt;
&lt;li&gt;Crée security.txt fiches pour tout mon site de web.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Et maintenant?
&lt;/h1&gt;

&lt;p&gt;Je recherché des option de change cette système avec un logiciel plus sécurité.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>security</category>
      <category>devjournal</category>
      <category>french</category>
    </item>
    <item>
      <title>Memorize Keyboard shortcuts for every editor you use</title>
      <dc:creator>Philipp </dc:creator>
      <pubDate>Tue, 27 Apr 2021 20:45:23 +0000</pubDate>
      <link>https://dev.to/philippmayrth/memorize-keyboard-shortcuts-for-every-editor-you-use-37nf</link>
      <guid>https://dev.to/philippmayrth/memorize-keyboard-shortcuts-for-every-editor-you-use-37nf</guid>
      <description>&lt;p&gt;As coders we use our editors a lot. If we want to type faster wouldn’t learning the editors keyboard shortcuts help? Let’s see. We change our coding tools a lot if you’ve been programming for a few years I bet you don’t use the editor you learned coding in.&lt;/p&gt;

&lt;p&gt;Learning your current editors shortcuts just sets you up for learning it all over again once a better editor comes around or your preferred editor doesn’t support a platform you are programming for. Sure sometimes you can import your old editors shortcuts and change the key mappings.&lt;br&gt;
Wouldn’t it be great though if there were shortcuts that worked almost out of the box for all your editors — current and future?&lt;/p&gt;

&lt;p&gt;There is, meet vim. Not vim itself. After all we want to get work done and not show off how nerdy we are.&lt;br&gt;
There is a vim extension for most editors and the best news is the shortcuts you learned once work everywhere.&lt;/p&gt;

&lt;p&gt;Granted vim looks pretty intimidating and like a tool only the uber nerd would use. At least that’s what I thought until I dug deeper into it and found it pretty helpful. You don’t have to master it for it to be useful. 15 or 20 out of hundreds of possible shortcuts will give you a boost you wouldn’t want to miss ever again.&lt;/p&gt;

&lt;p&gt;It took me about two weeks to getting used to it and now I don’t want to miss it.&lt;/p&gt;

&lt;p&gt;I learned it on &lt;a href="https://vim-adventures.com"&gt;https://vim-adventures.com&lt;/a&gt; sure there are books I even bought some but I would recommend against using books to learn vim. Once you know your way around vim &lt;a href="https://vimtricks.com"&gt;https://vimtricks.com&lt;/a&gt; has nice tips for every experience level to get your game to the next level.&lt;/p&gt;

&lt;p&gt;Links&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=vscodevim.vim"&gt;Vim for VSCode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/XVimProject/XVim2"&gt;Xcode vim&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>productivity</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Adding an Apple Watch App or Widget to Cordova</title>
      <dc:creator>Philipp </dc:creator>
      <pubDate>Fri, 16 Apr 2021 19:31:14 +0000</pubDate>
      <link>https://dev.to/philippmayrth/adding-an-apple-watch-app-or-widget-to-cordova-3goa</link>
      <guid>https://dev.to/philippmayrth/adding-an-apple-watch-app-or-widget-to-cordova-3goa</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;If you want to add native code to Cordova you’re pretty much on your own because the framework won’t help you with it.&lt;br&gt;
Trying to add an iOS 14 widget and an Apple Watch app cost me 2 weeks of digging around in Cordovas source code and figuring out the Xcode project file. This article hopes to save you those 2 weeks.&lt;/p&gt;
&lt;h2&gt;
  
  
  The method
&lt;/h2&gt;

&lt;p&gt;So obviously the first thing you would try when doing anything that has to do with a native feature in Cordova is you wold look for a plugin that does it for you. Unfortunately the few plugins that exist don’t work anymore. So we need to get our hands dirty ourselves.&lt;/p&gt;

&lt;p&gt;The biggest pain point when integrating native features in Cordova is that the Xcode project file is created on every build  overwriting any change you did manually.&lt;/p&gt;

&lt;p&gt;The birds eye view of what I did is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Build the Cordova app to generate the Xcode config&lt;/li&gt;
&lt;li&gt;Add the iOS 14 widget and the Apple Watch target&lt;/li&gt;
&lt;li&gt;See what parts of the Xcode config step 2 changed&lt;/li&gt;
&lt;li&gt;Write a script to make those changes on every build&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Build the Cordova app to generate the Xcode config
&lt;/h2&gt;

&lt;p&gt;This part is very simple. Just build your app the way you always do. After you build the app, Cordova will have regenerated the Xcode project file at &lt;code&gt;platforms/ios/yourapp.xcodeproj/project.pbxproj&lt;/code&gt;. Store this file at a different location or check it in to git, you will compare it with a later version.&lt;/p&gt;
&lt;h2&gt;
  
  
  Add the iOS 14 widget and the Apple Watch target
&lt;/h2&gt;

&lt;p&gt;Now add your iOS 14 or Apple Watch target. If you have both I would recommend doing them one by one.&lt;br&gt;
Since there are plenty of tutorials on this part I won’t go into detail here.&lt;/p&gt;
&lt;h2&gt;
  
  
  See what parts of the Xcode config step 2 changed
&lt;/h2&gt;

&lt;p&gt;Now that you have two Xcode config files we need to compare the contents. Since the files are sort of json &lt;em&gt;(they aren’t real json and can’t be parsed as such)&lt;/em&gt; you could just compare them with a graphical diffing tool such as &lt;code&gt;Xcode -&amp;gt; Open Developer Tool &amp;gt; FileMerge&lt;/code&gt;. It is helpful to have an understanding of how the Xcode config file works.&lt;br&gt;
The way I found very helpful though was to convert both Xcode config files into json and then using an online tool to compare them. Apple provides a tool to convert legacy plist &lt;em&gt;(which is what the Xcode config is)&lt;/em&gt; into json.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;convert with &lt;code&gt;plutil -convert json project.pbxproj&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;diff the json with &lt;a href="http://jsondiff.com/"&gt;http://jsondiff.com/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Write a script to make those changes on every build
&lt;/h2&gt;

&lt;p&gt;Birds eye view:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cordova build&lt;/li&gt;
&lt;li&gt;Runs add watch / widget hook&lt;/li&gt;
&lt;li&gt;Hook converts Xcode config to json&lt;/li&gt;
&lt;li&gt;Hook adds stuf to the Xcode config as json&lt;/li&gt;
&lt;li&gt;Hook converts the Xcode config back to the legacy plist format so Cordova is happy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now this is the hard part. You might want to break it into steps and keep comparing the result of your script with the Xcode config you got after adding the Watch app or iOS 14 widget.&lt;/p&gt;

&lt;p&gt;Because there are no good parsers for the Xcode config &lt;em&gt;(except the one of CocaPods maybe but that’s Ruby and I don’t know Ruby yet)&lt;/em&gt; I opted to just convert the Xcode config in a Cordova hook to json and edit it.&lt;/p&gt;

&lt;p&gt;Since the Xcode config is just a legacy plist file Xcode will recognize it if it is converted to json. So we just leave it as json right? Well I wish it was that easy but there is also Cordova and that has it’s own Xcode config parser that is actually quite bad &lt;a href="https://github.com/apache/cordova-node-xcode"&gt;cordova-node-xcode&lt;/a&gt;. It must have the legacy plist format  and to make matters even worth it also needs the comments preserved.&lt;/p&gt;

&lt;p&gt;What I ended up doing was converting the json back to the legacy plist format that Cordova know how to handle. Since there is no code for that already I wrote it.&lt;/p&gt;
&lt;h3&gt;
  
  
  Converting json Xcode config to legacy plist format
&lt;/h3&gt;

&lt;p&gt;The Xcode config in legacy plist format looks like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;!$*UTF&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;*$!&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;archiveVersion&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;classes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;objectVersion&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;46&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;objects&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;add&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;sections&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;here&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;rootObject&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"...projectid..."&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;/*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Project&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;*/;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;objects&lt;/code&gt; object holds Xcode config sections. Each object has a property named &lt;code&gt;isa&lt;/code&gt;. For Cordova to recognize this file you need to loop through all the objects in your json and sort them by the isa. Then wrap each ISA section with the following comments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Begin PBXBuildFile section */

// ...

/* End PBXBuildFile section */
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where &lt;code&gt;PBXBuildFile&lt;/code&gt; in this example is just on ISA but you would have to do this for all the ISAs in your Xcode config.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you’re curios why on earth we’d need to retain the comments &lt;a href="https://github.com/apache/cordova-node-xcode/blob/master/lib/parser/pbxproj.js#L235%EF%BB%BF"&gt;https://github.com/apache/cordova-node-xcode/blob/master/lib/parser/pbxproj.js#L235﻿&lt;/a&gt;. This is unfortunately the way the “parser” for Cordova is build.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Also see &lt;a href="http://www.monobjc.net/xcode-project-file-format.html%EF%BB%BF"&gt;http://www.monobjc.net/xcode-project-file-format.html﻿&lt;/a&gt; for information on the Xcode config file format.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding the script as Cordova hook
&lt;/h3&gt;

&lt;p&gt;The script you just wrote needs to be run by Cordova on each build process.&lt;/p&gt;

&lt;p&gt;In your &lt;code&gt;config.xml&lt;/code&gt; add&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;    &lt;span class="nt"&gt;&amp;lt;hook&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"hooks/convert.py"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"before_run"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;hook&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"hooks/convert.py"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"before_build"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Cordova bugs
&lt;/h4&gt;

&lt;p&gt;There are plenty of bugs in Cordova making our lives harder here that we need to adress.&lt;/p&gt;

&lt;p&gt;Cordovas &lt;code&gt;ProjectFile.js&lt;/code&gt; has code that overwirtes the bundle id of every Xcode build target to the one defined in &lt;code&gt;config.xml&lt;/code&gt;. This is bad because the widget and watch targets need differing bundle ids.&lt;br&gt;
Some upcoming version of Cordova might include a fix but for now an easy solution is to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Fix the file on the fly with our hook. See &lt;a href="https://github.com/apache/cordova-ios/issues/764#issuecomment-669317730"&gt;https://github.com/apache/cordova-ios/issues/764#issuecomment-669317730&lt;/a&gt; for details on how the file needs to be patched.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you are using the iOS 14 widget or if your Apple Watch app is written in Swift you also need to patch a line in Cordovas config that breaks Swift code.&lt;br&gt;
Comment out the following line&lt;br&gt;
&lt;code&gt;SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h&lt;/code&gt; in &lt;code&gt;build.xcconfig&lt;/code&gt;. This has to do with &lt;a href="https://issues.apache.org/jira/browse/CB-10072"&gt;https://issues.apache.org/jira/browse/CB-10072&lt;/a&gt;.&lt;br&gt;
Note though that if you have a Cordova plugin that is written in swift it might break by changing that line and you’d need a different solution. Since support for most Cordova plugins was dropped long ago and are written in ObjC it wasn’t an issue for me.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is one more bug worth mentioning although I didn’t find a way to do anything about it &lt;a href="https://github.com/apache/cordova-ios/issues/1049%EF%BB%BF"&gt;https://github.com/apache/cordova-ios/issues/1049﻿&lt;/a&gt; it basically prevents building the app without a real smartphone attached if you have the watch target.&lt;/p&gt;

&lt;p&gt;And certainly not the last Cordova bug only the last I ran into. You can’t set a version lower than iOS 14 because for Cordova you need to set every target to the same minal version and the widget (at least if you wrote it with SwiftUI) requies iOS 14.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.monobjc.net/xcode-project-file-format.html%EF%BB%BF"&gt;http://www.monobjc.net/xcode-project-file-format.html﻿&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/32133576/what-tools-support-editing-project-pbxproj-files"&gt;https://stackoverflow.com/questions/32133576/what-tools-support-editing-project-pbxproj-files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/kronenthaler/mod-pbxproj/wiki#basic-usage"&gt;https://github.com/kronenthaler/mod-pbxproj/wiki#basic-usage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/microsoft/xcodeproj%EF%BB%BF"&gt;https://github.com/microsoft/xcodeproj﻿&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.monobjc.net/xcode-project-file-format.html%EF%BB%BF"&gt;http://www.monobjc.net/xcode-project-file-format.html﻿&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/CocoaPods/CocoaPods/issues/1275#issuecomment-22391200%EF%BB%BF"&gt;https://github.com/CocoaPods/CocoaPods/issues/1275#issuecomment-22391200﻿&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ios</category>
      <category>cordova</category>
      <category>ionic</category>
      <category>applewatch</category>
    </item>
    <item>
      <title>Encrypting cron emails with GPG</title>
      <dc:creator>Philipp </dc:creator>
      <pubDate>Sat, 10 Apr 2021 21:12:57 +0000</pubDate>
      <link>https://dev.to/philippmayrth/encrypting-cron-emails-with-gpg-15j</link>
      <guid>https://dev.to/philippmayrth/encrypting-cron-emails-with-gpg-15j</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;You might have your server setup in such a way that it runs a few tasks with cron so you don’t have to worry about them. Except.. you should. That is if the scheduled tasks send mission critical information over the internet. Now assume you have some kind of security audit software running like say lynis. You sure don’t want that report in the wrong hands since an attacker could really use that information to break into your server way easier than otherwise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Assumptions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You are familiar with GPG&lt;/li&gt;
&lt;li&gt;You have root access to your linux web server&lt;/li&gt;
&lt;li&gt;Your server runs on a recent Ubuntu&lt;/li&gt;
&lt;li&gt;Cron is already configured to send emails&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Encrypting
&lt;/h2&gt;

&lt;p&gt;There are basically two ways of encrypting emails one is GPG and the other S/MIME. We will be using GPG. Further this article assumes you are familiar with GPG.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Upload your public key (ending in .asc) to your server /home is a good place.&lt;/li&gt;
&lt;li&gt;that the key can actually be read by the command we will be using, it has to be slightly modified. To be precise the ASCII amor has to be removed we need the key in binary form. This is archived by the following command.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gpg --dearmor &amp;lt; /home/YOURPUBLICKEY.asc &amp;gt; /home/YOURPUBLICKEY.asc.gpg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add this line at the top of your /etc/crontab just after MAILTO=&lt;a href="mailto:you@example.de"&gt;you@example.de&lt;/a&gt;. You need to replace the email address and the public key path.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GPG_CMD = "ifne /usr/bin/gpg --batch --armor --trust-model always --no-default-keyring --keyring /home/YOURPUBLICKEY.asc.gpg --recipient you@example.de --encrypt"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;For this command to work we need the program ifne installed. Usually if a command has no output to /dev/stdout or /dev/stderr gpg would encrypt an empty string and you would receive an encrypted email that has no content once decrypted. This would be annoying ifne  prevents this. To install it run.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt-get install moreutils
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Now in /etc/crontab you can simply pipe the output to gpg and enjoy encrypted emails.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* * * * * root /bin/echo "gpg test" | $GPG_CMD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I got the inspiration for this from &lt;a href="https://www.zulius.com/how-to/send-encrypted-email-from-shell-scripts-cron/"&gt;this&lt;/a&gt; a site that is unfortunately offline for a few days now (checked April 2021).&lt;/p&gt;

</description>
      <category>cron</category>
      <category>gpg</category>
      <category>linux</category>
    </item>
    <item>
      <title>Server Authentication With Client Certificate X.509</title>
      <dc:creator>Philipp </dc:creator>
      <pubDate>Sat, 03 Apr 2021 03:43:07 +0000</pubDate>
      <link>https://dev.to/philippmayrth/server-authentication-with-client-certificate-x-509-1boo</link>
      <guid>https://dev.to/philippmayrth/server-authentication-with-client-certificate-x-509-1boo</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Basics of setting up certificate based authentication on Apache.&lt;/p&gt;

&lt;h2&gt;
  
  
  Assumptions
&lt;/h2&gt;

&lt;p&gt;Your Server is already configured to use SSL/TLS. This is required because the browser refuses to use its certificate for authentication on an insecure connection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating all the files we need
&lt;/h2&gt;

&lt;p&gt;Note: The key sizes and expiration dates must be adjusted to suite your need.&lt;/p&gt;

&lt;p&gt;Create the CA&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openssl genrsa -out CA.key 2048
openssl req -x509 -new -nodes -key CA.key -days 7300 -out CA.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a signing request and signing it with the CA private key&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openssl genrsa -out alice.key 2028
openssl req -new -key alice.key -out alice.csr
openssl x509 -sha256 -req -in alice.csr -out alice.crt -CA CA.pem -CAkey CA.key -CAcreateserial -days 1095
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Convert the alice.crt to alice.p12 so a browser knows what to do with it. (Note: On safari the .p12 file has to have a password for the import to work)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openssl pkcs12 -export -clcerts -in alice.crt -inkey alice.key -out alice.p12
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Convert the .p12 to .pam so tools like curl can use it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openssl pkcs12 -in alice.p12 -out alice.pem -clcerts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configuring Apache
&lt;/h2&gt;

&lt;p&gt;copy your CA.pem in a file readable by apache. In my case it is /home/CA.pem but this might differ for your server.&lt;/p&gt;

&lt;p&gt;in your virtual hosts configuration file add SSLCACertificateFile  and SSLVerifyClient  like shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;IfModule mod_ssl.c&amp;gt;
&amp;lt;VirtualHost *:443&amp;gt;

    SSLCACertificateFile /home/CA.pem
    SSLVerifyClient require


# ..... your additional configuration here
# .....

&amp;lt;/VirtualHost&amp;gt;
&amp;lt;/IfModule&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Finally… we can use it
&lt;/h2&gt;

&lt;p&gt;To use the certificate with curl&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -E alice.pem https://restricted.example.de
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To install in Safari on a Mac just double click the .p12 file and follow the instructions&lt;/p&gt;

&lt;p&gt;To install on iOS the file can be send by email (messengers don’t work) and installed by tapping on it and following the instructions. If the file is considered a production file it should NOT be send over the internet instead plug in a usb cord and transfer via iTunes.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>web</category>
      <category>smime</category>
      <category>encryption</category>
    </item>
  </channel>
</rss>
