/etc/ssh/sshd_config
Port 22 (or) 1234
PermitRootLogin no (or) without-password
PasswordAuthentication no
AllowGroups some-group
ssh access
($ sudo service ssh restart)
Slide 16
Slide 16 text
firewall
network
Slide 17
Slide 17 text
sudo iptables -L -v
firewall
Slide 18
Slide 18 text
firewall
sudo iptables -A INPUT -i lo \
-j ACCEPT
sudo iptables -A INPUT -m conntrack \
—ctstate RELATED,ESTABLISHED -j ACCEPT
Slide 19
Slide 19 text
firewall
sudo iptables -A INPUT -p tcp --dport 22 \
-j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 \
-j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 \
-j ACCEPT
sudo iptables -A INPUT -j DROP
Slide 20
Slide 20 text
firewall
Slide 21
Slide 21 text
firewall
drop v reject
default policy
$ iptables … -j REJECT
$ iptables \
--policy INPUT DROP
supervisord
fid@spr:~# sudo systemctl status supervisor
● supervisor.service - Supervisor process control system for
UNIX
Loaded: loaded (/lib/systemd/system/supervisor.service;
disabled; vendor preset: enabled)
Active: active (running) since Tue 2016-07-26 17:13:54 EDT;
3s ago
Docs: http://supervisord.org
Main PID: 3712 (supervisord)
Tasks: 1
Memory: 11.1M
CPU: 216ms
CGroup: /system.slice/supervisor.service
!"3712 /usr/bin/python /usr/bin/supervisord -n -c /
etc/supervisor/supervisord.conf
Jul 26 17:13:54 spr systemd[1]: Started Supervisor process
control system for UNIX.
network: mysql
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 10.136.11.155
f@db:~$ mysql -h localhost -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
f@db:~$ mysql -h 127.0.0.1 -u root -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on
'127.0.0.1' (111)
✅
Slide 64
Slide 64 text
network: mysql
f@db:~$ mysql -h 10.136.11.155 -u root -p
Enter password:
ERROR 1130 (HY000): Host '10.136.11.155' is not allowed
to connect to this MySQL server
f@db:~$ mysql -u root -p -e "create user root@'10.136.11.155'
identified by 'root';"
Enter password:
f@db:~$ mysql -h 10.136.11.155 -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
✅
Slide 65
Slide 65 text
network
but normally it is
Slide 66
Slide 66 text
1.Find networks (interfaces)
2.Learn about socket types
3.See examples of mysql
4.Future: Permissions in Forge
network
review
Slide 67
Slide 67 text
Permissions
Slide 68
Slide 68 text
who can do things
user - file/dir owner
group - file/dir group - shared
permissions!
other - anyone else
Slide 69
Slide 69 text
what can they do
read - read file, list directory
write - write to file, add new file/dir
execute - execute command, cd into
pkg managers
search
sudo apt search mysql-server
ubuntu@host:~$ apt search mysql-server
mysql-server/trusty-updates,trusty-security 5.5.49-0…
mysql-server-5.5/trusty-updates,trusty-security
MySQL database server binaries and system database setup
mysql-server-5.6/trusty-updates,trusty-security
MySQL database server binaries and system database setup
Slide 93
Slide 93 text
pkg managers
show
sudo apt show -a \
mysql-server-5.6
Package: mysql-server-5.6
Version: 5.6.30-0ubuntu0.14.04.1
Package: mysql-server-5.6
Version: 5.6.16-1~exp1
pkg managers
ubuntu@host: /etc/apt $ vim sources.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ xenial main restricted
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ xenial main restricted
# # Major bug fix updates produced after the final release of the
# # distribution.
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ xenial-updates main \
restricted
# # N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
# # team. Also, please note that software in universe WILL NOT receive any
# # review or updates from the Ubuntu security team.
deb http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ xenial universe
deb-src http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ xenial universe
included repositories
Slide 100
Slide 100 text
pkg managers
repositories
Slide 101
Slide 101 text
–@fideloper
“Am I done now?”
Slide 102
Slide 102 text
DNS & Domains
Slide 103
Slide 103 text
DNS: ¯\_(ツ)_/¯
~~ just *TRY* ~~
to coherently explain
controlling domains
to the average [non-tech-client-whoever]
challenge:
Slide 104
Slide 104 text
¯\_(ツ)_/¯
(we’ll ignore the seedy
secondary market of
domain-squatting asshats)
Slide 105
Slide 105 text
you bought a domain
DNS
Slide 106
Slide 106 text
…but you control it somewhere else
DNS
Slide 107
Slide 107 text
DNS
“somewhere else” points [sub]domains…
somewhere else…
Slide 108
Slide 108 text
this slide intentionally left blank
Slide 109
Slide 109 text
dig
Slide 110
Slide 110 text
dig
mx records
Slide 111
Slide 111 text
nslookup
mx records again
Slide 112
Slide 112 text
Domains + Web Server
Slide 113
Slide 113 text
Domains + Web Server
Slide 114
Slide 114 text
set host header
Slide 115
Slide 115 text
default_server
Slide 116
Slide 116 text
(set host header again)
Slide 117
Slide 117 text
meanwhile, fideloper.com
Slide 118
Slide 118 text
Logs
Slide 119
Slide 119 text
/var/log/*
Slide 120
Slide 120 text
wtf, Vagrant?
less
terrible.
Slide 121
Slide 121 text
fideloper@host ~ vagrant box
Usage: vagrant box []
Available subcommands:
add
list
outdated
remove
repackage
update
boxes (servers)
Slide 122
Slide 122 text
where’s my stuff?
~/.vagrant.d/boxes
~/.vagrant.d/tmp
C:/Users/[USER]/.vagrant.d/boxes
C:/Users/[USER]/.vagrant.d/tmp
Slide 123
Slide 123 text
• ssh by default
• can add your own (but we’ll do better)
port forwarding
SSH Default
Slide 124
Slide 124 text
port forwarding
$ vagrant ssh-config
Just like ~/.ssh/config
adding projects
2. Create another server config
vagrant@vagrant:/etc/nginx/sites-available$ sudo cp \
laravel-a laravel-b
vagrant@vagrant:/etc/nginx/sites-available$ sudo vim \
laravel-b
server {
listen 80;
server_name laravel-b.dev;
…
Slide 145
Slide 145 text
adding projects
3. Edit /etc/hosts:
1 ##
2 # Host Database
3 #
4 # localhost is used to configure the loopback interface
5 # when the system is booting. Do not change this entry.
6 ##
7 127.0.0.1 localhost
8 255.255.255.255 broadcasthost
9 ::1 localhost
10
11 192.168.33.10 laravel-a.dev laravel-b.dev
Slide 146
Slide 146 text
adding projects
A better way:
Slide 147
Slide 147 text
adding projects
1. One File Share
config.vm.synced_folder "~/Sites", "/home/vagrant/Sites"
adding projects
2. DNSMasq continued
fideloper@Christophers-iMac ~ dig whatever-i-want.dev \
@127.0.0.1
;; QUESTION SECTION:
;whatever-i-want.dev. IN A
;; ANSWER SECTION:
whatever-i-want.dev. 0 IN A 192.168.33.10
Slide 150
Slide 150 text
adding projects
3. Magic Nginx Config
server {
listen 80;
server_name ~^(.*)\.dev$;
set $file_path $1;
root /home/vagrant/Sites/$file_path/public;
index index.html index.htm index.php;
# And so on …
Slide 151
Slide 151 text
adding projects
cd ~/Sites
mkdir -p ~/mysite/public
echo “ mysite/public/index.php