Archive | GNU/Linux

Antergos 17.12 duyuruldu

Arch tabanlı bir dağıtım olan Antergos’un güncelleştirilmiş bir sistem yükleyicisi içeren 17.12 sürümü duyuruldu. Live ve minimal ortamlar için güncellenen paketlerle gelen sistemin live sürüm ve minimal sürüm olarak iki ayrı kalıp olarak indirilebileceği söylenirken, minimal sürüm olarak kullanıma sunulan kalıbın 635 MB boyutlarına kadar küçültülmüş olduğu ifade edildi. Live ve minimal versiyonlar için tüm paketlerin güncelleştirildiği belirtildi. Antergos 17.12 hakkında ayrıntılı bilgi edinmek için sürüm duyurusunu inceleyebilirsiniz.

Continue Reading →

Antergos 17.12 edinmek için aşağıdaki linkten yararlanabilirsiniz.

0

Rocks Cluster 7.0 duyuruldu

Beta sürümü 10 Eylül 2017‘de duyurulan CentOS tabanlı açık kaynak kodlu bir küme çözümü olan Rocks Cluster‘in “Manzanita” kod adlı 7.0 sürümü, Philip Papadopoulos tarafından duyuruldu. CentOS 7.4’e dayalı olarak gelen sistem, 1 Aralık 2017 itibariyle tüm güncelleştirmeleri içeriyor. Rocks 6’dan önemli ölçüde farklı olan yeni sürüm, yalnızca ağa kurulumu destekliyor. Papadopoulos; Rocks Cluster’in (PBS, Maui, GM desteği, Ganglia, vb. gibi) herhangi bir kümeleme yazılım yığınından kurulumun sadeliğinde benzersiz olmasıyla ayrıldığını söyledi. Sürüm duyurusu, sürüm hakkında pek fazla bilgi içermese de Rocks Cluster 7.0 hakkında ayrıntılı bilgi edinmek için kullanım kılavuzunu inceleyebilirsiniz.

Continue Reading →

Rocks Cluster 7.0 edinmek için aşağıdaki linklerden yararlanabilirsiniz.

0

Install, Configure, and Secure FTP Server in Linux

FTP or File Transfer Protocol is a commonly used protocol for transferring files between computers, one act as a client, the other act as a server. In this post, we will talk about the FTP server in Linux systems, specifically Very Secure FTP Daemon (vsftpd). The vsftpd program is a very popular FTP server that is used by many servers today. FTP server works with the client server architecture to communicate and transfer files. FTP is a stateful protocol, that means connections between clients and servers stay open during an FTP session. To send or receive files from an FTP server, you can use FTP commands, these commands are executed consecutively. It is like a queue, one by one.

Continue Reading →

There are two types of FTP connections initiated:

  • Control connection also called a command connection.
  • Data connection.

When you establish an FTP connection, the TCP port 21 opens to send your login credentials, this connection is called control connection.

When you transfer a file, a data connection is started.

There are two types of data connection:

  • Passive mode.
  • Active mode.

Active connections are initiated by the remote server, and the client waits for server requests.

Passive connections initiated by the client to the remote server and the server waits for requests.

When the FTP client starts a transfer, there is an option on your FTP client that controls whether you want to use active or passive FTP connection.

Active Mode

The client connects from a random ephemeral source port to the FTP control port 21.

You can check your ephemeral port range using this command:

$ cat /proc/sys/net/ipv4/ip_local_port_range

When you need to transfer a file, the remote FTP server will open port 20 to connect to the FTP client.

Active mode connections usually have problems with firewalls, TCP ports 20 and 21 should be open on your firewall.

Because of these problems with firewalls of active mode, the passive mode was introduced.

If you are using iptables firewall I recommend you to review Linux iptables firewall to know how to allow specific ports.

Passive Mode

In passive mode, the client starts the control connection from a random port to the destination port 21 on the remote server.

if the FTP client requests a file, it will issue the PASV FTP command. The server will open a random port and give this port number to the client.

That’s why the FTP is a connection-hungry protocol because every time you make a data connection (like transfer a file) the server will do the above process and this is done with all clients connected to the server.

In passive mode, the control and data connections started by the FTP client.

Vsftpd FTP Server Features

There are several FTP servers available for you to use, commercial and open source.

Vsftpd has some security features which makes it on the top like:

  • Can run as a normal user with privilege separation.
  • Supports SSL/TLS FTP connections.
  • Can jail users into their home directories.

FTP Server Setup

Some Linux distros shipped with vsftpd, anyway, if you want to install it on Red Hat based systems, you can use the following command:

$ sudo dnf -y vsftpd

On Debian based distros like Ubuntu, you can install it like this:

$ sudo apt-get install vsftpd

Once you’ve installed the package, you can run the service and enable it to run at boot time.

$ systemctl start vsftpd

$ systemctl enable vsftpd

The configuration file for vsftpd FTP server is /etc/vsftpd/vsftpd.conf file or in Debian based distros, you can find it at /etc/vsftpd.conf .

Actually, the FTP server in Linux is one of the easiest servers that you can work with.

There are two types of accessing the FTP server:

  • Anonymous FTP access: anyone can login with the username anonymous without a password.
  • Local user login: all valid users on /etc/passwd are allowed to access the FTP server.

You can allow anonymous access to FTP server from the configuration, in /etc/vsftpd/vsftpd.conf by enabling anonymous_enable=YES if it is not enabled and reload your service.

Now you can try to connect to the FTP server using any FTP client, I will use the simple FTP command.

You can install it if it’s not on your system:

$ dnf -y install ftp

Now you can access your FTP server like this:

$ ftp localhost

Then type the username anonymous and with no password, just press enter.

You will see the FTP prompt.

ftp>

And now you can type any FTP command to interact with the FTP server.

Connect as Local User

Since there is an option in the settings for allowing local users to access FTP server which is local_enable=YES, now let’s try to access the FTP server using a local user:

$ ftp localhost

Then type your local username and the password for that user and you will see Login successful message.

Setup FTP Server as Anonymous Only

This kind of FTP server is useful if your files should be available for users without any passwords or login.

You need to configure vsftpd to allow only anonymous user.

Open /etc/vsftpd/vsftpd.conf file, and change the following options with the corresponding values.

listen=NO

listen_ipv6=NO

anonymous_enable=YES

local_enable=NO

write_enable=NO

Then we need to create a non-privileged system account to be used for anonymous FTP-type access.

$ useradd -c " FTP User" -d /var/ftp -r -s /sbin/nologin ftp

This user has no privileges on the system, so it is safer to use it when accessing an FTP server.

Don’t forget to restart your FTP server after you modify the configuration file.

You can access the FTP server from the browser, just type ftp://youdomain/

FTP Server Security

We can configure vsftpd to use TLS, so the transferred files over the network is a bit more secure.

First, we generate a certificate request using openssl command:

$ openssl genrsa -des3 -out FTP.key

Then we generate a certificate request:

$ openssl req -new -key FTP.key -out certificate.csr

Now we remove the password from the key file:

$ cp FTP.key FTP.key.orig

$ openssl rsa -in FTP.key.orig -out ftp.key

Finally, we generate our certificate:

$ openssl x509 -req -days 365 -in certificate.csr -signkey ftp.key -out mycertificate.crt

Now we copy the certificate file and the key and to /etc/pki/tls/certs:

$ cp ftp.key /etc/pki/tls/certs/

$ cp mycertificate.crt /etc/pki/tls/certs

Now, all we need to do is to configure vsftpd to support secure connections.

Open / etc/vsftpd/vsftpd.conf file and add the following lines:

ssl_enable=YES

allow_anon_ssl=YES

ssl_tlsv1=YES

ssl_sslv2=NO

ssl_sslv3=NO

rsa_cert_file=/etc/pki/tls/certs/mycertificate.crt

rsa_private_key_file=/etc/pki/tls/certs/ftp.key

ssl_ciphers=HIGH

require_ssl_reuse=NO

Restart your service to reflect these changes. And that’s it.

Try to connect to your FTP server from any client on any system like Windows and choose the secured connection or FTPS, and you will successfully see your folders.

SFTP vs. FTPS

In the last example, we saw the FTP over SSL layer (FTPS) and we’ve successfully connected to the FTP server, however, with the tightly secured firewall, it is difficult to manage this kind of connection since FTPS uses multiple port numbers.

The best solution, in this case, is to use SFTP (FTP over SSH).SFTP uses port 22 only.

This port is used for all connections during FTP sessions.

If you are using a firewall, it’s recommended to choose SFTP, since it needs only one port.

Jailing FTP Users

You can secure your FTP server by jailing your FTP users in their home directories and allow only specific users to access the service.

Open /etc/vsftpd/vsftpd.conf and uncomment the following options:

chroot_local_user=YES

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd.chroot_list

The file /etc/vsftpd.chroot_list contains the list of jailed users one per line.

Save the files and restart your service.

$ systemctl restart vsftpd

Linux FTP Server Commands

You can use any GUI client to upload and download your files, but you need to know some FTP server commands also.

You can print the current working directory using pwd command:

ftp> pwd

You can list files using the ls command:

ftp> ls

Also, you can use the cd command to change the working directory:

ftp> cd /

If you want to exit your FTP session use the bye command:

ftp> bye

lcd command is used to display the local folder, not the FTP folder:

ftp> lcd

You can change the local directory using the lcd command:

ftp> lcd /home

You can download a file using the get command:

ftp> get myfile

Also, you can download multiple files using the mget command:

ftp> mget file1 file2

Use delete command to delete a file from the server:

ftp> delete filename

Use put command to upload a file to the server:

ftp> put filename

To upload multiple files, use the mput command:

ftp> mput file1 file2

You can create a directory using the mkdir command:

ftp> mkdir dirName

Or you can delete a directory from the server using the rmdir command.

ftp> rmdir dirName

There are two modes for file transfer when using FTP server, ASCII mode, and binary mode, you can change the mode like this:

ftp> binary

ftp> ascii

The FTP server is one of the easiest servers in Linux to configure and work with.

I hope you find the post useful and interesting. Keep coming back

Thank you.

likegeeks.com

0

Zenwalk Linux 171202-current çıktı

Slackware Linux tabanlı, Xfce masaüstü ortamıyla sunulan hafif bir dağıtım olan Zenwalk Linux’un 171202-current sürümü çıktı. Henüz resmi duyuruus yapılmamış olan sürüm indirilmek üzere yansılarda yerini aldı. Firefox 57 ile geldiği bildirilen Zenwalk Linux 171202-current; Libreoffice 5.4.3, MPV 0.27.0 gibi güncel paketlerle geliyor. GTK+ 3 ile gelen sistem Zenwalk Linux 171202-current hakkında ayrıntılı bilgi edinmek için değişiklikler sayfasını inceleyebilirsiniz.

Continue Reading →

Zenwalk Linux 171202-current edinmek için aşağıdaki linklerden yararlanabilirsiniz.

0

OpenMediaVault 3.0.94 duyuruldu

Debian GNU/Linux tabanlı ağa bağlı uzman depolama (NAS) çözümü OpenMediaVault’un pek çok iyileştirme ve hata düzeltmesiyle gelen 3.0.94 sürümü duyuruldu. Çeşitli hata düzeltmeleri ve iyileştirmelerle gelen sistem, kullanılmak üzere yansılarda yerini almış bulunuyor. Artık kontrol panelinde IPv6 adreslerinin gösterildiği hatırlatılırken, saat dilimi yapılandırması sorununun giderildiği ve omv-initsystem’de tahmini ağ aygıtı adlarının desteklendiği ifade edildi. Bir NAS (Network Attached Storage) çözümü olan OpenMediaVault’un 3.0.94 sürümünde meydana gelen değişiklikleri görmek için sürüm duyurusunu inceleyebilirsiniz.

Continue Reading →

OpenMediaVault 3.0.94 edinmek için aşağıdaki linkten yararlanabilirsiniz.

0

Install, Configure, and Maintain Linux DNS Server

The DNS (Domain Name System) is a naming system for computers, the service that does that is called DNS server which translates an IP address to human readable address. This process is the backbone of the internet and a very important service in your server, so from that point, we will discuss DNS server or specifically Linux DNS server and how to install, configure and maintain it. Without the need to a DNS server, every system will have to keep its own copy of the table of the host names and their IP addresses. On Linux systems, this table is the /etc/hosts file. So even if you don’t have a DNS server or DNS server is unavailable, this file can translate IP addresses to names using /etc/hosts file. That means the system query this file first before going to DNS server and if it finds the domain, it will translate it without going to any DNS servers.

Continue Reading →

Try to edit /etc/hosts and type the following:

127.0.0.1 google.com

Then go to your browser and type google.com and see the results. If you have Apache server installed on your system and your localhost is running, it will show the index page of the localhost instead of google page.

Linux DNS Server

You can translate google.com to any other IP address of any site and see the result to ensure that.

So what this file is doing is translating IP addresses to names, but this for the same connected network, so what about the outside networks and how to maintain all those records for all systems?

Will everybody manage his own /etc/hosts file and update it himself? Of course not.

Domain Names

When you visit a website, you type the FQDN (Fully Qualified Domain Name) or the domain name like this: likegeeks.com or www.google.com

Each domain consists of domain components, the dot separates these components.

The text com is the top-level domain component and google is the second-level domain component and www is the third-level domain component

Actually, when you visit any website the browser silently adds a dot at the end, but not visible to you, so the domain will be like www.google.com. Notice the dot after .com, this dot is called the root domain.

But why this root domain or the dot is added?

Because this dot is served by the root name servers. At the time of this post, there are 13 root name servers in the world, you can think of them as the brain of the internet, if they go OFF the world will be without the internet.

And why 13?

Because maybe an earthquake in one place of the world might destroy a root server so the others serve until the damaged server become online.

Those root name servers are named like this: a.root-server.net, b.root-server.net, and so on.

Top Level Domain Names (TLDs)

We saw a top level domain component such as com domains.

Top level domains (TLDs) are divided into categories based on geographical or functional aspects.

There are more than 800 top level domains on the web at the time of writing this post.

The top level domains categories are:

  • Generic top-level domain like (.org, .com, .net, .gov, .edu and so on).
  • Country-code top-level domains like (.us, .ca and so on) corresponding to the country codes for the United States and Canada respectively.
  • New branded top-level domains like (.linux, .microsoft, .companyname and so on).
  • Infrastructure top-level domains like .arpa domain.

Subdomains

When you visit a website like mail.google.com the mail here is a subdomain of google.com.

Only the name servers for mail.google.com know all the hosts existing beneath it, so google answers if there is mail subdomain or not, the root name servers have no clue about that.

Types of DNS Servers

There are three types of DNS servers:

  • Primary DNS servers: They contain the domain’s configuration files and they respond to the DNS queries.
  • Secondary DNS server: They work as a backup and load distribution. Primary servers know the existence of the secondary name servers and send updates to them.
  • Caching DNS server: All they do is caching the DNS responses so you don’t need to ask the primary or secondary DNS server again. You can make your system work as a caching server easily as we will see later on this post.

Setting up Linux DNS Server

There are many packages on Linux that implement DNS functionality, but we will focus on BIND DNS server. It is used on most DNS servers worldwide.

If you are using Red Hat based distro like CentOS, you can install it like this:

$ dnf -y install bind

Or on Debian based systems like Ubuntu:

$ apt-get install bind9

Once the installation completed, you can start it and enable it to run at boot time.

$ systemctl start named

$ systemctl enable named

Configuring BIND

The service configuration is /etc/named.conf file.

There are some statements that BIND uses in that file like:

options                 used for global BIND configuration.

logging                 what can be logged and what can be ignored. I recommend you to review Linux syslog server.

zone                      define DNS zone.

include                 to include another file in named.conf.

From the options statement, you can see that the working directory for BIND is /var/named directory.

The zone statement enables you to define a DNS zone.

Like the domain google.com which has also subdomains like mail.google.com and analytics.google.com and other subdomains.

Every one of these three (the domain and subdomains) has a zone defined by the zone statement.

 

Defining a Primary Zone

We know from the DNS server types that there are primary, secondary and cache DNS servers.

Primary and secondary are considered equally authoritative in their answers, unlike caching server.

To define a primary zone in /etc/named.conf  file you can use the following syntax:

zone "likegeeks.com" {

type master;

file likegeeks.com.db

};

The file that contains the zone information is located in /var/named directory since this is the working directory as we know from the options.

Note that the server software or the hosting panel you’re using creates this file with this name automatically for you, so if your domain is example.org, the file will be /var/named/example.org.db.

The type is master which means this is a primary zone.

Defining a Secondary Zone

The same as the primary zone definition with little change.

zone "likegeeks.com" {

type slave;

masters Primary Nameserver IP Address Here; ;

file likegeeks.com.db

};

On the secondary zone, the domain is the same as the primary zone and the type slave here means this is a secondary zone, and the masters option to list the IP addresses of the primary nameserver and finally, the file is the path of the primary’s zone files.

Defining a Caching Zone

It is necessary but not required to have a caching zone, so you decrease the queries on the DNS server.

To define a caching zone, you need to define three zone sections the first one:

zone "." IN {

type hint;

file "root.hint";

};

The first line contains a dot which is the root name servers. The type hint; which means a caching zone entry, and the file “root.hints”; specifies the file that contains the root servers ( the 13 root name server). You can get the latest root name server from http://www.internic.net/zones/named.root

The second zone defined in the /etc/named.rfc1912.zones file and included in /etc/named.conf via include directive which is already included by default.

zone "localhost" IN {

type master;

file "localhost.db";

};

The third zone defines the reverse lookup for the localhost.

zone "0.0.127.in-addr.arpa" IN {

type master;

file "127.0.0.rev";

};

Putting these three zones on /etc/named.conf will make your system work as a caching DNS server. Now you should type the content of the files referenced like likegeeks.com.db, localhost.db, and 127.0.0.rev

These files contain the DNS record types for each zone with some options. So what are those DNS record types and how they are written?

DNS Records Types

The database files consist of record types like SOA, NS, A, PTR, MX, CNAME and TXT.

So let’s start with each record type and see how it is written.

SOA: Start of Authority Record

The SOA record describes the site’s DNS entries with the following format:

example.com. 86400 IN SOA ns1.example.com. mail.example.com. (

2017012604 ;serial

86400 ;refresh, seconds

7200 ;retry, seconds

3600000 ;expire, seconds

86400 ;minimum, seconds

)

The first line starts with the domain example.com. and ends with a period. Which is the same as the zone definition in /etc/named.conf file.

Keep in mind that DNS configuration files are extremely picky.

The IN word means Internet record.

The SOA word means Start of Authority record.

The ns1. example.com. is the domain’s name server.

The mail.host.com. is the domain administrator email. You may notice there is no @ sign and it is replaced with the period, and there is a trailing period.

Line 2 is the serial number which is used to tell the name server about the file update time, so if you make a change to the zone data, you have to increment this number. The serial number has the format YYYYMMDDxx where xx is starting from 00.

Line 3 is the refresh rate in seconds. How often secondary DNS servers should query the primary server to check for updates.

Line 4 is the retry rate in seconds. This is the time that the secondary DNS server takes for waiting after trying to connect to the primary DNS server and cannot reach it. The specified number of retry seconds.

Line 5 is the expire directive. If the secondary server cannot connect to the primary server for an update, it should discard the value after the specified number of seconds.

Line 6 tells the caching servers can’t connect to the primary DNS server, they wait before expiring an entry, this line defines the wait time.

NS: Name Server Records

You can use the NS record to specify the name servers for a zone.

You can write NS records like this:

IN NS ns1.example.com.

IN NS ns2.example.com.

It is not required to have 2 NS records, but it is preferred to have backup name servers.

A and AAAA: Address Records

The A record maps the hostname to an IP address:

support IN A 192.168.1.5

If you have a host at support.example.com on address 192.168.1.5, you can type like the above example.

Note: the host is written without a period.

PTR: Pointer Records

The PTR record is for doing the reverse name resolution, you give an IP address and it returns the hostname.

This is the opposite of what A record does.

192.168.1.5 IN PTR support.example.com.

Here we type the full host name with the trailing period.

MX: Mail Exchange Records

The MX record tells about the mail server records.

example.com. IN MX 10 mail

The domain ends with a period, the number 10 is the importance of the mail server, if you have multiple mail servers, the lower number is the less important.

CNAME: Canonical Name Records

CNAME records are like shortcuts for host names.

Suppose you have a site that has a hostname of whatever-bignameis.example.com and since the system is a web server, an alias of www or CNAME record can be created for the host.

So you can create a CNAME record to make the name www.example.com:

whatever-bignameis IN A 192.168.1.5

www IN CNAME whatever-bignameis

The first line tells the DNS server about the location of the alias, the second line creates the alias that points to www.

TXT Records

You can put any text on TXT records like your contact information or any other information you want the people to know when they query your DNS server.

You can write TXT records like this:

example.com. IN TXT " YOUR INFO GOES HERE"

Also, you can use the RP record to put the contact information.

example.com. IN RP mail.example.com. example.com.

DNS TTL Value

In /etc/named.conf on the top there is $TTL entry.

This entry informs BIND about the time to live value for each individual record.

It takes a value in seconds like 14400 seconds (4 hours), so the DNS servers will cache your zone up to four hours then will query your DNS server again.

You can lower the value, but the default value is fair. Unless you know what you are doing.

Catching Configuration Errors

When you write your zone files, maybe you forget a period or space or any other error.

You can diagnose your Linux DNS server errors from the log. The BIND service through errors in /var/log/messages, you can use the tail command to view real-time error log using -f option.

$tail -f /var/log/messages

So when you write a zone file or modify /etc/named.config and restart your service and it shows an error, you can easily identify the error from the log.

Host Command

After you have successfully added or modified your records, you can use the host command to see if your host if resolved correctly.

If you give it a hostname, it will answer with the corresponding IP addresses.

$ host example.com

Also, you can perform reverse lookups.

$ host 192.168.1.5

You can check the host and dig command

Whois Command

The whois command is used to get the domain owner’s details.

Also, the owner’s email addresses, and contact phone numbers.

$ whois example.com

The rndc Command

The rndc tool can be used to manage the name server securely.

You can check the status of the Linux DNS server like this:

$ rndc status

Also, if you make a change to any of the zone files, you can reload the service without restart the named service.

$ rndc reload example.com

Here we reload the example.com zone file.

You can reload all zones like this:

$ rndc reload

Or maybe you add new zones or change the configuration of the service, you can reload the configuration like this:

$ rndc reconfig

Linux DNS resolver

We’ve seen how a Linux DNS server works and how to configure it. The other part is the client who is contacting the DNS server.

The client is the resolver, you can check the configuration file /etc/resolv.conf

On Debian based distros, you can check /etc/resolvconf/resolv.conf.d/ directory.

The /etc/resolv.conf file contains the local DNS servers that the system uses.

The first line is used for the default search domain, and the second line indicates the IP address of the name server.

You can use your own DNS server once your BIND service running, just type them in the resolver.conf file.

Working with Linux DNS server is pretty easy. I hope you find the post useful and easy.

Thank you.

likegeeks.com

0