Small CI for a small blog

PostImage

Photo by Collab Media on Unsplash


I haven't written in the blog for a long time, it's time to fix that.

And so recently I finally got around to writing a CI/CD process for automatically rolling out new articles on adult topics through the version control system.

Let's see what came of it.

Read more…

Parsing ini files

PostImage

Photo by Sincerely Media on Unsplash

Good afternoon, casual reader.

For one project, it was required to get the value of a variable from an ini file.

And it seems like the solution is simple, a one-line script like:

grep dbname db.conf | awk -F '=' '{ print $2 }'

But what if there are several values in different sections? Then a one-line script will not work anymore.

Search for a solution for linux gave no results :(, although maybe I'm just lazy and have not looked through all the search results.

The decision was made quickly, we take Python and the configparser package. Result ini-file.

Test task for applicants. Linux.

PostImage

Photo by Arian Darvishi on Unsplash

Colleagues, good afternoon!

Having moved to the position of team leader, I began to conduct interviews more often. And the problem with personnel in the region is making itself felt.

There is only one way out - to create a specialist!

And the main question becomes, is he ready?! It was decided to make a test task that was sent to potential colleagues. For verification, a specially broken image of the virtual machine was created.

Restoring this VM answer the following questions:
  • Reset password root

  • Working with fstab

  • iptables|firewalld

  • Routing Linux

  • systemd

  • LVM

  • Extended file attributes

  • Recovery of work PostgreSQL

  • Recovery of work bash scripts.

Links on image VM:

Next plans, i will create one more VM for advanced admins. Bye, bye.

Collect TCP|UDP sessions in Linux

PostImage

Photo by Hans-Peter Gauster on Unsplash

Hello my friend!

As the saying goes, "he called himself a computer technician, get into the IT department."

Preamble

Somehow I caught sight of a script to collect all connections on the host, well, that is a good idea, we put it in a zabbix, wait ... 5 minutes ... 10 minutes ... No values.

The error struck, the script could not keep within the allotted 30 seconds.

I will not describe my surprise when I read the script. a bunch of external utilities were used, regexp was superimposed, etc.

And that's all on Linux, where you can get any value simply by reading file!!!

Read more…

Solution to the problem SSH(pam_limits.so)

PostImage

Photo by Florian Krumm on Unsplash

Colleagues, good afternoon!

Having worked in support since 2007, I faced many problems, one of which I would like to talk about.

Introduction

One Friday at the end of the working day, a message is received about errors from one production server serving clients from Kaliningrad to Sakhalin.

A quick analysis of the server status showed that the problem is only with triggers that call the Bash shell to run, which seemed very strange. The second oddity seemed that the server was in production, and the problem had been fixed for about 30 minutes, there were no user requests! A survey of colleagues in a working chat, determined that today on this server they solved the problem with “too many open files” and solved it. We launch an SSH session on the server, and ... NO connection !!!

Read more…

pySpoolerRenamer — or how to rename a file stream

PostImage

Photo by Ankush Minda on Unsplash

Hello my friend!

Working with large data streams and analyzing them, you face a problem determining the ownership of the file, its source, since 99% of all flows generate soulless electric machines.

Sometimes it can be difficult to determine where the sasder345asd.txt or 123_HDR-Tas.csv file came from (in fact, this is just a set of letters, in most cases the file names have a structured name, but this is still hard to read for a person).

Read more…

pyRsyncBackup

PostImage

Photo by Everyday basics on Unsplash

Good day, casual reader!

And so what I want to tell you today, in the depths of one small department, one small company, a small script - and named this script pyRsyncBackup

For what?! The task was as follows:
  • Backing up configuration files.

  • The initiator must be from outside. Because NAT.

  • Not all nodes have direct access.

First, a prototype was created that performed all these functions, worked on CRON and everyone was happy while the number of servers did not exceed over 100. + the release of the new software added work on re-configuring pyRsyncBackup.

More requirements have appeared:
  • Auto detection of backup modules.

  • Working in Linux daemon mode.

Which was implemented in the current version pyRsyncBackup:
  • run as daemon.

  • Auto detection of backup modules.

  • Backing up via intermediate nodes.

What to expect next:
  • moving away from PostgreSQL, possibly into memory, perhaps into SQLite.

  • redesign of the proxy functionality, since some hosts shoot SSH connections (PAM)

  • Web interface for collecting backup files

But I will deal with these improvements, after creating a prototype of the access control system, if I have enough time and energy, then possibly this year as well.

Thank you.