scroll_behavour

https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior
Płynne przewijanie zawartości pojemnika

<nav>
  <a href="#page-1">1</a>
  <a href="#page-2">2</a>
  <a href="#page-3">3</a>
</nav>
<scroll-container>
  <scroll-page id="page-1">1</scroll-page>
  <scroll-page id="page-2">2</scroll-page>
  <scroll-page id="page-3">3</scroll-page>
</scroll-container>
a {
  display: inline-block;
  width: 50px;
  text-decoration: none;
}
nav, scroll-container {
  display: block;
  margin: 0 auto;
  text-align: center;
}
nav {
  width: 339px;
  padding: 5px;
  border: 1px solid black;
}
scroll-container {
  display: block;
  width: 350px;
  height: 200px;
  overflow-y: scroll;
  scroll-behavior: smooth;
}
scroll-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 5em;
}

Babel

# mkdir babel_test
# cd babel_test && npm init
package name: (babel_test)
version: (1.0.0)
description:
entry point: (index.js)
test command: echo "Error: no test specified" && exit 1
git repository:
keywords:
author:
license: (ISC)
About to write to D:\JS\nodejs\babel_test\package.json:

{
  "name": "babel_test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Is this ok? (yes)

Instalacja babel

# npm install --save-dev babel-cli

Podmienić w package.json właściwość scripts:

"scripts": {
    "build": "babel src -d lib"
}

Apache SSL

# cd /etc/apache2
# a2enmod ssl
# a2ensite default-ssl
# systemctl reload apache2
# mkdir /etc/apache2/ssl
# openssl req -x509 -nodes -days 1825 -newkey rsa:2048 
  -keyout /etc/apache2/ssl/apache.key 
  -out /etc/apache2/ssl/apache.crt
# chmod 600 /etc/apache2/ssl/*

# nano /etc/apache2/sites-enabled/default-ssl.conf

default-ssl.conf

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerAdmin webmaster@localhost
        ServerName bambino.pl:443
        DocumentRoot /var/www/html/bambino/webroot
        . . .
        SSLEngine on
        . . .
        SSLCertificateFile /etc/apache2/ssl/apache.crt
        SSLCertificateKeyFile /etc/apache2/ssl/apache.key
# service apache2 reload
# openssl s_client -connect intranet.int:443

HTTP Content Security Policy

Nagłówek odpowiedzi. Serwer informuje przeglądarkę które skrypty z jego domeny mogą być dołączone

Content-Security-Policy: <policy-directive>; <policy-directive<
// header
Content-Security-Policy: default-src https:

Content-Security-Policy: default-src https: 'unsafe-eval' 'unsafe-inline'; object-src 'none'

// meta tag
<meta http-equiv="Content-Security-Policy" content="default-src https:">

Dyrektywy:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy

nmap

Inwentaryzacja IP – sprawdzenie listy hostów

# nmap -sP -oA 20171219_host_scan

Skanowanie portów

# nmap -iL lista-ip.txt -sS -sV --version-all -r -T4 
       --webxml -oA 20191220_port_scan

Uruchomienie skryptów

# nmap -iL lista-ip.txt -Pn -A -T4 -v --script all 
          -oN 20180110_script_scan

SKRYPTY – opcje

# nmap -sC                 <- domyślna lista skrtypów
# nmap -A                  <- dodane do agresywnego skanowania
# nmap --script [KATEGORIA | all]
# nmap --script [KATEGORIA] --script-args [ARGS] 
       --script-args-file [OPTION]
# nmap -sn -sC             <- skrypty bez skanowania portów
# nmap -sn -Pn -sC         <- bez portów i bez hostów

Kategorie skryptów

auth    <- autoryzacja
broadcast   <- host discovery, nie uzgl. na liście
brute   <- atak brute force na autentykację
default   <- -sC lub -A lub --script=default
discovery   <- większa analiza sieci: snmp, http, smb
dos   <- atak dos, może uszk. system
exploit   <- próba włamania
externalt   <- łączy się z innymi serwisami np. whois
fuzzer   <- wysyła śmieci, długotrwały, duże obciążenie sieci
intrusive   <- duże ryzyko awarii systemu
malware   <- testują czy system zarażony malwarem lub backdorem
safe   <- bez awarii, włamań, dużego obciążenia
version   <- włączane tylko jako opcje -sV
vuln   <- sprawdzają znane podatności, tylko raportują

mod_rewrite

Włączenie modułu mod_rewrite

# a2enmod rewrite
# systemctl restart apache2

# editor /etc/apache2/apache2.conf

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Lub

<VirtualHost *:80>
    <Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>

    . . .
</VirtualHost>

sql – update z podzapytaniem

Tabela łącząca posiada wpisy powiązane z usuniętymi rekordami suits. Dla tych rekordów zerujemy klucz obcy.

 UPDATE ingredients_suits si SET suit_id = 0 WHERE NOT EXISTS (
        SELECT id FROM suits s WHERE s.id = si.suit_id
);

Można skasować rekordy tabeli łączącej które mają wyzerowany klucz obcy

DELETE FROM ingredients_suits WHERE suit_id=0;

Apache – włączenie ssl

Zakładając istnienie openSSL

# apt-get upgrade openssl
# a2enmod ssl
-----------------
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
  systemctl restart apache2
# a2ensite default-ssl
-----------------
Enabling site default-ssl.
To activate the new configuration, you need to run:
  systemctl reload apache2
# service apache2 reload

Debian – releases

Nazwy kodowe i wersje

Debian  "buster" - następna
Debian 9 ("stretch") — current stable release
Debian 8 ("jessie") — obsolete stable release
Debian 7 ("wheezy") — obsolete stable release
Debian 6.0 ("squeeze") — obsolete stable release
Debian GNU/Linux 5.0 ("lenny") — obsolete stable release 

Sprawdzenie nazwy

uname -a
Linux bora 4.9.0-3-686-pae #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) i686 GNU/Linux

MySQL – install, config – linux

# apt-get install mysql-server

Konfiguracja poinstalacyjna np. ustawienie haseł

# mysql_secure_installation
# mysql -u root -p

Utworzenie bazy danych, użytkownika i uprawnienia

> create database testdb;
> create user 'tester'@'localhost' identified by 'mypass';
> grant all on testdb.* to 'tester';

Utworzenie usera w czasie przydzielania uprawnień

> grant all on testdb.* to 'testuser' identified by 'mypassword';

Sprawdzenie uprawnień

> show grants for testuser;