passwd
command, set a new password;exec /sbin/init
command, the download continues.pacman-Sy
, pacman-key --populate
;pacman -S pacman
, pacman-db-upgrade;
pacman -S tcpdump strace.
systemctl start openvpn@openvpn
command. # openssl x509 -in ca.crt -noout -text Certificate: Data: Version: 3 (0x2) Serial Number: 12767824280512002782 (0xb1306c894a867ade) Signature Algorithm: sha1WithRSAEncryption Issuer: C=RU, ST=Moscow, L=Moscow, O=Yandex, OU=Root, CN=root.yandex.com Validity Not Before: Apr 6 16:43:09 2015 GMT Not After : Apr 5 16:43:09 2016 GMT Subject: C=RU, ST=Moscow, L=Moscow, O=Yandex, OU=Root, CN=root.yandex.com Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (1024 bit) Modulus: 00:a3:2b:01:a7:04:75:30:42:d4:f3:2d:be:6e:86: b8:7e:79:14:40:43:24:30:1b:30:a0:fa:7e:17:5b: 3b:7c:33:e8:97:fc:e1:b1:e1:00:86:e0:68:ca:86: 2f:4d:ab:38:66:e3:5f:80:8c:f0:79:72:77:54:dc: e7:b9:8f:52:eb:72:f5:af:c5:ed:a7:d7:91:46:ee: 13:d2:2c:6e:5d:1d:ef:7b:a7:3a:63:29:59:9a:f0: e9:1c:ad:47:3a:59:62:1c:71:9e:3c:16:55:76:d5: 90:9e:50:5b:a4:b6:1b:6a:10:30:c4:13:0d:42:c4: 49:f0:1e:02:32:76:7c:a7:97 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Subject Key Identifier: 06:FB:29:15:D7:71:15:5B:D5:F1:09:39:DC:2E:32:D5:61:55:FC:DD X509v3 Authority Key Identifier: keyid:06:FB:29:15:D7:71:15:5B:D5:F1:09:39:DC:2E:32:D5:61:55:FC:DD DirName:/C=RU/ST=Moscow/L=Moscow/O=Yandex/OU=Root/CN=root.yandex.com serial:B1:30:6C:89:4A:86:7A:DE X509v3 Basic Constraints: CA:TRUE Signature Algorithm: sha1WithRSAEncryption 9a:f3:64:f2:20:1b:57:8f:98:32:af:fd:a3:19:0c:78:1e:91: c4:bb:3d:9b:a8:e1:63:20:0f:b8:02:3f:75:48:56:49:7f:83: f8:19:d1:71:bb:07:58:ae:2b:6b:d1:bf:ae:23:35:cd:ea:db: e4:10:f5:6a:93:33:dd:f6:8e:37:6c:9d:14:91:81:d2:d8:63: 96:0a:ff:29:77:e0:69:45:e3:a7:5e:50:b2:51:21:b3:28:59: 22:01:01:4d:a9:3e:d0:14:24:92:1e:7e:70:50:2f:26:11:82: 66:a6:a3:af:a9:b6:23:c0:e2:c7:79:85:dc:4c:bb:9d:2c:75: 18:35
# openssl req -out cert.csr -new -nodes Country Name (2 letter code) [AU]:RU State or Province Name (full name) [Some-State]:Moscow Locality Name (eg, city) []: Organization Name (eg, company) [Internet Widgits Pty Ltd]:Yandex Organizational Unit Name (eg, section) []:Root Common Name (eg server FQDN or YOUR name) []:10.0.0.15 Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
# mkdir /etc/ssl/newcerts # echo 01 > /etc/ssl/serial # touch /etc/ssl/index.txt
# openssl ca -cert ca.crt -keyfile ca.key -in cert.csr -out cert.crt Using configuration from /etc/ssl/openssl.cnf Check that the request matches the signature Signature ok The stateOrProvinceName field needed to be the same in the CA certificate (Moscow) and the request (Moscow)
string_mask
parameter in the [req]
section to pkix
. # mv privkey.pem cert.key # cat ca.crt >> cert.crt
(pacman -S nginx)
and enable SSL in /etc/nginx/nginx.conf% , uncommenting the appropriate section of the server {} . # nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful # systemctl restart nginx
openssl dhparam -out dhparam.pem -outform PEM -2 2048
;systemctl restart nginx.
There is a MariaDB database in / var / lib / mysql. We had access there with login checker and master key, but something went wrong.BTW, the `data` table structure was: +-------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | name | text | YES | | NULL | | | hits | int(11) | YES | | NULL | | | size | int(11) | YES | | NULL | | +-------+---------+------+-----+---------+-------+
pacman -S mariadb
and try to start systemctl start mysqld
. From the logs it is clear that mysqld is looking for files in the wrong place. From the configuration file /etc/mysql/my.cnf
can see that the system’s operation in the network mode is broken - skip-networking , bind-address options are added, the wrong datadir value is specified. To save time, we will not attempt to repair the configuration file; instead, replace it with a known working: [mysqld] key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M tmpdir = '/var/tmp'
chown -R mysql:mysql /var/lib/mysql
, and try to start the database again - systemctl restart mysqld
. # mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
mysqld: systemctl stop mysqld
;echo "UPDATE mysql.user SET password = PASSWORD('root') where user = 'root';" > /tmp/reset.sql
echo "UPDATE mysql.user SET password = PASSWORD('root') where user = 'root';" > /tmp/reset.sql
;mysqld --user=mysql --init-file=/tmp/reset.sql
;Ctrl-\
;systemctl start mysqld
root
. Let's try: mysql -ppassword -uroot
. From the output of the show databases
command, we see the existence of the db
database, but there is no data
table in it. However, this table is on disk (/var/lib/mysql/db/data.ibd)
. Not enough table definition (data.frm). create table data2 (name text, hits int(11), size int(11));
alter table data2 discard tablespace;
, substitute it filled with mv data.ibd data2.ibd
and connect back to alter table data2 import tablespace;
.drop table db.data
. You will have to create a temporary database, transfer a new table to it, delete the old one, and then create it again: rename table db.data2 to db2.data; drop database db; create database db character set utf8; rename table db2.data to db.data; alter table db.data engine = innodb;
grant all privileges on db.* to 'checker'@'%' identified by 'masterkey';
. Unfortunately, the test fails due to a connection error. A check with tcpdump indicates that mysqld is not responding. Let's check the firewall with iptables-save
and find the problem left by the villain — erroneous rules have been added to the nat table. However, removing them briefly restores the network - the rules appear again.(crontab -l, cat /etc/cron.* /etc/crontab /etc/cron.d/*)
and delete all the tasks of the current user (crontab -r)
.Run 1.exe
# find / -iname 1.exe /root/1/1.exe # file /root/1/1.exe /root/1/1.exe: PE32 executable (console) Intel 80386 Mono/.Net assembly, for MS Windows
(pacman -S mono)
and try to run our program: # cd /root/1 # mono 1.exe
Name: Binary Status: uncompleted Output: bad program
binutils
software binutils
and apply the strings program to the 1.exe file. One piece of output is similar to the list of libraries used by the program: System.Core mscorlib System.Xml dnAnalytics
(pacman -Ql mono)
.There is a database in /var/lib/db.tar.gz.
Make a root. Features a collection of 2 shards
pacman -S mongodb
. The organizers left the archive with the base, unpack it and make an archive copy: cd /var/lib/mongodb tar jxf /var/lib/db.tar.bz2 mongod --dbpath db mongodump rm -rf db
mkdir -p /data/configdb mongod --configsvr &
mongos --configdb localhost &
. The task is to raise two shards, so we will prepare two mongod instances: mkdir /var/lib/mongodb/s1 /var/lib/mongodb/s2 mongod --dbpath /var/lib/mongodb/s1 --port 30001 --nojournal & mongod --dbpath /var/lib/mongodb/s1 --port 30002 --nojournal &
# mongo mongos> sh.addShard("localhost:30001") mongos> sh.addShard("localhost:30002") mongos> sh.enableSharding("root")
mognorestore --port 30001 dump/
. # mongo root mongos> db.features.ensureIndex({"_id":"hashed"}) mongos> sh.shardCollection("root.features", {"_id":"hashed"}) mongos> sh.enableBalancing("root.features")
Set up an echo server on port 13000.
0x0010: 0a00 000f ebee 32c8 0012 ffd6 656e 6574 ......2.....enet 0x0020: 2065 7272 6f72 .error
enet
leads to a site that describes the implementation of the enet protocol, which allows you to send data streams via UDP without worrying about packet loss (as in TCP).pyenet
library, binding to the enet for the Python language, which is just right for our task. Let's write a simple program: import enet import sys host = enet.Host(enet.Address(b'0.0.0.0', 13000), 100, 0, 0) while True: evt = host.service(0) if evt.type == enet.EVENT_TYPE_RECEIVE: data = evt.packet.data evt.peer.send(0, enet.Packet(data))
pacman -S git git clone git://github.com/aresch/pyenet cd pyenet git clone git://github.com/lsalzman/enet pacman -S cython base-devel python setup.py build python setup.py install
There is a / root / file inside your image. Find a good root.txt file and make it available via image_ip / root.txt .
# file /root/file /root/file: LVM2 PV (Linux Logical Volume Manager), UUID: XT6zLL-YAUv-nmA9-BSrw-2pBV-CTi2-vqKe35, size: 31457280
losetup /dev/loop0 /root/file
# vgchange -ay 1 logical volume(s) in volume group "VolGroup00" now active
mount /dev/mapper/VolGroup00-lv0 /mnt ls /mnt
gunzip /mnt/root.txt.gz
. umount /mnt mount /dev/mapper/VolGroup00-lv0 /usr/share/nginx/html/
# file -s /dev/dm-0 /dev/dm-0: BTRFS Filesystem sectorsize 4096, nodesize 4096, leafsize 4096)
# pacman -S btrfs-progs # btrfs subvolume list /usr/share/nginx/html/ ID 256 gen 14 top level 5 path root ID 257 gen 11 top level 5 path root_1
umount /usr/share/nginx/html mount -t btrfs -o subvol=root_1 /dev/mapper/VolGroup00-lv0 /usr/share/nginx/html/
/usr/share/nginx/html/root.txt.gz
The repaired MariaDB is slow. Tune it up.
mysql -u root -ppassword db mysql> set global slow_query_log = ON; mysql> set global long_query_time = 1;
tail /var/lib/mysql/shannon-slow.log
.SELECT COUNT(*) FROM db.data WHERE size < 10;
. mysql> explain SELECT COUNT(*) FROM db.data WHERE size < 10 \G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: data type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 25061163 Extra: Using where 1 row in set (0.00 sec)
mysql> create index data_size on data(size);
./root/repo mercurial
repository, for which we need to correct the story and make it available via http.There is a HG repository in / root / repo.
Drop all .gz files in all revisions available via ip : 8000 /
pacman -S mercurial
. You can change the history using the convert module, which is disabled by default. Turn it on: # cat <<EOF > ~/.hgrc [extensions] hgext.convert= EOF
filemap
. We write and apply a rule that throws out a file 2.osm.gz : echo 'exclude "2.osm.gz"' > /root/fmap hg convert --filemap ~/fmap /root/repo /root/repo1
cd /root/repo1 hg serve
We got a strange file in ~ tester / file. No one can change it. Fix it.
# echo test >> ~tester/file -bash: /home/tester/file: Permission denied
# mount | grep ' on / ' /dev/sda2 on / type ext4 (rw,relatime,data=ordered)
(man 5 ext4)
you can find out that files on this file system can havechattr -i ~tester/file
. Problem solved.Source: https://habr.com/ru/post/255449/
All Articles