The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for the ‘*nix’ Category

terminate screen monitoring serial port – Unix & Linux Stack Exchange

Posted by jpluimers on 2018/03/28

  • Use the screen quit command (normally ctrl-A ctrl-\).
  • Use the command mode of screen (normally ctrl-A :) then type quit or help for more commands

This will quit screen and release the TTY serial port connection.

Related: hooking screen to a TTY serial port connection in [WayBackThe woods and trees of OpenSuSE on single-board computers – image abbreviations – and getting it installed using OS X

–jeroen

via:

Posted in *nix, *nix-tools, Linux, openSuSE, Power User, SuSE Linux | Leave a Comment »

From TailsOS – I needed a faster security wipe to clear out a Linux VM’s…

Posted by jpluimers on 2018/03/21

Cool tool to clear out Linux VM’s non-paged RAM: [WayBack] From TailsOS – I needed a faster security wipe to clear out a Linux VM’s non-paged RAM on demand and on shutdown – someone might find my little journey… – Joe C. Hecht – Google+

A Way Fast Memory Wipe – based on van Hauser’s / [THC], vh@thc.org sdmem

–jeroen

Read the rest of this entry »

Posted in *nix, C, Development, Power User, Software Development | Leave a Comment »

Ben, blogging: Show the complete apache config file

Posted by jpluimers on 2018/03/20

Quite a while back, I got attended to Ben, blogging: Show the complete apache config file:

If you really want to see all the complete config settings, there is no existing tool for that. This Stack Overflow page  answered this question pretty well: You can use apachectl -S to see the settings of Virtual Host, or apachectl -M to see the loaded modules, but to see all settings, there is no such tool, you will have to go through all the files , starting from familiar yourself with the  general structure of the httpd config files.
… script …

The usage is simple: Run it as python  CombineApacheConfig.py . Since there is no additional parameters given, it will retrieve the default Ubuntu apache config file from  /etc/apache2/apache2.conf and generate the result complete config file in /tmp/apache2.combined.conf. If your config file is in different location, then give the input file and output file location.

Note: Apache server-info page http://127.0.0.1/server-info also provide similar information, but not in the config file format. It is in human readable format. The page works only when it is open from the same computer.

Since I could not find how to post comments there, and it works better for me having a repo, I put it into a gist with attribution to hist post: https://gist.github.com/jpluimers/fd300f3a500cbc78cd862d2a248e7b03
I need to adapt it for OpenSuSE; until then run it as this:
python CombineApacheConfig.py /etc/apache2/httpd.conf /tmp/apache2.combined.conf

–jeroen

 


#!/usr/bin/python2.7
# CombineApacheConfig.py
__author__ = 'ben'
import sys, os, os.path, logging, fnmatch
def Help():
print("Usage: python CombineApacheConfig.py inputfile[default:/etc/apache2/apache2.conf] outputfile[default:/tmp/apache2.combined.conf")
def InputParameter():
if len(sys.argv) <> 3:
Help()
return "/etc/apache2/apache2.conf", "/tmp/apache2.combined.conf"
return sys.argv[1], sys.argv[2]
def ProcessMultipleFiles(InputFiles):
Content = ''
LocalFolder = os.path.dirname(InputFiles)
basenamePattern = os.path.basename(InputFiles)
for root, dirs, files in os.walk(LocalFolder):
for filename in fnmatch.filter(files, basenamePattern):
Content += ProcessInput(os.path.join(root, filename))
return Content
def RemoveExcessiveLinebreak(s):
Length = len(s)
s = s.replace(os.linesep + os.linesep + os.linesep, os.linesep + os.linesep)
NewLength = len(s)
if NewLength < Length:
s = RemoveExcessiveLinebreak(s)
return s
def ProcessInput(InputFile):
Content = ''
if logging.root.isEnabledFor(logging.DEBUG):
Content = '# Start of ' + InputFile + os.linesep
with open(InputFile, 'r') as infile:
for line in infile:
stripline = line.strip(' \t')
if stripline.startswith('#'):
continue
if stripline.lower().startswith('include'):
match = stripline.split()
if len(match) == 2:
IncludeFiles = match[1]
IncludeFiles = IncludeFiles.strip('"') #Inserted according to V's comment.
if not IncludeFiles.startswith('/'):
LocalFolder = os.path.dirname(InputFile)
IncludeFiles = os.path.join(LocalFolder, IncludeFiles)
Content += ProcessMultipleFiles(IncludeFiles) + os.linesep
else:
Content += line # if it is not pattern of 'include(optional) path', then continue.
else:
Content += line
Content = RemoveExcessiveLinebreak(Content)
if logging.root.isEnabledFor(logging.DEBUG):
Content += '# End of ' + InputFile + os.linesep + os.linesep
return Content
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG, format='[%(asctime)s][%(levelname)s]:%(message)s')
InputFile, OutputFile = InputParameter()
try:
Content = ProcessInput(InputFile)
except Exception as e:
logging.error("Failed to process " + InputFile, exc_info=True)
exit(1)
try:
with open(OutputFile, 'w') as outfile:
outfile.write(Content)
except Exception as e:
logging.error("Failed to write to " + outfile, exc_info=True)
exit(1)
logging.info("Done writing " + OutputFile)

Posted in *nix, *nix-tools, Apache2, Development, Linux, openSuSE, Power User, Python, Scripting, Software Development, SuSE Linux | Leave a Comment »

Tumbleweed on Raspberry Pi 3 – Bug 1084419 – Glibc update to 2.27 causes segfault during name resolution

Posted by jpluimers on 2018/03/15

Need to watch these:

A few notes:

  • It is inside the glibc name resolution
  • IPv6 is OK, IPv4 fails.
  • ping/nslookup (which do not depend on glibc) are OK
  • there is an intermediate fix requiring direct osc downloads

A simple test case

Failing situation

$ curl --silent --show-error http://example.org > /dev/null
Segmentation fault (core dumped)

Succeeding situation

$ curl --silent --show-error http://example.org > /dev/null

Non related, but in hindsight my own stupid fault during a similar update: a post mortem

Most important bits of my external infrastructure - page 1

Most important bits of my external infrastructure – page 1

I thought I had forgot about the SuSEfirewall2 changes (On my research list: migrate from OpenSuSE SuSEfirewall2 to firewalld) so assumed that was the reason I broke one of my secondaries (which runs on a Raspberry Pi 2):

Mistakes like these are the reason to have secondaries in the first place https://infrastatus.wiert.me and do port-mortems.

Which is kind of odd, as the SuSEfirewall2 didn’t throw any warnings like at this similar one:

This one still works because it is on the firewall in front of the Raspberry Pi 2:

(Screenshots of the above URLs are below).

In fact it was another mistake: I had forgotten to make the DHCP lease static, which resulted in a wrong IP address to be assigned upon reboot, instantly making the firewall rules invalid:

I could have fixed this remotely when I had thought about this.

–jeroen

Read the rest of this entry »

Posted in *nix, Development, Hardware Development, Linux, openSuSE, Power User, Raspberry Pi, SuSE Linux, Tumbleweed | 3 Comments »

EmbarcaderoMonitoring – monitoring the Embarcadero internet related services

Posted by jpluimers on 2018/03/15

Over time, there are lots of complaints about Embarcadero related internet services (like forums, QC, Appanalytics, docwiki, blogsweb site, maintenance) so to track uptime, I’ve created a set of EmbarcaderoMonitoring pages:

This is preliminary work based on my own lists of Embarcadero endpoints combined with some research like [WayBack] dnsdumpster embarcadero.com.png and [WayBack] IdentIPSpy

Underneath, they run on the uptimerobot.com infrastructure which has a limit of 50 free monitors.

It means I have to:

  • trim this down for relevancy
  • better document the endpoint
  • find correct endpoint targets for the black (disabled) and red (down) entries as a few of them might need tweaking
  • maybe split off an insecure and secure version (now most subdomains have both http and https monitored)

Any ideas on improving this are welcome: please post a comment here on on the resulting G+ thread.

Note it likely won’t show cases like when the website was hacked or TLS certificate issues like in SSLLabs security reports for some embarcadero subdomains. I need to think about a means for those, as it will certainly help monitoring my own infrastructure in a similar way.

–jeroen

Read the rest of this entry »

Posted in *nix, Cloud, Development, DevOps, Infrastructure, Monitoring, Power User, Software Development, Uptimerobot | Leave a Comment »

If I ever have to do bind named work again…

Posted by jpluimers on 2018/03/12

Boy, named can be cryptic.

So here are some links that might help me in the future

jeroen

Posted in *nix, bind-named, DNS, Internet, Linux, Power User | Leave a Comment »

How do I disconnect all other users in tmux? – Stack Overflow

Posted by jpluimers on 2018/03/12

The joy of single character command-line switches, so thanks [WayBack] demure for answering at [WayBackHow do I disconnect all other users in tmux? – Stack Overflow:

You can use <prefix> D (where prefix is C-b by default), to chose which clients to detach; it will also list they col/lines as well as the last used time.

You could also use tmux’s detach-client option

 detach-client [-P] [-a] [-s target-session] [-t target-client]
               (alias: detach)
         Detach the current client if bound to a key, the client specified
         with -t, or all clients currently attached to the session speci-
         fied by -s.  The -a option kills all but the client given with
         -t.  If -P is given, send SIGHUP to the parent process of the
         client, typically causing it to exit.

either from <prefix>:followed by detach [options] or on the command line inside tmux with tmux detach [options]

–jeroen

Posted in *nix, *nix-tools, Power User, tmux | Leave a Comment »

For my postfix studies…

Posted by jpluimers on 2018/03/02

Some links that I will extend in the future:

–jeroen

Posted in *nix, *nix-tools, postfix, Power User | Leave a Comment »

Nas4free – keeping an eye on the daily increase of ZFS disk usage

Posted by jpluimers on 2018/02/16

Assuming your nas4free is at https://nas4free, this page will give you the daily increase of ZFS usage:

https://nas4free/disks_zfs_snapshot.php

There you can estimate based on the snapshot history how soon you will run out of ZFS storage.

This is especially important when you have a retention configured using ZFS [WayBackauto snapshots. Under the same assumption, those are configured at  https://nas4free/disks_zfs_snapshot_auto.php in order to support “Previous Versions” on CIFS shares using those ZFS volumes.

Note nas4free is way harder to configure in this respect than freenas, see for instance this article: [WayBackThe Ars NAS distribution shootout: FreeNAS vs NAS4Free | Ars Technica. Luckily there is this small guide to get you going [WayBackJason’s Notes » Blog Archive » Windows previous versions for ZFS backed Samba shares

In the logs at https://nas4free/diag_log.php you can view the snapshot management: when they are created and removed. When you have trouble with the snapshots, monitor your Nas4free version at https://nas4free/system_firmware.php.. For me, NAS4Free 10.3.* seem very stable.

If you for instance have a 5 gigabyte nightly backup written to such a snapshot volume and the volume has 500 gigabytes of free space, a retention of 100 days it will fill up after 100 days.

–jeroen

PS: background reading:

 

 

Posted in *nix, nas4free, Power User, ZFS | Leave a Comment »

How to Install and Configure Postfix as a Send-Only SMTP Server on Ubuntu 16.04 | DigitalOcean

Posted by jpluimers on 2018/02/16

[WayBackHow to Install and Configure Postfix as a Send-Only SMTP Server on Ubuntu 16.04 | DigitalOcean

Postfix is a *mail transfer agent* (MTA), an application used to send and receive email. In this tutorial, we will install and configure Postfix so that it can be used to send emails by local applications only.

–jeroen

Posted in *nix, Linux, Power User, Ubuntu | Leave a Comment »