Pages

Showing posts with label Fedora 32. Show all posts
Showing posts with label Fedora 32. Show all posts

Thursday, October 22, 2020

Fedora 32 : Can be better? part 016.

Today I tested the Unity 3D version 2020 on Linux Fedora 32.
Maybe it would be better to integrate Unity 3D or Unity Hub in Fedora repo just like other useful software like Blender 3D, GIMP.
It will improve the user experience and attract new users and developers for this distro.
I download the AppImage from Unity website and I run with these commands:
[mythcat@desk Downloads]$ chmod a+x UnityHub.AppImage 
[mythcat@desk Downloads]$ ./UnityHub.AppImage 
r: 0
License accepted
...

Sunday, October 18, 2020

Fedora 32 : About positive and negative lookahead with Bash commands.

Today I will talk about something more complex in Linux commands called: positive and negative lookahead.
This solution can be found in several programming languages including Bash
The lookahead process is part of regular expressions.
The lookahead process looks ahead in the string and sees if it matches the given pattern, but then disregard it and move on.
It is very useful when we want to go through the strings.
The lookahead process can be both positive and negative depending on the purpose.
Negative lookahead is indispensable if you want to match something not followed by something else and looks like this:
q(?!s).
The string is the question q is analyzed and if it does not match and is not followed by s returns the result.
The positive lookahead it works the same way only now it is parsed if it corresponds to s.
The positive lookahead looks like this:
q(?=s)
Let's look at a simple example of detecting the PAE option for the processor.
We can use this command but we will find a lot of information ...
[root@desk mythcat]# cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 58
model name	: Intel(R) Celeron(R) CPU G1620 @ 2.70GHz
stepping	: 9
...
In some cases, the resulting information can be taken using pipe and grep but they will be increasingly fragmented.
I will use the same command cpuinfo and we will look for the pae information in the flags.
All CPU flags can be found here.
Let's prove with internal lookahead to find the pae flag.
[root@desk mythcat]# cat /proc/cpuinfo | grep -oP '(?='pae')...' 
pae
pae
This result gives me additional information, namely that there are two cores.
Do you have a question?

Saturday, October 17, 2020

Fedora 32 : Visual Code and C# on Fedora distro.

Today I will show you how to use Visual Code with C#.
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/
vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > 
/etc/yum.repos.d/vscode.repo'
Then use dnf to check and install this editor.
#dnf check-update
#dnf install code
Use Extensions button or Ctrl+Shift+X keys to open in the left side area and intall the C# extension from Microsoft by pressing the Install button, see:

Created a folder named CSharpProjects and using the linux terminal execute the following command:
[mythcat@desk CSharpProjects]$ dotnet new mvc -au None -o aspnetapp
The template "ASP.NET Core Web App (Model-View-Controller)" was created successfully.
This template contains technologies from parties other than Microsoft, 
see https://aka.ms/aspnetcore/3.1-third-party-notices for details.

Processing post-creation actions...
Running 'dotnet restore' on aspnetapp/aspnetapp.csproj...
  Restore completed in 112.76 ms for /home/mythcat/CSharpProjects/aspnetapp/aspnetapp.csproj.

Restore succeeded.

[mythcat@desk CSharpProjects]$ cd aspnetapp/
[mythcat@desk aspnetapp]$ code .
This command will open the Visual Code. At this point, in the aspnetapp folder is an ASP.NET project open in Visual Code. You can run this project with command:
[mythcat@desk aspnetapp]$ dotnet run
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {4c284989-9a5d-4ea7-89e2-a383828fd7ab} may be persisted 
      to storage in unencrypted form.
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /home/mythcat/CSharpProjects/aspnetapp
You can open the https://localhost:5001/ and see the default Welcome page from ASP.NET.

Saturday, October 3, 2020

Fedora 32 : Create games with Phaser Editor 2D.

Today I install Phaser Editor 2D on Fedora 32, you can download it from the official website. I create an account and I download the archive for Linux. After unarchive I used very simple:
[mythcat@desk ~]$ cd PhaserEditor2D/
[mythcat@desk PhaserEditor2D]$ ls
editor  PhaserEditor2D  README.TXT  templates
[mythcat@desk PhaserEditor2D]$ ./PhaserEditor2D 
Phaser Editor 2D - v3.7.1

=> Running in Free mode (only 70 files per project allowed)
=> Purchase a license: https://gum.co/phasereditor

2020/10/03 16:17:51 Loading workspace at /home/mythcat/PhaserEditor2D_Projects
2020/10/03 16:17:51 Listening at http://127.0.0.1:1959/editor

Play IDE online : https://play.phasereditor2d.com/
Documentation   : https://help.phasereditor2d.com/v3
File bugs/ideas : https://github.com/PhaserEditor2D/PhaserEditor2D-v3/
Keep in contact : https://twitter.com/PhaserEditor2D

=> Open the web browser at http://127.0.0.1:1959/editor

2020/10/03 16:17:52 No updates available.
Phaser Editor 2D is a commercial IDE to develop video-games. It is delivered as an offline product and users can run it for free (with certain limitations) or can purchase a license key to unlock all features. Phaser Editor 2D version 3, the latest, is a complete new software based on web technologies. So we created Play Phaser Editor 2D, a small service to allow Phaser Editor 2D license owners, to run the editor and create small projects in the cloud. However, in the future, we will provide a different cloud service with options for storage, collaboration, publishing, integration with other services and payment. These are the Play Phaser Editor 2D available plans: Free Plan and Premium Plan About Free Plan: Running the FREE PLAN 0B/50MB of storage is used 59 days before expiration date The Premium Plan comes with these options:
  • One Year License - 30$ Valid for one year after the purchase. Phaser Editor 2D Team email support. Write to developers@phasereditor2d.com. The option to refund in the first month after the purchase.
  • Two Years License - 45$ Valid for two years after the purchase. Phaser Editor 2D Team email support. Write to developers@phasereditor2d.com. The option to refund in the first month after the purchase.
  • Lifetime License - 75$ Never expires. Phaser Editor 2D Team email support. Write to developers@phasereditor2d.com. The option to refund in the first month after the purchase.
  • Two Years Team License - 125$ 5 developers allowed. Valid for two years. Phaser Editor 2D Team email support. Write to developers@phasereditor2d.com. The option to refund in the first month after the purchase.
This is a video tutorial from official youtube channel:

Friday, October 2, 2020

Fedora 32 : Can be better? part 015.

In the evening I can spend my time with Fedora 32.

In the last few days I studied GTK # a bit.

I thought it would be useful for Linux users and those who use the language of the FASM assembler to have an editor.

Tonight I created this simple project this simple project named fasm_editor.

The objectives of this project are:

  • creating a functional editor;
  • implementation of running and compilation requirements;
  • settings specific to the Linux operating system;

I believe that this way Fedora Linux can be improved and become better.

Wednesday, September 30, 2020

Fedora 32 : Can be better? part 014.

The GTK documentation for C # is not very up to date, I tried to use a button to change a label and I failed first time. The Fedora team could improve this to develop the development side. Here's what I've managed to do so far with GTK.

I fixed the source code with this, but I would have preferred a better method:

my_Button.Clicked += delegate {
my_Label.Text = "Use delegate!";
};

Mono is a free and open source implementation of the .NET Framework.

The most popular build tool for Mono is NAnt.

NUnit is very useful for test driven development.

[root@desk mythcat]# dnf install mono-devel
Last metadata expiration check: 0:15:26 ago on Wed 30 Sep 2020 09:04:30 PM EEST.
Package mono-devel-6.6.0-8.fc32.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@desk mythcat]# dnf install nant
...
Installed:
  log4net-2.0.8-10.fc32.x86_64            nant-1:0.92-25.fc32.x86_64           
  nunit2-2.6.4-24.fc32.x86_64            

Complete!
[root@desk mythcat]# dnf install nunit nunit-gui
Last metadata expiration check: 0:02:09 ago on Wed 30 Sep 2020 09:27:18 PM EEST.
No match for argument: nunit-gui
Error: Unable to find a match: nunit-gui

Installing MonoDevelop:

[root@desk mythcat]# dnf install monodevelop
...
Installed:
  ORBit2-2.14.19-23.fc32.x86_64                                                 
  gamin-0.1.10-36.fc32.x86_64                                                   
  gnome-desktop-sharp-2.26.0-36.fc31.x86_64                                     
  gnome-sharp-2.24.2-25.fc32.x86_64                                             
  gnome-vfs2-2.24.4-30.fc32.x86_64                                              
  gnome-vfs2-common-2.24.4-30.fc32.noarch                                       
  gtk-sharp2-2.12.45-11.fc32.x86_64                                             
  gtk-sharp2-devel-2.12.45-11.fc32.x86_64                                       
  gtksourceview2-2.11.2-31.fc32.x86_64                                          
  libIDL-0.8.14-21.fc32.x86_64                                                  
  libbonobo-2.32.1-18.fc32.x86_64                                               
  libbonoboui-2.24.5-18.fc32.x86_64                                             
  libgnome-2.32.1-20.fc32.x86_64                                                
  libgnome-keyring-3.12.0-19.fc32.x86_64                                        
  libgnomecanvas-2.30.3-19.fc32.x86_64                                          
  libgnomeui-2.24.5-21.fc32.x86_64                                              
  mono-addins-1.1-13.fc32.x86_64                                                
  monodevelop-5.10.0-17.fc32.x86_64                                             
  vte-0.28.2-31.fc32.x86_64                                                     

Complete!

Install the .NET Core. This is a general-purpose, modular, cross-platform and open-source development Platform.

[root@desk mythcat]# dnf copr enable @dotnet-sig/dotnet
Enabling a Copr repository. Please note that this repository is not part
of the main distribution, and quality may vary.
...
Do you really want to enable copr.fedorainfracloud.org/@dotnet-sig/dotnet? [y/N]: y
Repository successfully enabled.
[root@desk mythcat]# dnf install dotnet
Copr repo for dotnet owned by @dotnet-sig             5.4 kB/s | 3.3 kB     00:00    
Package dotnet-3.1.108-1.fc32.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete! 

Let's start with a GTK project using the MonoDevelop I.D.E.

[mythcat@desk ProjectsCSharp]$ monodevelop 
I use a new solution from .NET with GTK# 2.0 Project template. The default source code is this:
using System;
using Gtk;

namespace MonoDevelopGTK_001
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			Application.Init ();
			MainWindow win = new MainWindow ();
			win.Show ();
			Application.Run ();
		}
	}
}
The result is an simple window form. For a complex form with entry ,label and one button, you can see the next example:
using System;
using Gtk;

namespace MonoDevelopGTK_001
{
	
	class MainClass
	{
		public static void Main (string[] args)
		{
			// define here Entry and Button 
			Entry name;
			Button my_Button;

			Application.Init ();
			MainWindow win = new MainWindow ();
			// change the size of window
			win.SetDefaultSize (640, 480);
			// this will close application
			win.DeleteEvent += new DeleteEventHandler (Window_Delete);

			// use of VBox or HBox
			VBox global_vbox = new VBox();
			win.Add(global_vbox);
			name = new Entry();
			global_vbox.PackStart(name, false, false, 0);
			win.Add(name);

			VBox label_vbox = new VBox();
			global_vbox.Add (label_vbox);
			//Define here a label and put some text in it.
			Label my_Label = new Label();
			my_Label.Text = "Hello World!";
			label_vbox.PackStart(my_Label, false, false, 0);
			//Add the label to the form
			win.Add(my_Label);

			VBox button_vbox = new VBox();
			global_vbox.Add (button_vbox);
			my_Button = new Button("Ok!");
			my_Button.Clicked += OnButtonClicked;
			button_vbox.PackStart(my_Button, false, false, 0);
			win.Add(my_Button);
			// ShowAll is used to see all labels, buttons
			win.ShowAll();
			//win.Show ();
			Application.Run ();

		}

		public static void OnButtonClicked (object obj, EventArgs args)
		{
			//Label my_Label = obj as Gtk.Label;
			Console.WriteLine ("Button Clicked !");

		}

		static void Window_Delete (object obj, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}
	}
}

Tuesday, September 29, 2020

Fedora 32 : Can be better? part 013.

I would say that I always have a problem with accessing the knowledge base related to errors, errors and configurations in Linux and Fedora distro.

I think it would be very necessary to have as up-to-date documentation as possible in the Fedora distribution system and possibly a database based on questions and answers.

That makes me think of the pilots' manuals ... where all the possible problems are listed.

It would be useful for anyone and especially saves users' memory.

In the age of artificial intelligence, a flow chart for each possible problem generated by Xorg, Network, services that indicate the areas of interaction and possibly the basic checks that a user should make, possible settings depending on the problem or the desired change would be a fantastic map for both a beginner and an advanced user.

After doing some SELinux configurations, my browser did not want to access the internet.

Until the deactivation, the number of SELinux alerts increased dramatically.

The written SELinux policies were not exactly correct.

Obviously I tried to fix the problem by disabling SELinux.

The ping utility sent and received packets to the internet, my browser does not connect to it.

Sometimes a symbolic link or incorrect setting can block your internet access.

I think the problem was generated when disabling SELinux by restarting and shutting down a useful service.

ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
Although attention was paid to the possibility of incorrect SELinux settings, a simple check and a restart of the systemd-resolved.service service solved the problem.
[root@desk mythcat]# systemctl status systemd-resolved.service 
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled
     Active: inactive (dead)
       Docs: man:systemd-resolved.service(8)
[root@desk mythcat]# systemctl start systemd-resolved.service 
[root@desk mythcat]# systemctl status systemd-resolved.service
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled
     Active: active (running) since Tue 2020-09-29 22:25:32 EEST; 8s ago

Now I've fixed it.

Sunday, September 27, 2020

Fedora 32 : Can be better? part 012.

Pidgin is a chat program that lets you log in to accounts on multiple chat networks simultaneously. 
Pidgin can be installed on multiple operating systems and platforms. 
Pidgin is compatible with the following chat networks out of the box: I.R.C., Jabber/XMPP, Bonjour, Gadu-Gadu, IRC, Novell GroupWise Messenger, Lotus Sametime, SILC, SIMPLE, and Zephyr. Can it be better? 
The only problem a user in need of help may have been in the command line environment. Obviously, in this case, this application cannot be used. I would suggest building a terminal application like WeeChat dedicated to Fedora users and including I.R.C channels. 
Now, let's install this application.
[root@desk mythcat]# dnf install pidgin.x86_64
Last metadata expiration check: 0:45:32 ago on Sun 27 Sep 2020 04:21:51 PM EEST.
Dependencies resolved.
==============================================================================================
 Package                     Architecture    Version                   Repository        Size
==============================================================================================
Installing:
 pidgin                      x86_64          2.13.0-18.fc32            updates          1.4 M
Installing dependencies:
 cyrus-sasl-md5              x86_64          2.1.27-4.fc32             fedora            41 k
 cyrus-sasl-scram            x86_64          2.1.27-4.fc32             fedora            27 k
 farstream02                 x86_64          0.2.9-1.fc32              fedora           239 k
 gtkspell                    x86_64          2.0.16-20.fc32            fedora            43 k
 libgadu                     x86_64          1.12.2-10.fc32            fedora           110 k
 libnice-gstreamer1          x86_64          0.1.17-2.fc32             updates           20 k
 libpurple                   x86_64          2.13.0-18.fc32            updates          5.2 M
 meanwhile                   x86_64          1.1.0-28.fc32             fedora           106 k

Transaction Summary
==============================================================================================
Install  9 Packages

Total download size: 7.2 M
Installed size: 31 M
Is this ok [y/N]: y
Downloading Packages:
...
Complete!

Tuesday, September 22, 2020

Fedora 32 : Testing the Bookworm software.

The current version of Bookworm (v1.1.2) supports eBooks in the following file formats: EPUB, PDF, MOBI, FB2, CBR, CBZ.

First, I install this software with dnf tool:

[root@desk mythcat]# dnf install bookworm.x86_64 
...
Installed:
  bookworm-1.1.3-0.1.20200414git.c7c3643.fc32.x86_64                                          

Complete!

I tested with some old EPUB and PDF files and I'm not very happy with formatting text on the page.

HI tested with some old EPUB and PDF files and I'm not very happy with the formatting for certain texts on the page, like source code in programming.

Bookworm does one thing and does it well for this simple reader.

You can help this project on GitHub.

Monday, September 21, 2020

Fedora 32 : Can be better? part 011.

Four days ago, the well-known Gnome environment came with a new release.

I guess it will be implemented in Fedora distro soon. 

Sunday, September 20, 2020

Fedora 32 : Can be better? part 010.

In this tutorial I will show you how can easy learn with a simple example to have a better Fedora distro with SELinux. 

SELinux uses a policy store to keep track of its loaded policy modules and related settings. 

You can see my active policy store name is MLS.

[root@desk mythcat]# sestatus | grep Loaded
Loaded policy name:             mls

I want to create policy in the most easy way to denny memory. 

I can use many way to do that or find it on SELinux. 

If you want to deny user domains applications to map a memory region as both executable and writable you can use deny_execmem

This is dangerous and the executable should be reported in bugzilla and is is enabled by default. 

You must turn on the deny_execmem boolean.

setsebool -P deny_execmem 1
Let's use it:
[root@desk mythcat]# setsebool -P deny_execmem 1
[root@desk mythcat]# ausearch -c 'Web Content' --raw | audit2allow -M my-WebContent
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i my-WebContent.pp

[root@desk mythcat]# semodule -X 300 -i my-WebContent.pp
Let's see if this SELinux is currently loaded:
[root@desk mythcat]# semodule -l | grep Web
my-WebContent

Tuesday, September 15, 2020

Fedora 32 : Can be better? part 008.

The Fedora development is not very active in the last programming language.
The main reason is the build new packages and put on the repository.
I think this can be improved with a good tool to solve all dependencies and link all into a good package.
Today I tested the new Python version 3.5.10 released on September 5th, 2020.
I download an unzip the archive and I use these commands to build this python version
[mythcat@desk ~]$ cd Python-3.5.10/
[mythcat@desk Python-3.5.10]$ ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.5... no
checking for python3... python3
checking for --enable-universalsdk... no
...
The next command is make:
[mythcat@desk Python-3.5.10]$ make
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
   -Werror=declaration-after-statement   -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o 
./Programs/python.c
...
# On Darwin, always use the python version of the script, the shell
# version doesn't use the compiler customizations that are provided
# in python (_osx_support.py).
if test `uname -s` = Darwin; then \
 cp python-config.py python-config; \
fi
Then I used make test.
[mythcat@desk Python-3.5.10]$ make test
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers

Python build finished successfully!
...
For the last part I used this command:
[mythcat@desk Python-3.5.10]$ sudo make install
...
The result of this is ...
[mythcat@desk Python-3.5.10]$ ls
aclocal.m4     config.sub    Include          Mac              Modules  platform        python            README
build          configure     install-sh       Makefile         Objects  Programs        Python            setup.py
config.guess   configure.ac  Lib              Makefile.pre     Parser   pybuilddir.txt  python-config     Tools
config.log     Doc           libpython3.5m.a  Makefile.pre.in  PC       pyconfig.h      python-config.py
config.status  Grammar       LICENSE          Misc             PCbuild  pyconfig.h.in   python-gdb.py
[mythcat@desk Python-3.5.10]$ ./python 
Python 3.5.10 (default, Sep  6 2020, 22:32:07) 
[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
...

Fedora 32 : Can be better? part 009.

The Fedora distro will be better if the development team will come with useful, accurate, and up-to-date information. A very simple example is C and C ++ programming and more precisely how to build programs and packages. Let's take a simple example of creating interfaces with GTK. Let's take a simple example of creating interfaces with GTK that require knowledge of the GCC compiler. First I install gtk3-devel package:
dnf install gtk3-devel 
The Fedora team come with a group install with many feature.
#dnf -y groupinstall "Development Tools"
I test with these examples:
#include 

int main(int   argc,
     char *argv[])
{
  GtkWidget *window;
    
  gtk_init (&argc, &argv);
    
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "Hello World");
  gtk_widget_show  (window);
    
  gtk_main ();
    
  return 0;
}
This create a simple window with Hello World title.
#include 

static void on_window_closed(GtkWidget * widget, gpointer data)
{
    gtk_main_quit();
}

int main(int argc, char * argv[])
{
    GtkWidget * window, * label;

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    g_signal_connect( window, "destroy", G_CALLBACK(on_window_closed), NULL);

    label = gtk_label_new("Hello, World!");

    gtk_container_add(GTK_CONTAINER(window), label);

    gtk_widget_show(label);
    gtk_widget_show(window);

    gtk_main();

    return 0;
}
This is the same example but you will see a label with te text Hello, World!.
The last example is more complex and involves the use of signals attached to the close button and the OK button.
The main window contains three labels with my name and an editbox in which you have to enter my nickname mythcat or something else.
#include 

const char *password = "mythcat";

// close the window application 
void closeApp(GtkWidget *widget, gpointer data)
{
    gtk_main_quit();
}

// show text when you click on button 
void button_clicked(GtkWidget *button, gpointer data)
{
    const char *password_text = gtk_entry_get_text(GTK_ENTRY((GtkWidget *)data));

    if(strcmp(password_text, password) == 0)
        printf("Access granted for user: \"%s\"\n",password);
    else
        printf("Access denied!\n");
 
}

int main( int argc, char *argv[])
{
    GtkWidget *window;
    GtkWidget *label1, *label2, *label3;
    GtkWidget *hbox;
    GtkWidget *vbox;
    GtkWidget *ok_button;
    GtkWidget *password_entry;

    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    gtk_window_set_title(GTK_WINDOW(window), "Labels, password with one button and layout");
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_window_set_default_size(GTK_WINDOW(window), 300, 200);

    g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(closeApp), NULL);

    label1 = gtk_label_new("Catalin");
    label2 = gtk_label_new("George");
    label3 = gtk_label_new("Festila");

    password_entry = gtk_entry_new();
    gtk_entry_set_visibility(GTK_ENTRY(password_entry), FALSE);
    ok_button = gtk_button_new_with_label("OK");
    g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(button_clicked),password_entry);

    hbox = gtk_box_new(FALSE, 1);
    vbox = gtk_box_new(TRUE, 2);

    gtk_box_pack_start(GTK_BOX(vbox), label1, TRUE, FALSE, 5);
    gtk_box_pack_start(GTK_BOX(vbox), label2, TRUE, FALSE, 5);
    gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, TRUE, 5);
    gtk_box_pack_start(GTK_BOX(hbox), label3, FALSE, FALSE, 5);
    gtk_box_pack_start(GTK_BOX(vbox), ok_button, FALSE, FALSE, 5);
    gtk_box_pack_start(GTK_BOX(hbox), password_entry, TRUE, FALSE, 5);
    gtk_container_add(GTK_CONTAINER(window), hbox);

    gtk_widget_show_all(window);

    gtk_main();

    return 0;
} 
The result can be seen in the following image:

I put the source code for the last example in a test.c file and compiled it like this:
[mythcat@desk ~]$ gcc test.c $(pkg-config --cflags --libs gtk+-3.0) -o test
[mythcat@desk ~]$ ./test

Saturday, September 5, 2020

Fedora 32 : Can be better? part 007.

Another article in the Can be better? series that deals with a very popular feature called SELinux. Here that in this seventh part I will introduce you to the world of SELinux in my own style of simply explaining some SElinux configurations.
Let's recap some basic elements specific to SELinux.
Multi Category Security or MCS is a discretionary implementation of the mandatory Multi Level Security
MCS basically tries to use the MLS attributes: Security Levels and Security Compartments.
MCS implemented have one or more extra fields in their Security Context tuple: user_u:role_r:type_t:s0:c0.
You can see this with id -Z.
The MLS Range contains two components, the low (classification and compartments) and high (clearance).
sensitivity label build from the low component: s2 with c1, c2 ...
MCS does have 1024 categories that can be assigned to processes and files.
On an MLS system are two special labels, SystemLow(s0) and SystemHigh (s15:c0.c255).
The upper end of the MCS range is in an MCS environment s0:c0.c1023 is SystemHigh.
By default, everything in an MCS environment has access to SystemLow or s0.
You will able to access files with s0:c122 and s0:c123 categories.
The MLS translation mechanism to give a more literal meaning to the machine-like policy used in the MLS sensitivity and category declaration.
The MLS rule says: "no read up and no write down".
The MLS model is used to enforce confidentiality.
All processes that are forced to operate with Security Level.
The s0 Security Level or SystemLow level is the lower end of the Security Level Range in an MLS environment.
If you do not have the correct configurations then the SELinux setting operation for Enforcing could generate errors in the linux operation after reboot or during Linux operation.
You will need to have the root password and return for new SELinux settings.
Let's solve this issue: put SELinux into Enforce mode but give my user possibility to use command sudo su.
First, you need to see this table:
SELinux user Description Used for
unconfined_u SELinux user meant for unrestricted users. Unconfined users have hardly any restrictions in a SELinux context and are meant for systems where only Internet-facing services should run confined (i.e. the targeted SELinux policy store). All users on a targeted system
root The SELinux user meant for the root account The Linux root account
sysadm_u SELinux user with direct system administrative role assigned Linux accounts that only perform administrative tasks
staff_u SELinux user for operators that need to run both non-administrative commands (through the staff_r role) and administrative commands (through the sysadm_r role). Linux accounts used for both end user usage as well as administrative tasks
user_u SELinux user for non-privileged accounts Unprivileged Linux accounts
system_u Special SELinux user meant for system services Not used directly
Is need to change my user mythcat to staff_u with a good MLS Range.
[root@desk mythcat]# semanage login --modify --seuser staff_u --range s2:c100 mythcat
[root@desk mythcat]# semanage login --modify --seuser staff_u --range s0-s15:c0.c1023 mythcat
[root@desk mythcat]# semanage login -l 
[root@desk mythcat]# setenforce enforcing
[root@desk mythcat]# getenforce
Enforcing
[root@desk mythcat]# semanage login -l 
ValueError: Cannot read policy store.
After reboot need some time to load the new changes, first is the last configuration.
[mythcat@desk ~]$ semanage login -l
ValueError: SELinux policy is not managed or store cannot be accessed.
[mythcat@desk ~]$ id -Z
staff_u:staff_r:staff_t:s0-s15:c0.c1023
[mythcat@desk ~]$ sestatus 
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: mls
Current mode: permissive
Mode from config file: permissive
Policy MLS status: enabled
Policy deny_unknown status: denied
Memory protection checking: actual (secure)
Max kernel policy version: 33
Few seconds later all is good:
[mythcat@desk ~]$ sudo su 
[sudo] password for mythcat: 
bash: /root/.bashrc: Permission denied
bash-5.0# ls
bash-5.0# sestatus 
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: mls
Current mode: enforcing
Mode from config file: permissive
Policy MLS status: enabled
Policy deny_unknown status: denied
Memory protection checking: actual (secure)
Max kernel policy version: 33
bash-5.0# id -Z
staff_u:staff_r:staff_t:s0-s15:c0.c1023
bash-5.0# exit 
exit
[mythcat@desk ~]$ sestatus 
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: mls
Current mode: enforcing
Mode from config file: permissive
Policy MLS status: enabled
Policy deny_unknown status: denied
Memory protection checking: actual (secure)
Max kernel policy version: 33
Everything is fine for now, this delay is the reason for using the selinux kernel settings. More information about Multi-Level Security and Multi-Category Security can be found on this webpage.

Tuesday, August 25, 2020

Fedora 32 : Change display manager.

The display manager is a graphical login manager which starts a session, simply asks username and password to login desktop.
On Fedora, you can choose for example GDM (Gnome Display Manager), SDDM (Simple Desktop Display Manager), LXDM (LXDE Display Manager), LightDM, KDM (KDE Display Manager), XDM (X Display Manager).
I like the old gdm display manager, is good and works great.
If you want to change it then use these commands:
[root@desk mythcat]# dnf install gdm
...
Complete!
[root@desk mythcat]# systemctl disable lightdm 
[root@desk mythcat]# systemctl enable gdm
Failed to enable unit: File /etc/systemd/system/display-manager.service already exists and is a symlink to /usr/lib/systemd/system/sddm.service.
[root@desk mythcat]# systemctl disable sddm.service 
Removed /etc/systemd/system/display-manager.service.
[root@desk mythcat]# systemctl enable gdm
Created symlink /etc/systemd/system/display-manager.service → /usr/lib/systemd/system/gdm.service.
[root@desk mythcat]# reboot
If you have problems with gdm display manager then you can read about settings here.
The configuration file can be found in this file:
[root@desk mythcat]# cat /etc/gdm/custom.conf 
# GDM configuration storage

[daemon]
# Uncomment the line below to force the login screen to use Xorg
#WaylandEnable=false
AutomaticLogin=mythcat
AutomaticLoginEnable=False
[security]

[xdmcp]

[chooser]

[debug]
# Uncomment the line below to turn on debugging
#Enable=true 

Sunday, August 23, 2020

Fedora 32 : Install LibreOffice_7.0.0 .

The latest releases of LibreOffice is version 7.0.0 and is available for Fedora 32 distro from here. To install it you need to use these commands:
[root@desk mythcat]# dnf -y update
...
[mythcat@desk ~]$ cp Downloads/LibreOffice_7.0.0_Linux_x86-64_rpm.tar.gz ~
[mythcat@desk ~]$ ls LibreOffice*
LibreOffice_7.0.0_Linux_x86-64_rpm.tar.gz
[mythcat@desk ~]$ tar xvf LibreOffice_7.0.0_Linux_x86-64_rpm.tar.gz 
LibreOffice_7.0.0.3_Linux_x86-64_rpm/
LibreOffice_7.0.0.3_Linux_x86-64_rpm/RPMS/
...
[mythcat@desk ~]$ cd LibreOffice_7.0.0.3_Linux_x86-64_rpm/
[mythcat@desk LibreOffice_7.0.0.3_Linux_x86-64_rpm]$ cd RPMS/
[mythcat@desk RPMS]$ sudo dnf install *.rpm
[sudo] password for mythcat: 
Last metadata expiration check: 2:09:12 ago on Sat 22 Aug 2020 10:33:11 PM EEST.
Dependencies resolved.
================================================================================
 Package                                    Arch   Version   Repository    Size
================================================================================
Installing:
 libobasis7.0-base                          x86_64 7.0.0.3-3 @commandline 1.8 M
 libobasis7.0-calc                          x86_64 7.0.0.3-3 @commandline 9.5 M
 libobasis7.0-core                          x86_64 7.0.0.3-3 @commandline 101 M
 libobasis7.0-draw                          x86_64 7.0.0.3-3 @commandline 6.1 k
 libobasis7.0-en-US                         x86_64 7.0.0.3-3 @commandline  88 k
...
Complete!
The last step is to run this software from Fedora 32 distro desktop environment.

Tuesday, August 18, 2020

Fedora 32 : Repair the starting LightDM display manager.

LightDM is a cross-desktop display manager with these features:
  • Cross-desktop - supports different desktop technologies.
  • Supports different display technologies (X, Mir, Wayland ...).
  • Lightweight - low memory usage and high performance.
  • Supports guest sessions.
  • Supports remote login (incoming - XDMCP, VNC, outgoing - XDMCP, pluggable).
  • Comprehensive test suite. 
  • Low code complexity.
To start it you need to use these commands:
[mythcat@desk ~]$ sudo systemctl get-default
[sudo] password for mythcat: 
multi-user.target
[mythcat@desk ~]$ sudo systemctl set-default graphical.target
Removed /etc/systemd/system/default.target.
Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target.
Restart your Fedora distro and use it.

Saturday, August 15, 2020

Fedora 32 : Accurate timekeeping with chronyd daemon.

Accurate timekeeping is important in networking because accurate time stamps in packets and logs are required.
In Linux operating systems, the NTP protocol is implemented by a daemon running in userspace.
For Fedora distro, you can choose between the daemons ntpd and chronyd. Today I will show you how to use the chronyd.
The Fedora documentation can be found on the official website.
Let's install and use this:
[root@desk mythcat]# dnf install chrony 
...
[root@desk mythcat]# vim /etc/chrony.conf 
With the vim tool now you can add the In most cases, it's best to use pool.ntp.org to find an NTP server or use servers from your country. Now, I can start and enable the daemons named chronyd and add it to the firewall.
[root@desk mythcat]# systemctl start chronyd 
[root@desk mythcat]# systemctl status chronyd 
● chronyd.service - NTP client/server
     Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor p>
     Active: active (running) since Sat 2020-08-15 12:23:08 EEST; 9h ago
       Docs: man:chronyd(8)
             man:chrony.conf(5)
   Main PID: 10071 (chronyd)
      Tasks: 1 (limit: 11800)
     Memory: 1.0M
        CPU: 93ms
     CGroup: /system.slice/chronyd.service
             └─10071 /usr/sbin/chronyd

Aug 15 12:23:08 desk systemd[1]: Starting NTP client/server...
Aug 15 12:23:08 desk chronyd[10071]: chronyd version 3.5 starting (+CMDMON +NTP>
Aug 15 12:23:08 desk chronyd[10071]: Frequency -13.819 +/- 0.344 ppm read from >
Aug 15 12:23:08 desk chronyd[10071]: Using right/UTC timezone to obtain leap se>
Aug 15 12:23:08 desk systemd[1]: Started NTP client/server.
Aug 15 12:23:13 desk chronyd[10071]: Selected source 78.96.7.25
Aug 15 12:23:13 desk chronyd[10071]: System clock TAI offset set to 37 seconds

[root@desk mythcat]# systemctl enable chronyd 
[root@desk mythcat]# firewall-cmd --add-service=ntp --permanent 
success
[root@desk mythcat]# firewall-cmd --reload 
success
You can use it with chronyc command tool:
[root@desk mythcat]# chronyc sources 
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^+ blackmamba-g0.eff.ro          3  10   377   692  -1192us[-1273us] +/-   92ms
^+ corporate1.bluepink.ro        2  10   377   200  -1441us[-1441us] +/-   52ms
^+ static-5-2-155-141.rdsne>     2  10   377   468  +1622us[+1540us] +/-   51ms
^* dummy.upcnet.ro               2  10   377   435  -1221us[-1303us] +/-   57ms
[root@desk mythcat]# chronyc tracking
Reference ID    : 4E600719 (dummy.upcnet.ro)
Stratum         : 3
Ref time (UTC)  : Sat Aug 15 19:06:18 2020
System time     : 0.000439648 seconds fast of NTP time
Last offset     : -0.000081712 seconds
RMS offset      : 0.000591977 seconds
Frequency       : 13.753 ppm slow
Residual freq   : -0.000 ppm
Skew            : 0.235 ppm
Root delay      : 0.069966756 seconds
Root dispersion : 0.017129980 seconds
Update interval : 1036.2 seconds
Leap status     : Normal
[root@desk mythcat]# chronyc activity
200 OK
4 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
0 sources with unknown address 

Friday, August 7, 2020

Fedora 32 : First example with C# on Fedora distro.

Let's enable the COPR repository for dotnet:
[mythcat@desk ~]$ sudo dnf copr enable @dotnet-sig/dotnet
[sudo] password for mythcat: 
Enabling a Copr repository. Please note that this repository is not part
of the main distribution, and quality may vary.

The Fedora Project does not exercise any power over the contents of
this repository beyond the rules outlined in the Copr FAQ at
,
and packages are not held to any quality or security level.

Please do not file bug reports about these packages in Fedora
Bugzilla. In case of problems, contact the owner of this repository.

Do you really want to enable copr.fedorainfracloud.org/@dotnet-sig/dotnet? [y/N]: y
Repository successfully enabled.
Install the .NET Core package:
[mythcat@desk ~]$ sudo dnf install dotnet
Copr repo for dotnet owned by @dotnet-sig         42 kB/s |  59 kB     00:01    
Dependencies resolved.
=================================================================================
 Package                           Arch      Version            Repository  Size
=================================================================================
Installing:
 dotnet                            x86_64    3.1.106-1.fc32     updates     11 k
Installing dependencies:
 aspnetcore-runtime-3.1            x86_64    3.1.6-1.fc32       updates    6.2 M
 aspnetcore-targeting-pack-3.1     x86_64    3.1.6-1.fc32       updates    945 k
 dotnet-apphost-pack-3.1           x86_64    3.1.6-1.fc32       updates     70 k
 dotnet-host                       x86_64    3.1.6-1.fc32       updates    104 k
 dotnet-hostfxr-3.1                x86_64    3.1.6-1.fc32       updates    164 k
 dotnet-runtime-3.1                x86_64    3.1.6-1.fc32       updates     27 M
 dotnet-sdk-3.1                    x86_64    3.1.106-1.fc32     updates     41 M
 dotnet-targeting-pack-3.1         x86_64    3.1.6-1.fc32       updates    1.8 M
 dotnet-templates-3.1              x86_64    3.1.106-1.fc32     updates    1.8 M
 netstandard-targeting-pack-2.1    x86_64    3.1.106-1.fc32     updates    1.3 M

Transaction Summary
=================================================================================
Install  11 Packages

Total download size: 79 M
Installed size: 298 M
Is this ok [y/N]: 
...
Use this tutorial to install Visual Studio Code. Press Ctr-P keys to install the C# extension by OmniSharp.
ext install ms-dotnettools.csharp
The last step is to create a application HelloWorld:
[mythcat@desk ~]$ dotnet new console -o HelloWorld

Welcome to .NET Core 3.1!
---------------------
SDK Version: 3.1.106

----------------
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Find out what's new: https://aka.ms/dotnet-whats-new
Learn about the installed HTTPS developer cert: https://aka.ms/aspnet-core-https
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
Write your first app: https://aka.ms/first-net-core-app
--------------------------------------------------------------------------------------
Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on HelloWorld/HelloWorld.csproj...
  Restore completed in 119.48 ms for /home/mythcat/HelloWorld/HelloWorld.csproj.

Restore succeeded.
You can run it with dotnet run command:
[mythcat@desk ~]$ cd HelloWorld/
[mythcat@desk HelloWorld]$ ls
HelloWorld.csproj  obj  Program.cs
[mythcat@desk HelloWorld]$ dotnet run Program.cs 
Hello World!

Sunday, August 2, 2020

Fedora 32 : Play games with Steam service.

Steam is a video game digital distribution service by Valve. It was launched as a standalone software client in September 2003 as a way for Valve to provide automatic updates for their games, and expanded to include games from third-party publishers., see Wikipedia.
Is very easy to install and play a game with Fedora 32 Linux distro, just follow these commands:
[mythcat@desk ~]$ sudo dnf update --refresh
[sudo] password for mythcat: 
Fedora 32 openh264 (From Cisco) - x86_64        1.1 kB/s | 986  B     00:00    
Fedora Modular 32 - x86_64                       39 kB/s |  22 kB     00:00    
Fedora Modular 32 - x86_64 - Updates             26 kB/s |  22 kB     00:00    
Fedora 32 - x86_64 - Updates                     10 kB/s | 9.8 kB     00:00    
Fedora 32 - x86_64                               20 kB/s |  23 kB     00:01    
google-chrome                                   7.6 kB/s | 1.3 kB     00:00    
MEGAsync                                        4.7 kB/s | 1.5 kB     00:00    
MongoDB Repository                              4.4 kB/s | 2.5 kB     00:00    
RPM Fusion for Fedora 32 - Free - Updates        21 kB/s | 9.1 kB     00:00    
RPM Fusion for Fedora 32 - Free                  25 kB/s |  10 kB     00:00    
RPM Fusion for Fedora 32 - Nonfree - Updates     20 kB/s | 9.3 kB     00:00    
RPM Fusion for Fedora 32 - Nonfree               18 kB/s |  10 kB     00:00    
Visual Studio Code                              6.6 kB/s | 3.0 kB     00:00    
Dependencies resolved.
Nothing to do.
Complete!
[mythcat@desk ~]$ sudo dnf install steam -y
Last metadata expiration check: 0:00:09 ago on Sun 02 Aug 2020 04:59:49 PM EEST.
Package steam-1.0.0.64-1.fc32.i686 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[mythcat@desk ~]$ steam 
Running Steam on fedora 32 64-bit
STEAM_RUNTIME is enabled automatically
Pins potentially out-of-date, rebuilding...
...
Now you can pick a game from store steam and play it.