Showing posts with label Πλαστικά σκατά. Show all posts
Showing posts with label Πλαστικά σκατά. Show all posts

Friday, August 29, 2025

MacOS VM hints

Useful obscure projects for MacOS virtualization: 

  • UTM (https://mac.getutm.app/)
  • QuickEmu (https://github.com/quickemu-project)
  • Tart (https://tart.run/) 

Nothing works perfectly, except (I've heard) Parallels, which I haven't yet tried.

VMWare fusion sucks. Virtualbox sucks more.

UTM is quite nice. QuickEmu and Tart lack a GUI.

Tart supplies images with xcode preinstalled, so you won't need to use the app store. 

Tips from QuickEmu (haven't tried them in others):

 sudo trimforce enable

Enables SSD TRIM commands on the guest, helping qemu to shrink the QCOW image. Comes complete with a scary screenful of warnings that can be safely ignored, we're in a VM dude. Might not always work, google it.

MacOS VMs will usually be blocked from logging in with Apple IDs by default, due to the Serial, MAC Address, and other information being shared between multiple VMs.

To fix this, you can use this tool to replace or randomize these values in the bootloader.

 https://github.com/quickemu-project/qe_mac_apid

If you see "Your device or computer could not be verified" when you try to login to the App Store, make sure that your wired ethernet device is en0. Use ifconfig in a terminal to verify this.

If the wired ethernet device is not en0, then then go to System Preferences -> Network, delete all the network devices and apply the changes. Next, open a terminal and run the following:

sudo rm /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist

Now reboot, and the App Store should work.

Tips from UTM: 

How to resize MacOS VM image (from https://github.com/utmapp/UTM/issues/4186#issuecomment-2163220345):

If you want to be able to increase the size of your disk image while retaining the ability to upgrade your OS, the Apple_APFS_Recovery partition must be relocated to the end of the disk before expanding the main Apple_APFS container.

So far the only ready-made solution I have found is the Tart packer plugin from the Tart project by cirruslabs which allows for automated VM creation and has the option to automatically resize disk images (see the recovery_partition = "relocate" option).

More information on the projects can be found below:
https://github.com/cirruslabs/tart
https://github.com/cirruslabs/packer-plugin-tart/tree/main

Since I wanted to continue using UTM and simply needed a standalone tool to relocate the partition, I created a small tool based on their code. Understand that it come with no guarantee, but the code is available here:
https://gist.github.com/cdavidc/3509ceefba518f20d1c123b6435407d6

(fully copied below because these things tend to get lost)

// Code taken from https://github.com/cirruslabs/packer-plugin-tart/blob/main/builder/tart/recoverypartition/relocate.go
// to create a standalone tool to relocate Apple_APFS_Recovery partitions to the end of a macOS disk image
// Build with:
// 	go mod init RelocatePartition.go
// 	go mod tidy
// 	go build RelocatePartition.go
// Run with:
// 	./RelocatePartition path_to_disk_image

package main

import (
	"fmt"
	"github.com/diskfs/go-diskfs"
	"github.com/diskfs/go-diskfs/partition/gpt"
	"github.com/samber/lo"
	"io"
	"os"
)

const Name = "RecoveryOSContainer"

func Relocate(diskImagePath string) error {
	// Open the disk image and read its partition table
	disk, err := diskfs.Open(diskImagePath)
	if err != nil {
		return fmt.Errorf("failed to open the disk image: %w", err)
	}

	partitionTable, err := disk.GetPartitionTable()
	if err != nil {
		return fmt.Errorf("failed to get the partition table: %w", err)
	}

	// We only support relocating a recovery partition on a GPT table
	gptTable, ok := partitionTable.(*gpt.Table)
	if !ok {
		return fmt.Errorf("expected a \"gpt\" partition table, got %q", partitionTable.Type())
	}

	// Find the recovery partition
	recoveryPartition, recoveryPartitionIndex, ok := lo.FindIndexOf(gptTable.Partitions, func(partition *gpt.Partition) bool {
		return partition.Name == Name
	})
	if !ok {
		fmt.Println("Nothing to relocate: no recovery partition found.")

		return nil
	}

	// We only support relocating the recovery partition if it's the last partition on disk
	if (recoveryPartitionIndex + 1) != len(gptTable.Partitions) {
		return fmt.Errorf("cannot relocate the recovery partition since it's not the last partition " +
			"on disk")
	}

	// Determine the last sector available for partitions, which is normally the (total LBA - 34) sector[1]
	//
	// [1]: https://commons.wikimedia.org/wiki/File:GUID_Partition_Table_Scheme.svg
	lastSectorAvailableForPartitions := uint64((disk.Size / disk.LogicalBlocksize) - 34)

	// Perhaps the recovery partition already resides at the last sector available for partitions?
	if recoveryPartition.End >= lastSectorAvailableForPartitions {
		fmt.Println("Nothing to relocate: recovery partition already ends at the last sector available to partitions.")

		return nil
	}

	fmt.Println("Dumping recovery partition contents...")

	tmpFile, err := os.CreateTemp("", "")
	if err != nil {
		return fmt.Errorf("failed to create a temporary file for storing "+
			"the recovery partition contents: %w", err)
	}
	defer os.Remove(tmpFile.Name())

	if err := dumpPartition(diskImagePath, tmpFile.Name(), recoveryPartition.GetStart(), recoveryPartition.GetSize()); err != nil {
		return fmt.Errorf("failed to dump the recovery partition contents: %w", err)
	}

	fmt.Println("Re-partitioning the disk to adjust the recovery partition bounds...")

	recoveryPartitionSizeInSectors := recoveryPartition.End - recoveryPartition.Start

	recoveryPartition.Start = lastSectorAvailableForPartitions - recoveryPartitionSizeInSectors
	recoveryPartition.End = lastSectorAvailableForPartitions

	// Re-partition the disk with the new recovery partition bounds
	if err := disk.Partition(gptTable); err != nil {
		return fmt.Errorf("failed to write the new partition table: %w", err)
	}

	fmt.Println("Restoring recovery partition contents...")

	if err := restorePartition(diskImagePath, tmpFile.Name(), recoveryPartition.GetStart(), recoveryPartition.GetSize()); err != nil {
		return fmt.Errorf("failed to restore the recovery partition contents: %w", err)
	}

	return nil
}

func dumpPartition(diskFilePath string, partitionFilePath string, off int64, n int64) error {
	diskFile, err := os.Open(diskFilePath)
	if err != nil {
		return err
	}
	defer diskFile.Close()

	partitionFile, err := os.Create(partitionFilePath)
	if err != nil {
		return err
	}

	partitionContentsReader := io.NewSectionReader(diskFile, off, n)

	if _, err := io.Copy(partitionFile, partitionContentsReader); err != nil {
		return err
	}

	return nil
}

func restorePartition(diskFilePath string, partitionFilePath string, off int64, n int64) error {
	diskFile, err := os.OpenFile(diskFilePath, os.O_RDWR, 0600)
	if err != nil {
		return err
	}

	contentsFile, err := os.Open(partitionFilePath)
	if err != nil {
		return err
	}
	defer contentsFile.Close()

	partitionContentsWriter := io.NewOffsetWriter(diskFile, off)

	if _, err := io.CopyN(partitionContentsWriter, contentsFile, n); err != nil {
		return err
	}

	return diskFile.Close()
}

func main() {
	if len(os.Args) < 2 {
		fmt.Println("Usage:", os.Args[0], "path_to_disk_image")
		os.Exit(1)
	}
	diskImageFilePath := os.Args[1]
	Relocate(diskImageFilePath)
}

 

To build it, install go (with brew for instance) and execute the few commands listed in the comments at the beginning of the file.

Considering that, the full instructions are:

  1. Locate the VM image in UTM by right-clicking on the VM and select "Show in Finder"
  2. Resize the image using hdiutil resize -size <new_size_in_GB>g -imageonly -verbose <full_path_and_name_of_the_image_file>
  3. cd to where you built the RelocatePartition tool and run ./RelocatePartition <full_path_and_name_of_the_image_file>
  4. Close and re-open UTM, so it re-reads the VM config, then start the VM in the recovery mode
  5. Use diskutil list to get the list of the containers (the first block in the output) and located the Apple_APFS container
  6. Resize the APFS container with diskutil apfs resizeContainer <id_of_the_Apple_APFS_container> 0
  7. Restart the VM

I also disable SIP (boot into recovery, there's an option in UTM to do that by right-clicking on the VM, open a terminal, csrutil disable) then remove all apple bundled bullshit (books, tv, etc), then re-enable SIP.

Conversion between raw image and qcow2: https://github.com/utmapp/UTM/discussions/3784 

 

 

  

 

 

 

 

Sunday, June 01, 2025

Γιατί σκότωσα τον Λέννον

Όποτε εχω λίγο ελεύθερο χρόνο, συνηθίζω να ψάχνω διάφορα πράγματα που γενικώς έχω αφήσει πίσω στη ζωή μου - και δεν εννοώ τις πρώην μου.

Ενα απο αυτά είναι η μουσική.

Προσπάθησαν κάποτε να με στείλουν σε ενα ωδείο, και άντεξα μια εβδομάδα αν θυμάμαι καλά. Μισώ τη θεωρία. Δοκίμασα αρκετές φορές να διαβάσω, και δεν καταλαβαίνω το Χρίστό μου:


 

Ωστόσο ακόμα προσπαθώ κατα καιρούς να καταλάβω πως λειτουργεί η μουσική. 

Θυμήθηκα όμως οτι όποτε προσπαθούσα να καταλάβω κάτι που δεν ήξερα, ο καλύτερος τρόπος ήταν να το πάρω και να το διαλύσω, κοιτάζοντας πως λειτουργεί το κάθε κομμάτι του τόσο χωριστά όσο και σε σχέση με τα υπόλοιπα. Έχω διαλύσει άπειρα πράγματα έτσι - δεν είμαι περήφανος γι'αυτό, αλλά είναι όντως διδακτική εμπειρία.

Έτσι, χθές που είχα λίγο χρόνο, δοκίμασα να "αποσυνθέσω" ενα τραγούδι μπάς και καταλάβω επιτέλους πως λειτουργούν οι συγχορδίες και η αρμονία.

Κατέβασα το πρώτο μύδι file που βρήκα μπροστά μου με το Let it be - δεν ήταν κακή εκτέλεση του μυδιού - και δοκίμασα να αποσυνθέσω το βασικό θέμα. 

Το πρώτο πράγμα που έκανα ήταν να πυροβολήσω τον Λέννον.

Ύστερα σκότωσα τον Χάρισον, τον Στάρ, και κείνο τον μαύρο, ε, συγνώμμη, εννοώ Αφροαμερικάνο, χμμ, οχι, Αφροάγγλο, ΤΕΛΟΣ ΠΑΝΤΩΝ ΤΟΝ ΤΥΠΟ ΠΟΥ ΠΑΙΖΕΙ ΣΥΝΘΕΣΑΙΖΕΡ και που κανείς ποτέ δε θυμάται πως τον λένε. 

Άφησα ζωντανό μόνο τον Μακάρτνευ. 

Προσωρινά.

Γιατί μετά την πρώτη επανάληψη, του έκοψα το αριστερό χέρι.

Ύστερα του έκοψα δυο δάχτυλα. 

Μετά, ακόμα ένα.

Και στο τέλος, του έκοψα και όλο το δεξι χέρι, και τον άφησα να παίζει πιάνο με το πουλί:

 



(Εδω εχει εναν μύδι player αλλα μάλλον απέτυχε να embeddωθεί οχι, τελικά embeddώθηκε κανονικά. Μπορείτε και να κατεβασετε κατευθείαν το μύδι file εδω)

Και ναι, εννοείται οτι κάνω edit το midi απο το piano roll. Το πεντάγραμμο μου προκαλεί ημικρανίες[1]. Σβήνοντας σταδιακά ομάδες απο νότες, ανακαλύπτω πως λειτουργούν τόσο στην κάθετη όσο κα στην οριζόντια αρμονία. 

Το πιο ενδιαφέρον κομμάτι ήταν να προσπαθήσω να σβήσω μία - και ακολούθως δυο - απο τις τρείς νότες κάθε συγχορδίας έτσι ωστε το αποτέλεσμα να ακούγεται κάπως πιο κοντά στο ζητούμενο απο ιγκουάνα που κάνει σέξ με πόκεμον.

Δεν ξέρω αν έχει όνομα αυτό που έκανα, αλλά πολύ μου άρεσε - αν και μου δημιούργησε μάλλον περισσότερες απορίες απο όσες μου έλυσε. Καλά θα ήταν να είχα και κάποιον να ρωτήσω.

Friday, May 20, 2022

Τεχνητή Χαζομάρα 1

Ε και που λέτε παιδιά μου, τις προάλλες βγήκα με ενα ζευγάρι φίλωνε που είναι έγκυοι και όλη την ώρα τσακωνόντουσανε για το πως θα βγάλουνε το παιδί.

Είπα να τους βοηθήσω λοιπόν.

Οπότε σήμερα που βαριόμουνα λιγάκι, κάθησα και έφτιαξα ενα νευρωτικό δίκτυο με τον φιδοδαυλό, προσαρμόζοντας ακαταλλήλως ενα έτοιμο τζενερεϊτιβ απο τα τουτόριαλς. 

Το εκπαίδευσα με μια λίστα ελληνικών ονομάτωνε που βρήκα στους ιντερνέδες, και του κωλοδαχτύλωσα λιγάκι και τις παραμέτρους να τα βγάνει ωραία.

Και μετά το έβαλα να προτείνει μερικά ονόματα παιδιώνε:

 





Τώρα ελπίζω οι φίλοι μου να ξέρουν να είναι πιο προσεκτικοί άλλη φορά τι λένε όταν βγαίνουμε για καφέ, και τέλος πάντων αν κάποτε στο μέλλον πετύχετε καμμία Χριστόφλα η κανέναν Δροστοδοσιήλ, θα ξέρετε τουλάχιστον ποιός ακριβώς φταίει.

Οκώδιξ 


Monday, February 07, 2022

THE MITSOTAKIERA

 
Ε και που λέτε παιδιά μου είχα λίγο χρόνο το επόμενο Σαββατοκύριακο και μου περισσεύανε και κάτι ρασπμπέρια πίκοι, και είπα να γίνω κι εγω μεϊκερ, ε και μη σας τα πολυλογώ, κάθησα και έφτιαξα αυτήν εδω τη Μητσοτακιέρα.
 
 
 
 
Ενα περιφερειακό που συνδέεται μεταξύ πληκτρολογίου και κομπιούτορα, και κάνει ακριβώς αυτό που νομίζετε.
 
Θα το βρείτε στο γιτχαμπ : https://github.com/ricudis/mitsotakiera
 
 

Sunday, March 18, 2018

[snippets] grep

grep -v -F -f aggouria -x salata > piato

Afairei ta aggouria apo th salata kai ta vazei sto piato.

Thursday, March 23, 2017

[snippets] TCPDUMP, BPF and vlans.

When using TCPDUMP, you have to be aware of the fact that BPF filter (at least the default libpcap and Linux kernel implementations of it) doesn't do proper decoding based on ethertypes. 

In the presence of both tagged and untagged traffic, the naively occuring expression of (example): 

(port 80 or port 25) 

will not catch VLAN-tagged packets at all. 

You have to be explicit and specify the vlan keyword, which (in absence of a VLAN ID) just moves the Ethernet payload offset to the correct place: 

(vlan and (port 80 or port 25))

And then you miss the untagged traffic. 

The proper expression to use is: 

(port 80 or port 25) or (vlan and (port 80 or port 25))

Of course you never do this. 

Of course double-tagging makes thins even worse. 

Of course the same happens with MPLS (and probably whatever else L2-encapsulation scheme drunk CISCO engineers will patch into an "industry standard" next year). 

Of course all this is noted in the TCPDUMP documentation that you never read:

vlan [vlan_id]: True if the packet is an IEEE 802.1Q VLAN packet. If [vlan_id] is specified, only true if the packet has the specified vlan_id.  Note that  the  first  vlan keyword  encountered in expression changes the decoding offsets for the remainder of expression on the assumption that the packet is a VLAN packet.  The vlan [vlan_id] expression may be used more than once, to filter on VLAN hierarchies.  Each use of that expression increments the filter offsets by 4.

Shame on you. 

Wednesday, February 01, 2017

[snippets]: Virtualbox headless VM creation

5  VBoxManage list ostypes
6  VBoxManage createvm --name "Windows 7" --ostype Windows7_64 --register
14  cd VirtualBox\ VMs/
16  cd Windows\ 7/
18  VBoxManage createhd --filename "Windows7.vdi" --size 10000
28  VBoxManage modifyvm "Windows 7" --memory 1024 --acpi on --boot1 
    dvd --nic1 nat
32  vboxmanage storagectl "Windows 7" --name "SATA" --add sata 
    --controller IntelAHCI
35  vboxmanage storageattach "Windows 7" --storagectl "SATA" --port 0 
    --device 0 --type hdd --medium "Windows7.vdi"
36  vboxmanage storageattach "Windows 7" --storagectl "SATA" --port 1 
    --device 0 --type dvddrive --medium /home/blabla/Windows7.iso
48  vboxmanage modifyvm "Windows 7" --vrde on
49  vboxheadless --startvm "Windows 7"
57  vboxmanage modifyvm "Windows 7" --nic1 bridged
61  vboxmanage modifyvm "Windows 7" --bridgeadapter1 enp2s0f1



then connect with RDP to port 3389 

Wednesday, August 03, 2016

[Useful links]: Hard drive reliability stats from an actual cloud user

Not too many of these floating around.

There's an old Google paper around the same lines, but withholding disk manufacturer information to protect the guilty.

The guys here are more shameless, making this actually useful:

https://www.backblaze.com/blog/hard-drive-failure-rates-q2-2016/

Friday, April 29, 2016

Ελληνική C

Νιώθετε περήφανοι που είστε Έλληνες;


Έχετε βαρεθεί τις ξενόγλωσσες γλώσσες προγραμματισμού;


Θέλετε να μπορείτε επιτέλους να μιλάτε στον υπολογιστή σας στη γλώσσα σας;



Αν ΝΑΙ, τότε η Ελληνική C, μια συνταρακτική εφεύρεση της Rikafr IT Solutions, είναι φτιαγμένη για σάς. Με την Ελληνική C, μπορείτε επιτέλους να γράφετε κώδικα σε απλά, κατανοητά Ελληνικά αντί για τα περίεργα σύμβολα που έβγαλε απο το μυαλό του εκείνος ο ανώμαλος ο Ritchie. 

Η απλότητα και η απαράμιλλη ευχρηστία της Ελληνικής C, την κάνουν το τέλειο εργαλείο για την εξάπλωση του Ελληνισμού στην παγκόσμια κοινότητα IT, προσφέρεται ΕΝΤΕΛΩΣ ΔΩΡΕΑΝ, ΑΠΟΚΛΕΙΣΤΙΚΑ στους αναγνώστες του βλόγιου μας.

Για να τη χρησιμοποιήσετε τώρα αμέσως, απλά κάντε #include τα παρακάτω macro definitions, και μπορείτε αμέσως να αρχίσετε να γράφετε κώδικα στα Ελληνικά. Δυστυχώς, επειδή η υποστήριξη unicode στα preprocessor tokens είναι λιγάκι γιατομπούτσοκαβάλα, αναγκαστήκαμε να χρησιμοποιήσουμε greeklish, πράγμα που καθόλου δε μειώνει την ευχρηστία και την εκφραστικότητα της Ελληνικής C, όπως θα διαπιστώσετε αμέσως και μόνοι σας:

#define makrynari long
#define noumero int
#define tsipras 0
#define tsoukou !
#define tzhmeros void
#define ama if
#define xwstou =
#define einai ==
#define syre goto
#define spane break
#define parto_alliws continue
#define asimos unsigned
#define alliwtika else
#define thn_exei sizeof
#define psofa exit
#define gramma char
#define oso while
#define KKE ,
#define re_malaka ;
#define apo_dw {
#define ws_edw }
#define ton_pinei <
#define gamaei >
#define ton_psilopinei <=
#define psilogamaei >=
#define loupa for
#define epi *
#define kanto do
#define eisai_noumero isdigit
#define meion -
#define syn +
#define malakia perror
#define sfyra printf
#define dialekste switch
#define piato case
#define tsimento const
#define patates default
#define gyrna return
#define PASOK abort
#define ntopio static
#define enw &&
#define ki_allo ++
#define kopse_kati --



Και εαν δεν έχετε πειστεί ακόμα για την απαράμιλλη δύναμη αυτών των λίγων macro definitions που περικλείουν όλη την δύναμη και την μαγεία της Ελληνικής γλώσσας, μπορείτε να δείτε παρακάτω ενα παράδειγμα χρήσης.

Ορίστε ο αλγόριθμος QuickSort γραμμένος στην Ελληνική C:

Για να γίνει φανερή η ευελιξία της Ελληνικής C, έχουν γίνει σε κάποια επίτηδες κάποιες αλλαγές απο την Ορθή χρήση της γλώσσας, έτσι ωστε να δείξουμε τα δυνατά εκφραστικά στύλ - για παράδειγμα, ενω το σύμβολο του κόμματος κανονικά είναι ΚΚΕ ("ένα είν' το κόμμα"), ο κώδικας ομολογουμένως γίνεται κάπως δυσνόητος (πράγμα που συμβαίνει γενικότερα με το ΚΚΕ), οπότε έχουμε την εναλλακτική δυνατότητα να χρησιμοποιήσουμε στη θέση του το πιο συνηθισμενο σύμβολο ",":


#ifndef __x86_64__
#error "1985 called and asked for its architecture back"
#endif

#include
#include "greekc.h"

tzhmeros qsort(noumero arr[], asimos noumero first, asimos noumero last)
apo_dw
        noumero i, j, pivot, tmp re_malaka

        ama ( first ton_pinei last ) apo_dw
                pivot xwstou first re_malaka
                i xwstou first re_malaka
                j xwstou last re_malaka
                oso ( i ton_pinei j ) apo_dw
                        oso ( arr[i] ton_psilopinei arr[pivot] enw i ton_pinei last ) apo_dw
                                i ki_allo re_malaka
                        ws_edw

                        oso ( arr[j] gamaei arr[pivot] ) apo_dw
                                j kopse_kati re_malaka
                        ws_edw

                        ama ( i ton_pinei j ) apo_dw
                                tmp xwstou arr[i] re_malaka
                                arr[i] xwstou arr[j] re_malaka
                                arr[j] xwstou tmp re_malaka
                        ws_edw
                ws_edw

                tmp xwstou arr[pivot] re_malaka
                arr[pivot] xwstou arr[j] re_malaka
                arr[j] xwstou tmp re_malaka
                qsort ( arr, first, j meion 1 ) re_malaka
                qsort ( arr, j syn 1, last ) re_malaka
        ws_edw

        gyrna re_malaka

ws_edw

noumero main ( tzhmeros )
apo_dw
        noumero arr[] xwstou apo_dw 39,17,69,17,4,28,59,1,76,4,22,67,4 ws_edw re_malaka
        noumero i KKE size re_malaka

        size xwstou 13 re_malaka
        qsort ( arr, tsipras, size meion 1 ) re_malaka
        sfyra ( "Quicksort results :\n" ) re_malaka
        loupa ( i xwstou 1 re_malaka i ton_pinei size re_malaka i ki_allo )
        apo_dw
                sfyra ( "%d\n" KKE arr[i] ) re_malaka
        ws_edw

        gyrna tsipras re_malaka

ws_edw



Εσείς λοιπόν, τι περιμένετε για να αρχίσετε απο σήμερα να χρησιμοποιείτε την Ελληνική C;

Thursday, April 14, 2016

Excutive summary του Big Data / Analytics software ecosystem

Ύστερα απο μακροχρόνιες εμπεριστατωμένες έρευνες, η Rikafr IT Solutions βρίσκεται σε θέση να παρουσιάσει επιτέλους το μοναδικό Executive Summary Infographic που συνοψίζει με μία ματιά τις δυνατότητες, τις προοπτικές, την ανάπτυξη του οικοσυστήματος λογισμικού για Big Data / Analytics / Data Whorehousing / Aggregation / Timeseries / NoSQL / MapReduce / Hadoop / Cassandra / Mongo / nodejs / InfluxDB / Graphene / Elastic / Graphite / κτλ:

Monday, April 11, 2016

[snippets] How to teach Windows update the lesson it deserves

There are a myriad ways to do proper traffic shaping.

But some times all you need is some pure, traditional brutality to put Windows Update where it belongs:

for i in "13.104.0.0/14" "13.64.0.0/11" "13.96.0.0/13" ; do
    iptables -A custom_forward_chain -s $i -m statistic --mode random --probability 0.05 -j DROP
done

Saturday, July 04, 2015

[snippets] Migrate IMAP mailboxes from Dovecot A to Dovecot B

Logged in on B:

$ doveadm -D -v -o imapc_features="rfc822.size fetch-headers" -o mail_prefetch_count=20 -o imapc_user=ricudis -o imapc_password=topoulimoueinai38ekatosta -o imapc_host=dovecot-a.net -o imapc_port=993 -o imapc_ssl=imaps -o imapc_ssl_verify=no backup -R -u ricudis@dovecot-a.net imapc:

(modify for no SSL as appropriate, etc) 

Saturday, June 13, 2015

Tuesday, May 19, 2015

[snippets]: HP DL380 Gen9 "Smart" Storage Array Setup Howto In 29 Easy Steps


  1. Power on the server
  2. Wait 2 to 3 weeks until POST system checks complete and system complains about uninitialized SSA array. 
  3. Go through a maze of menus, all alike, until you finally find the well hidden embedded Smart Storage Administration tool. 
  4. Boot into the SSA tool. 
  5. Wait hopelessly as a counter counts to infinity while "trying to collect system configuration information". 
  6. Read the SSA manuals and release notes
  7. Find no relevant information
  8. Google for the SSA error messages on the counter-to-infinity screen. 
  9. Find nothing. 
  10. Google for the offline version of the SSA tool, download ISO, burn it to CD. 
  11. Reboot the server
  12. Wait another 2 to 3 weeks until POST system checks complete
  13. Bypass complaints about uninitialized SSA array. 
  14. Try to boot from the CD. 
  15. Fail because the CD doesn't support EFI boot. 
  16. Switch to BIOS boot method
  17. Step 15 requires a reboot. Wait 2 to 3 weeks more. 
  18. Boot from the CD into the offline version of SSA. 
  19. Google again for a newer version of SSA because the one you downloaded is 15 years old. 
  20. Burn newer version to CD. 
  21. Reboot using the updated version of SSA. Wait 2 to 3 weeks. 
  22. This one "works", in contrast with the embedded one. 
  23. Get a full array report to check drive status for any errors. 
  24. Pay attention to the naming of controller flag entries in the report output. There are "Controller Flags", "Extended Controller Flags", "More Controller Flags" and "Even More Controller Flags". 
  25. Configure the array, assign physical drives, and select the "rapid" initialization mode. 
  26. While waiting for the "rapid" initialization mode to complete, make children, grow them up, ensure they go to university. 
  27. Around the time of their post-graduation ceremony, "rapid" initialization of array is finished. 
  28. Did I tell you that array is not available to the OS before "rapid" initialization mode completes? 
  29. To Be Continued.

Saturday, May 02, 2015

Sunday, November 16, 2014

Why I love linode.com - again!

Imagine yourself operating a VM hosting provider.

You have innumerable lots of customers, the vast majority of them having just a small - or, at worse, none at all - technical ability and knowledge to ensure that their VMs are running smoothly, without causing any issues either to you or to the larger Internet community as a whole.

Being a good netizen requires technical knowledge that is not so widely disseminated or given attention at nowadays, where the popular trend getting momentum is "anybody can fire up an Ubuntu and be happy with not ever having to deal with UNIX internals".

Now, imagine one of your customers VMs was causing trouble - not only to you, but to another ISP, and their customers too.

What would you do?

Most of us technically inclined people, would be quick to answer: "Shut them down so you alleviate the issue, and deal with them later, or not deal with them at all - they're not going to understand technical matters". Most probably, I myself would be amongst those giving the same exact answer when faced with this question.

But I wasn't.

To make it worse, this time, I was part of the problem: I had deliberately configured a DNS resolver on one of my VMs to allow unlimited recursive queries from the open Internet. The reason? At the time, I was behind some ISPs aggressively filtering DNS queries, and I wanted to have a DNS resolver I could trust - my own one.

Problem is, this configuration allows your DNS server to be the culprit for an interesting class of attacks, called DNS Amplification Attacks. Although I was very aware of the dangers of operating a publicly reachable open DNS resolver, I opted to hide behind the small possibility of my own VM being used as part of an attack - who scans the wide internet for open DNS resolvers, right?

Well, apparently somebody did. Fortunately, this somebody was an automated service scanning for open DNS resolvers rather than an actual attacker, but unfortunately it was also a misconfigured one: Upon discovery of an open DNS resolver, it didn't just notify their owners so they could alleviate the issue, but it also kept on hammering the said DNS resolver with thousands of DNS requests per minute, all of them destined for a couple of DNS domains - facilitating a DNS amplification attack, rather than preventing one!

My VM host provider is the more than excellent linode.com. So, what they did in this case to alleviate the issue my VM was causing - again, not only to them, but to another ISPs and another ISPs customers? Did they shut down my network connectivity, or my VM at large, as it would be easier - and safer - for them to do so?

No.

Instead, they opened a ticket with me. Supplying all the technical information needed so I could fix the issue myself.

To make a bad situation worse, my linode-registered e-mail is one that sometimes I don't read too often - especially when travelling around. And at the period in question, I was travelling around. So their ticket went unnoticed for a total of 5 days.

Did they shut me down after my inability of quickly respond to the issue, as they would be more than right to?

No.

They kept on sending me emails, until I finally noticed one of them.

Upon reading their ticket, it was just a matter of minutes to alleviate the problem. I turned off the recursive resolver on my bind configuration, and I supplied them with the list of IP addresses being responsible for the vast majority of the rogue DNS requests, as well as the domains being attacked. I also offered to contact the attacked ISP's technical contact, whose e-mail complaint linode had CC:ed to the ticket, to let them know I took care of the situation, and ask for forgiveness :)

Why, you would be inclined to ask, am I publicly exposing my mistakes like so? Only for one reason: To again, and again, and again praise linode.com, whose *EXCELLENT* technical customer support has been saving me from issues time after time, all these years I've been their customer. And let's not forget - they even give you free upgrades every time they expand - some capacity goes to accommodate for growth, and some capacity goes to free upgrades for their existing customers.

So, if you're a linode customer, be sure to read your registered linode e-mail often so you get notice of any issues, and be sure to read their blog often, so you get noticed of any offers and upgrades being offered to you.

And if you're not a linode customer, go on and be one right now. I can assure you that it will be one of the best decisions you'll ever make. 

Saturday, April 12, 2014

Ρέκβιεμ για μια ματωμένη καρδιά

Μέχρι τώρα με τις χοντρομαλακίες που διαβάζετε στο Internet για το Heartbleed, πρέπει να έχετε χεστεί πάνω σας, ειδικά αν είστε ο τυπικός ασχετίλας απο πληροφορική - εδω λένε μαλακίες και αρκετοί που ΔΕΝ είναι.

Οι καλύτερες πιπάντζες απ'ολες, φυσικά, οφείλονται, όπως πάντα, στους δημοσιοβλάχους. Απανθίζω μαργαριτάρια καλλίστου μαλακίας :

* Πανικός στις ιστοσελίδες από τον ιό «ματωμένη καρδιά»
* Η ματωμένη καρδιά που απειλεί να «ματώσει» το διαδίκτυο
* Ιός διαβάζει τους κωδικούς σας σε υπολογιστή και κινητά!
* Ο ιός έχει το όνομα heartbleed, και το σχήμα καρδιάς που ματώνει
* Βόμβα διαδικτυακή ο νέος ιός που διαπερνά τα πάντα και ματώνει όλα τα συστήματα ασφαλείας σε κινητά και υπολογιστές!

Τι πρέπει να πιστέψετε απο όλα αυτά;



ΑΠΟΛΥΤΩΣ
ΤΙΠΟΤΑ!!!!!!!!!!!!1111111
1111111oneoneoneone
oneelevenχιλιαεκατονεντεκα



Το πρόβλημα είναι σημαντικό, είναι όντως σημαντικό, ΑΛΛΑ ΔΕΝ ΑΦΟΡΑ ΕΣΑΣ. Όντως η έκταση του είναι μεγάλη, όντως έγιναν χοντρομαλακίες στο χειρισμό του θέματος, όντως κανείς δεν ξέρει τι δεδομένα πιθανώς έχουν υποκλαπεί απο vulnerable συστήματα, όντως ενδεχομένως να υπάρχει πουστιά στη μέση - αυτά ισχύουν.

Άλλα αυτά αφορούν κυρίως ένα τσούρμο καημένους τεχνικούς που θα τρέχουν μερα νύχτα να patchάρουν SSL servers. Απλήρωτοι. Με υπερωρίες. Γιατί "είναι η δουλειά τους", "Για το καλό της εταιρίας", και άλλες λοιπές παπάντζες.

Οσο για τους κωδικούς σας και αν πρέπει να τους αλλάξετε; Καλό είναι να το κάνετε. Όχι τώρα. Σε κανένα μήνα απο τώρα, όταν θα έχουν προλάβει πρώτα οι τεχνικοί που τρέχουν σα γαίδαροι, να patchάρουν τους servers στους οποίους τους έχετε. Γιατί αν τους αλλάξετε πρίν, είναι δώρο - άδωρο.

Και να σας πώ και τρία μυστικά:

Πρώτον, κανένας δεν ξέρει πόσο πραγματικά δύσκολο είναι να γίνει όντως συστηματική υποκλοπή κωδικών απο servers με τη χρήση του heartblead. Ώς ενα βαθμό, είναι ζήτημα τύχης, ως ένα βαθμό ζήτημα επιμονής, ΔΕΝ είναι πάντως τόσο απλό όσο σας λένε.

Δεύτερον. ΚΑΝΕΝΑΣ, ΑΠΟΛΥΤΩΣ ΚΑΝΕΝΑΣ ΣΤΟ ΓΝΩΣΤΟ ΣΥΜΠΑΝ ΔΕΝ ΝΟΙΑΖΕΤΑΙ ΠΡΑΓΜΑΤΙΚΑ ΝΑ ΠΡΟΣΠΑΘΗΣΕΙ ΝΑ ΒΡΕΙ ΤΟΝ ΓΑΜΗΜΕΝΟ ΤΟΝ ΚΩΔΙΚΟ ΣΟΥ ΣΤΟ FACEBOOK. ΟΧΙ, ΟΥΤΕ Η ΠΡΩΗΝ ΣΟΥ.

Πόσο μάλλον στο Yahoo.

Μόνο εσυ ο ίδιος νομίζεις οτι είσαι τόσο σημαντικός που το password σου αποτελεί το μεγάλο μυστικό του σύμπαντος. Εξ'αλλου, κατά πάσα πιθανότητα, είναι το νούμερο του τηλεφώνου σου η το όνομα του σκύλου σου, η "123qwe".

Τρίτον. Μόνο κάποιοι servers έχουν πρόβλημα. Ναι, θεωρητικά έχουν και κάποιοι clients. ("client" ονομάζεται το κομπιούτερ σου, γάιδαρε). Πολύ θεωρητικά. Το πόσο θεωρητικά, θα το δείς παρακάτω. Δε θα καταλάβεις το χριστό σου βέβαια απο αυτό που θα δείς, αλλά θα το δείς.

Και η μαλακία είναι οτι θα εξακολουθήσεις να'σαι σα χεσμένος και ΑΦΟΥ το δείς. Γιατί τόσο σου κόφτει. Γιατί τόσο έχεις συνηθίσει να πιστεύεις άκριτα ότι μπούρδα σου πουλάνε τα blogs.

Ψεκασμένε.

Πόσο σπάνιο είναι το client-side vulnerability; Η αλήθεια είναι οτι για να καταφέρω να βρώ vulnerable client για να δοκιμάσω τα παρακάτω patches, μου βγήκαν τα παναγίδια ανάποδα.

Πάμε στα patches:

Αυτό εδώ είναι ενα patch για το OpenSSL που διορθώνει το heartbleed attack όπως θα έπρεπε να είχε διορθωθεί: Loggάρει το attack attempt, και απαντάει στο oversized heartbeat request ΜΕ ΜΙΑ ΠΟΥΤΣΑ ΝΑ, με το συμπάθειο (μη με ρωτάτε για ποια έκδοση του OpenSSL είναι, αμα δε μπορείτε να διαβάσετε ενα patch, και να σας απαντήσω για ποια έκδοση είναι θα σας είναι πιο άχρηστο κι απο υποθαλάσσιο ποδήλατο).


Και για μια live επείδιξη του τελευταίου, αν πατήσετε το παρακάτω link, ο ΙΟΣ που επιτίθεται στο ΓΚΟΜΠΓΙΟΥΤΕΡ σας θα ΤΡΥΠΩΣΕΙ ΑΘΟΡΥΒΑ ΜΕΣΑ ΑΠΟ ΤΙΣ ΓΡΑΜΜΕΣ ΤΟΥ ΙΝΤΕΡΝΕΤ. Θα σας κλέψει την παρθενιά, θα σας σκοτώσει το σκύλο, θα βιάσει την αδερφή σας απο τον κώλο (αν δεν έχετε αδερφή θα σας κάνει μια πρώτα), θα αδειάσει την πιστωτική σας κάρτα, και θα σας κλέψει ολο το μπάφο. ΝΑΙ, και αυτόν που έχετε κρυμμένο μέσα στην κάλτσα στο συρτάρι του υπνοδωματίου.

Φυσικά δε θα κάνει τίποτε απο αυτά. Κατά πάσα πιθανότητα δε θα κάνει απολύτως τίποτε. Βασικά αν έχετε Windows, μην κάνετε καν τον κόπο να το πατήσετε. Σε λίγο καιρό θα κάτσω να βγάλω στατιστικά απο τους ηλίθιους με Windows που το πάτησαν.

Εαν η επίθεση πετύχει, θα δείτε τα δεδομένα που κατάφερε να μαζέψει το heartbleed απο τον client σας. Ακόμη και σ'αυτή την περίπτωση, που η επίθεση στον client σας επιτύχει, σας ορκίζομαι στο δεξί μου αρχίδι οτι δε θα καταλάβετε το χριστό σας απο το αποτέλεσμα που θα σας βγάλει.

Εαν η επίθεση δεν πετύχει, πάλι θα δείτε κάποια δεδομένα που αφορούν το SSL connection σας, και τον λόγο για τον οποίο απέτυχε η επίθεση. Και πάλι χριστό δε θα καταλάβετε.

Επίσης, σας υπόσχομαι οτι εάν το πατήσετε, θα καταγραφούν τα παρακάτω δεδομένα:

* H ημερομηνία και η ώρα,
* Η IP σας (ξέρετε, εκείνο το "ηλεκτρονικό ίχνος" που λένε τα blogw)
* Το User-Agent string σας (ΔΕΝ ΕΙΝΑΙ ΒΡΑΚΙ, ΗΛΙΘΙΟΙ!)
* Το GET string σας (ΟΥΤΕ ΑΥΤΟ!)
* Ο Referer σας (για να μη μου κάνετε καμμιά πουστιά, δε σας ξέρω τι κερατάδες είστε;)
* Εαν ο client σας είναι ευπαθής στο heartbleed.

ΔΕΝ θα καταγραφεί:

* Ο buffer με τα δεδομένα που επέστρεψε ο client σας σε περίπτωση επιτυχίας του heartbleed attack.

Φυσικά δεν έχετε καμμία υποχρέωση να με πιστέψετε. Μπορεί όλα αυτά να είναι ψέμματα για να σας κάνω να το πατήσετε και να σας κλέψω τον κωδικό σας στο facebook για να την παίζω με τις φωτογραφίες σας σε κείνο το κλειδωμένο album. Ξέρετε ποιό λέω. 


Και μην πέφτετε όλοι σαν τα γίδια επάνω. Βαριόμουν και το μαλάκισα άγρια με την BIO_puts(), συν το γεγονός οτι ο s_client είναι single-threaded - οπότε αμα αρχίσετε να το βαράτε όλοι μαζί, θα πάρετε τ'αρχίδια του Δαλαι Λάμα.

Update #1

Και με τα private keys των servers τι γίνεται;

Αυτά είναι όντως vulnerable, αλλά η μεγάλη ζημιά έχει γίνει ήδη. Οι περισσότερες απο τις υπηρεσίες που χρησιμοποιείτε, αργά η γρήγορα θα διορθωθούν - και θα αλλάξουν τα private keys τους. Μέχρι τότε, φυσικά μπορείτε και να τις ελέγχετε - ενα κάρο sites υπάρχουν που κάνουν αυτόματα heartbleed tests - και ναι, το ξέρω οτι αποκλείεται να το κάνετε. Γενικά ωστόσο, οποιοδήποτε vulnerability στο server-side έχει σχετικά πιο περιορισμένο χρόνο ζωής απο ότι στο client-side. Πρόβλημα στο client-side θα υπάρξει ενδεχομένως με κινητά που γίνονται upgrade κάθε ποτέ, embedded devices, κτλ.

Πρόβλημα επίσης υπάρχει με το compromise των private keys κυρίως στην περίπτωση που κάποιος έχει μεγάλο όγκο καταγεγραμμένης κρυπτογραφικής κίνησης, που τώρα μπορεί πλέον να αποκρυπτογραφήσει - σχεδόν κανείς δε χρησιμοποιεί PFS. Αυτοί είναι σχετικά λίγοι, και συνήθως έχουν καλύτερα attack vectors απ'αυτό εδω πέρα - που θα καταστεί και άχρηστο σε λίγο καιρό. Το μεγαλύτερο πρόβλημα με το συγκεκριμένο vulnerability είναι οτι έχει αρκετά μεγάλο εύρος ωστέ να γίνουν σοβαρές εκτιμήσεις του τι κινδυνεύει και τί όχι.

Τώρα, αν είστε πελάτης της Συνεταιριστικής Τράπεζας Κάτω Μπραχαμίου, με IT services βασισμένα σε yggdrasil linux και διαχειριστή το γιό του προέδρα που τελείωσε ΙΕΚ Γάμα, Τμήμα Εφαρμογών Κρυπτογραφίας, οκ, ας προσέχατε.

Και η μεγάλη κακιά NSA;

Αυτή έχει καλύτερους τρόπους να μαζεύει δεδομένα.

Ντάξ, κι αυτός καλός ήταν - μέχρι σήμερα.

Τελικά τι να κάνω; Να αλλάξω κωδικό στο Pinterestagram;

Ακόμα και να αλλάξεις, κάποια παρόμοια μαλακία θα βάλεις. Και θα ξέχασες κι οτι έχεις τον ίδιο κωδικό σε ακόμα 842 sites. Αυτό, δυστυχώς, δεν αλλάζει.

Μα τι θα γίνει επιτέλους με όλους αυτούς τους προγραμματιστές που είναι ανίκανοι να θυμούνται συνέχεια το μέγεθος των buffers τους;

Θα τους μεταθέσουμε όλους στην Αλάσκα να γράφουν COBOL.

Έχω τον Exchange Server της Microsoft. Θα έχω πρόβλημα με το Heartbleed;

Οχι, και πλέον αυτού, κατα πάσα πιθανότητα το Exchange σου είναι πεσμένο. 

Wednesday, March 12, 2014

[Snippets]: Online resize of LVM filesystems.

Είναι κάτι που χρειάζεται να το κάνω πολύ συχνά, και πάντα ξεχνάω πώς στο διάολο.

Σούμα:

recreate partitions (CAREFULLY!)
reread partition table
lvm pvresize
lvm lvextend
resize2fs

Βαριέμαι να τα γράψω αναλύτικότερα. Διαβάστε τα man pages. Ίσως την επόμενη φορά που θα χρειαστεί να το κάνω, να κρατήσω log.