Code: Select all
LOG: postinst
For detailed documentation please see the upstream website:
http://www.balabit.com/sites/default/files/documents/syslog-ng-ose-3.4-guides/en/syslog-ng-ose-v3.4-guide-admin/html/index.html
It is highly recommended that app-admin/logrotate be emerged to
manage the log files. syslog-ng installs a file in /etc/logrotate.d
for logrotate to use.
Code: Select all
mybox ~ # ls -l /etc/logrotate.d/
total 24
-rw-r--r-- 1 root root 221 Apr 19 15:51 apache2
-rw-r--r-- 1 root root 135 Apr 17 12:40 dcron
-rw-r--r-- 1 root root 272 Apr 20 00:15 elog-save-summary
-rw-r--r-- 1 root root 71 Apr 3 14:14 openrc
-rw-r--r-- 1 root root 105 Apr 20 01:19 rsyncd
-rw-r--r-- 1 root root 357 Apr 17 10:43 syslog-ng
mybox ~ # date
Mon Apr 21 00:17:07 CEST 2014
mybox ~ #
Code: Select all
mybox ~ # cat /etc/logrotate.d/syslog-ng
# $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.logrotate.in,v 1.1 2014/01/22 04:25:35 mr_bones_ Exp $
#
# Syslog-ng logrotate snippet for Gentoo Linux
# contributed by Michael Sterrett
#
/var/log/messages {
missingok
sharedscripts
postrotate
/etc/init.d/syslog-ng reload > /dev/null 2>&1 || true
endscript
}
mybox ~ #
Code: Select all
mybox ~ # emerge -s logrotate
Searching...
[ Results for search key : logrotate ]
[ Applications found : 2 ]
* app-admin/logrotate
Latest version available: 3.8.7
Latest version installed: [ Not Installed ]
Size of files: 57 kB
Homepage: https://fedorahosted.org/logrotate/
Description: Rotates, compresses, and mails system logs
License: GPL-2
...[snip]...
mybox ~ #

I think I can grasp you basic idea how to do the air-gapped install. And I guess that may be a fine way to reach the same goal.jonathan183 wrote:I think your main issue for the initial install is being unable to trust information you are able to download from the net without being able to complete some form of additional verification.
If I were in this situation then my approach to the initial install would be:-
To use trusted, read only media to boot from (a CD - not an image on a hard drive or usb pen drive), for which I think the SystemRescue CD is most appropriate.
I'd verify the SystemRescue CD after download and after burning to CD, if you don't have a CD drive on the system exposed to the net then buy one even if it's a usb CD/DVD drive.
The system exposed to the net will need storage connected to it (either hard drive, pen drive or dvd writer) to store downloaded information.
Boot the system to expose to the net from the SystemRescue CD and partition/format (including secure erasure) the storage (hard drive/pen drive) and then mount the storage. I'd set iptables to block incoming (except established connections), and only allow outgoing ports you require - feel free to make this more difficult to defeat by creating rules that only allow outgoing connection for a certain group with a name and groupid you select at random.
Connect to the net and download an all on one page version of the handbook to be able to refer to later, also download (section 5 of one of the older handbook copies for instructions for portage snapshot install).
Download and verify the integrity of the appropriate stage3 tarball (section 5 of the handbook) - using the mirror of your choice. Redirect output of verification to a .txt file so it can be checked later.
Download and verify the integrity of the a portage snapshot - using the mirror of your choice. Again redirect the output of verification to a .txt file so it can be checked later.
Now check the stage3 and portage snapshot against a few other gentoo mirrors in various locations (selected at random).
Disconnect the system from the net, shut it down and power off, then reboot it using the SystemRescue CD and check the intergrity of the downloaded information, comparing the output you get with the .txt files saved while the system was online. Assuming the same results, you can be as sure as your going to be that what you have are good copies of a stage 3 and portage snapshot to complete the install of the air gapped system(s).
Boot air gapped system from the SystemRescue CD, partition/format its storage and mount the partitions for the install and copy and untar the stage3 and portage snapshot, setup locale and make.conf as you want it on your target system. Before you can build the kernel, install a bootloader or sync we require net access again.
At this point you can start identifying url of individual files and download them.
Yup! The BIOS can be attacked when system is exposed online. Or even through intermediaries (such as pendrive) which were exposed). Sure, CD is better.jonathan183 wrote: Personally at this point I'd copy the install of the air gapped system back across to the system with a net connection, boot the net exposed system using the SystemRescue CD (setup IP tables as above then connect to the net) and chroot and pull kernel and bootloader files using emerge -avf your_selected_kernel_sources your_boot_loader. Then disconnect from the net and compare the air gapped system with the copy which should now have kernel and bootloader downloaded. I think copying the kernel_sources and your_boot_loader related files in usr/portage/distfiles to the air gapped system will be sufficient (copy the minimum required - start with distfiles only eg grub and gentoo-sources) to allow chroot in and finish off the install by emerging the kernel and bootloader, configure and compiling the kernel and installing the bootloader. Taking this approach does not risk compromising the air gapped system but allows identification of any modifications made to the net connected system.
I'd check the air gapped system boots and then copy it back to the net system, and do an emerge -avfe world to pull source packages for the entire system. Do a diff and copy the information to the air gapped system (I think distfiles only).
After that I'd pull apps, xorg-server and other things I want then diff and copy across to the air gapped system in a similar way to the kernel and bootloader above.
There are several options in terms of maintaining an air gapped system after that, with pulling a snapshot and then downloading files for the update similar to the above being one approach. Booting from the SystemRescue CD each time will help protect against boot sector issues but will offer no protection against BIOS issues. Protection against something like badBIOS would need a bit more thinking about - and is one reason I'd us CD/DVD rather than a pen drive if I were so concerned about a compromised system.
I just want true privacy (TM). Half-joking, sure, but I just don't want anybody being able to poke anywhere, or at least almost anywhere. Regardless what kind of information it was...jonathan183 wrote: The above does not really require any knowledge of the internal workings of portage, but you can streamline what needs to be synchronised to portage affected tree only rather than an entire system. I suspect setup of a build server using webrsync-gpg feature which you periodically connect to the net (random times/day of week) locked down and setup with cli only would be a better approach to maintaining systems. But then I don't know what sort of information you want to protect, how sensitive it is, what the consequences are for a system being compromised or how determined individuals/group of people are to gain access to your systems. I also don't know if using cli and framebuffer applications like links are sufficient for systems you do connect to the net which would allow a reduction of attack vectors.

Helpful it looks. When I get free time (busy, overwrought actually wrt to my abilities, at this time), I'll enjoy reading it! The link.jonathan183 wrote:The method outlined would be my approach to being unable to trust information downloaded from the net without further verification/integrity checks in order to achieve a clean air gapped installation of Gentoo.
The method means I need to trust the SystemRescueCD which I can boot from, and the Gentoo teams producing the stage3 and portage snapshot to not be attacking me as an individual.
I'm also relying on the supply chain and people who made the PC are not attacking me as an individual (but that would apply equally to any OS I choose to install), Free BIOS https://www.fsf.org/campaigns/free-bios.html would help with this
Your way is a fine shortcut of mine which is closer to true air-gapping.jonathan183 wrote:The air gapped system need have no network connection, it only needs to be able to read information saved from the net connected system and be able to write information that can subsequently be read by the net connected system - but this could be CD/DVD media.
My approach allows portage verification plus the use of diff tools plus any other verification you may want to do before changes are made live on the air gapped system (including portage tree updates).
You can trade some reduction in security for convenience and use USB drives, a network share or a private file/web server to get information to and from the air gapped system or not have an air gapped system at all.
You can have a local mirror, build servers or take other approaches to ongoing maintenance of the system after installation, as I said in the title of my previous post it only really dealt with the initial install of an air gapped system.
I work on the basis that the people attacking have greater knowledge and time to dedicate to the activity than I do to defence, so try to keep things fairly simple and minimise the things I have to trust.
I'm not expecting a knock on the door at 2am by armed police based on something I have on my computer, if I were then I would be using air gapped systems or better still not storing such information on a computer in the first place.
I don't claim to know more than you (or anyone else) about installing or maintaining a Gentoo system, I just provided my thoughts on an initial install for an air gapped system if unable to trust downloaded information without additional verification. If you have experience of systems being compromised after several hours on the net (which I get that impression from some of your previous posts) I would be cautious about connecting a system which has been on the net with an air gapped system at some point in the future even if this occurs over a private network connection.
Code: Select all
me@DebianBox:somewhere$ gpg -s -a -b --output stdin_msg.sig -
You need a passphrase to unlock the secret key for
user: "Miroslav Rovis (consecrated to Heart of Jesus) <miro.rovis@croatiafidelis.hr>"
4096-bit RSA key, ID 4FBAF0AE, created 2014-01-16
gpg: problem with the agent - disabling agent use
Enter passphrase:
I can try writing the message and see.
me@DebianBox:somewhere$Code: Select all
Enter passphrase: Code: Select all
Enter passphrase:
I can try writing the message and see.Code: Select all
me@DebianBox:somewhere$ gpg --verify stdin_msg.sig -Code: Select all
I can try writing the message and see.
gpg: Signature made Wed 14 May 2014 10:10:03 AM CEST using RSA key ID 4FBAF0AE
gpg: Good signature from "Miroslav Rovis (consecrated to Heart of Jesus) <miro.rovis@croatiafidelis.hr>"
me@DebianBox:somewhere$ Code: Select all
me@DebianBox:somewhere$ gpg --verify stdin_msg.sig -
I can try writing anything else and see.
gpg: Signature made Wed 14 May 2014 10:10:03 AM CEST using RSA key ID 4FBAF0AE
gpg: BAD signature from "Miroslav Rovis (consecrated to Heart of Jesus) <miro.rovis@croatiafidelis.hr>"
me@DebianBox:somewhere$ while the GnuPG 2.0.22 on my freshly air-gapped installed Gentoo has in its--use-agent
--no-use-agent
Try to use the GnuPG-Agent. With this option, GnuPG first tries to connect to
the agent before it asks for a passphrase. --no-use-agent disables this option.
I so much like the working --no-use-agent option, and don't want the latter. I--use-agent
--no-use-agent
This is dummy option. gpg2 always requires the agent.
Code: Select all
gbn miro # emerge -s gnupg | grep -A1 'app-crypt'
* app-crypt/gnupg
Latest version available: 2.0.22
--
...[snip]...
gbn miro # Code: Select all
me@GentooBoxPREVIOUSLY ~ $ gpg -s -a -b --output stdin_msg.asc -
You need a passphrase to unlock the secret key for
user: "Miroslav Rovis (consecrated to Heart of Jesus) <miro.rovis@croatiafidelis.hr>"
4096-bit RSA key, ID 4FBAF0AE, created 2014-01-16
gpg-agent[30889]: can't connect to the PIN entry module: IPC connect call failed
gpg-agent[30889]: command get_passphrase failed: No pinentry
gpg: problem with the agent: No pinentry
gpg: no default secret key: Operation cancelled
gpg: signing failed: Operation cancelled
me@GentooBoxPREVIOUSLY ~ $Code: Select all
GentooBox me # emerge -s gnupg | grep -A1 'app-crypt'
* app-crypt/gnupg
Latest version available: 2.0.22
--
...[snip]...Code: Select all
GentooBox me # emerge -S gnupgwhich doesn't interests those who want to use password verification on thekhayyam wrote:... that said,
EDIT: 2014-12-02 there was a "/" lacking in the closing quote above, was very unreadablekhayyam wrote:I've masked > gpg-1 as the who pinentry thing is broken IMO.
Nothing can I allow myself to add there.khayyam wrote:As gnupg has no native method, and uses pinentry, this means
there is no current method of escaping one or other "interface". If you were
happy with how it once was, when a command line interface was an 'option', then
step aside, linux is being made 'usable', and your antiquated thinking is
standing in the way of progress.
The offical advice is "use gpg-agent", which in my case makes ... no, no, don't
get me started. So, yes, this is a major annoyance, but unless some stop is put
on this drive toward an ill concieved abstracted "user" (which is little more
than a stratigists idea of the "usability" requirement for "developing
markets") then I think we will see more and more of this type of "development".
must remainkhayyam wrote:a command
line interface
inkhayyam wrote:an 'option'
This is actually complete explanation, newbies only need 'man emerge' andkhayyam wrote:gw, et al ...gw wrote:How can I disable this new "feature", that is: simply enter the passphrase from within my terminal application, or how can I at least make pinentry accept copy and paste?
I got *so* fed up with pinentry screwing up the tty when editing with vim I decided to do something about it, and so I'm bumping this just to say getting the old behavior is infact possible.
/etc/portage/package.mask... it turns out gnupg-1 is still in portage, and still maintained ... so, voila!Code: Select all
>=app-crypt/gnupg-2.0.22
... depclean pinentry (and deps) ...Code: Select all
# emerge -p app-crypt/gnupg [ebuild D ] app-crypt/gnupg-1.4.16
... sanity! ...Code: Select all
# emerge --depclean -a
... unlike with pinentry keyboard navigation works (and please, no, this has nothing to do with GPG_TTY, or 'no-grab', etc).Code: Select all
% vim ~/test.gpg You need a passphrase to unlock the secret key for user: "khayyam <user@domain.tld>" 4096-bit RSA key, ID FFFFFFFF, created xxxx-xx-xx (main key ID FFFFFFFFF) Enter passphrase:
Hopefully that helps someone ....
best ... khay
Of course it could be an error, but I chose my words appropriately: probably itmiroR_on_Debian wrote:http://www.gossamer-threads.com/lists/gnupg/users/58785
[[ still looks like having been cut short, because there are issues that cry so
loud in there, so loud, they break from in between the lines very forcefully,
if you have enough alert on the right side of the privacy/freedom/surveillance
issues ]]
[[ No, I don't claim anything, I suspect only. Strongly ]]
[[ Because.. read on... ]]
Because, do you see any more, or much less of that thread on the original list?
Tell me, somebody, pls.:
the thread is on this page (search for "pipe passphrase to unlock key"):
http://lists.gnupg.org/pipermail/gnupg- ... hread.html
and the message is here:
http://lists.gnupg.org/pipermail/gnupg- ... 44881.html
and it has no links to any replies there on that page, only other topics..
Code: Select all
f5d649af5ca4935ce90b5193e08cd53c955d173e9c122458418820ea1f2ab8da dump_140515_032910_naibd6.pcapng
0318a42acce3e71ce085db3a11f9b38840af4dbd34bbc8f898fa7ce3976ca86a Screen_140515_032907_naibd6.mkvNow, in my strong opinion, and for strong opinions I am becoming notorious forWerner Koch wrote:That would make migration for user of 2.0 to 2.1 too complicate. We tryCiprian Craciun wrote:(Sorry I didn't knew you've implemented it.)Werner Koch wrote:Nope. Recall that I implemented the stuff.Ciprian Craciun wrote:Not necessarily if you use the `--batch`, `--no-use-agent`, orWerner Koch wrote: Not a good idea, because GnuPG 2.1 requires the gpg-agent and won't see
any private key stuff.
`--no-tty` (or a mix of the I'm not sure right now, but the manual
is.)
Mmm... Didn't read the "fine print" of the manual... (Which isn't
that fine print...)
~~~~
--no-use-agent
This is dummy option. gpg2 always requires the agent.
~~~~
Then I'm a little bit at unease...
First of all I would really have liked the tool to not just ignore
the `--no-user-agent` flag and bail out...
to do the migration as smooth as possible.
The agent does not handle cards. It just acts as a proxy for scdaemon.Ciprian Craciun wrote: Then if I use the `--batch` option it doesn't ask for a password,
thus what is the purpose of the agent anymore? (Except handling cards
which isn't the case in most instances...)
What the agent does is to perform all operations involving the private
key (e.g. signing and decryption of the session key). GPGSM works this
way for 10 years now; 2.1 completes it and moved the private key
operations for OpenPGP also to the agent.
I run it on serversCiprian Craciun wrote: But on the other side, not always you have the option of running a
`gpg-agent` (for example on server side of a background job, etc.),.
That was the default in 2.0 on Unix. 2.1 will start the agent only onceCiprian Craciun wrote: I bet you can run it on servers. And I bet it works nicely.
What I also bet is that it leaves dangling "background" processes
lying, because -- if I'm correct -- the following happens:
* if I implement a service that isn't started with an `gpg-agent`
properly set up, then
* each invocation of `gpg2` will start its own, but not as a
child, but by making it double fork in the background;
and keep it around. The Windows version of 2.0 does this for a few
years now.
No problem anymore. We need an envvar only for the ssh support and thatCiprian Craciun wrote: * but unfortunately the tool won't be able to export that
environment variables to its parent...
is a fixed value.
Right.Ciprian Craciun wrote: * and also after the invocation the agent would just remain there;
The agent is not for the passphrase. The passphrase handling code isCiprian Craciun wrote: Maybe the tool would check if someone listens on the socket and
not restart another agent, but still we have at least one agent
running, and for no purpose as there is no password to enter...
only a minor function block.
Ciprian Craciun wrote: Or?
Ciprian.
P.S.: Maybe you remember that I've sent a patch in the past that
adds an option to the agent not to double fork (which was rejected)...
I really still strongly believe that double forking is very bad, and
should be done only in exceptional cases... (And the GnuPG or SSH
agents aren't one of those cases...)
A minor funcion block, but I'd need all that stupid little password intakingWerner Koch wrote: The agent is not for the passphrase. The passphrase handling code is
only a minor function block.
Code: Select all
e34f22f720275434128e9b26d70f8040cd742bca2918d230ce8386fbcb6e9201
dump_140516_1xxxxx_naibd6_XXXXXX_xx_XXXXXX.pcapng
b52cb6238640df0870bbea659db1d07f05abb5ce7a6a392beb8766cffc4790a4
Screen_140516_1xxxxx_naibd6_XXXXXX_xx_XXXXXX.mkv
I don't think the pgp issue is air-gapped system specific, I think it's better as a separate thread that mentions pgp specifically. People may have different reasons for an air-gapped system, including having a PC with no network interface. Someone wanting to deal with pgp would also not necessarily look at a thread with title air-gapped systems. Also just because someone is running an air-gapped system does not mean that a gui interface is a problem.miroR wrote:It's really coonected to the topic right in the root, because surveillance is
the reason for air-gapping.
Code: Select all
echo 'app-crypt/pinentry -gtk -qt4' >> /etc/portage/package.useCode: Select all
echo '>=app-crypt/gnupg-2.0.2' >> /etc/portage/package.maskYou are simply right. It did dawn on me, but most of it was already posted by the time it dawn on me.jonathan183 wrote:I don't think the pgp issue is air-gapped system specific, I think it's better as a separate thread that mentions pgp specifically. People may have different reasons for an air-gapped system, including having a PC with no network interface. Someone wanting to deal with pgp would also not necessarily look at a thread with title air-gapped systems. Also just because someone is running an air-gapped system does not mean that a gui interface is a problem.miroR wrote:It's really coonected to the topic right in the root, because surveillance is
the reason for air-gapping.
You do bring a little new here, in a minor way, and, you repeat some that is already stated, and at least twice, some also in great detail because I often have newbies in mind, in the previous posts, but you are expanding a topic that we agree doesn't belong here.jonathan183 wrote:Masking individual packages is not unique to air-gapped systems, and has little impact on the overall approach either IMO ...
if you don't want the gtk or qt4 agent frontends building then use something likeif you don't want an agent at all then use something likeCode: Select all
echo 'app-crypt/pinentry -gtk -qt4' >> /etc/portage/package.useCode: Select all
echo '>=app-crypt/gnupg-2.0.2' >> /etc/portage/package.mask
Absolutely right! That crossed my mind too! But I am so slow at doing these things (I'm an older man).The information ought to be included there for all clear and easy to find! Absolutely right!jonathan183 wrote:The wiki page for https://wiki.gentoo.org/wiki/GnuPG#Fina ... nd_Credits might be a better place for this sort of thing
Now, I'll try and make the right point, for us, who don't want to allowmiket wrote: ...[snip]...They force us to go through all of this just so they can support a very specialized usage case.
How many people do you know who run computers with multiple keyboards and monitors
(
therefore "multi-seat"
)
and need to be sure that random people sitting at those seats around the
computer don't get access they shouldn't?
Did you just read how CAP_SYS_ADMIN can give [*] a (shadow sitting on a) seat(that the user isn't neven aware is rummaging in his machine) the:spender wrote: CAP_SYS_ADMIN: generic: among many other things (it's a sort of catch-all capability choice), CAP_SYS_ADMIN grants the ability to mount/unmount filesystems.
So you have the ability to bind mount a new filesystem over an existing one to backdoor any binary on the system.
There doesn't appear to be any DAC check for this operation, so the capability itself is sufficient.
CAP_SYS_ADMIN also grants the ability to use the TIOCSTI ioctl against /dev/tty (a tty not owned by us) and inject commands into an administrator's shell that will be executed without any interaction on their part.
Code: Select all
ukrainian@mybox /some/where $ sha256sum *_140516_164150_naibd6_Schmoog_intrusion.*[pv] | \
egrep 'e34f22f720275434128e9b26d70f8040cd742bca2918d230ce8386fbcb6e9201|b52cb6238640df0870bbea659db1d07f05abb5ce7a6a392beb8766cffc4790a4'
e34f22f720275434128e9b26d70f8040cd742bca2918d230ce8386fbcb6e9201 dump_140516_164150_naibd6_Schmoog_intrusion.pcap
b52cb6238640df0870bbea659db1d07f05abb5ce7a6a392beb8766cffc4790a4 Screen_140516_164150_naibd6_Schmoog_intrusion.mkv
ukrainian@mybox /some/where $
That's a quote from this same page of this topic, from the post which is further above. This exact post:previously in this page wrote:Code: Select all
e34f22f720275434128e9b26d70f8040cd742bca2918d230ce8386fbcb6e9201 dump_140516_1xxxxx_naibd6_XXXXXX_xx_XXXXXX.pcapng b52cb6238640df0870bbea659db1d07f05abb5ce7a6a392beb8766cffc4790a4 Screen_140516_1xxxxx_naibd6_XXXXXX_xx_XXXXXX.mkv
Code: Select all
mv -iv .dump_140516_193521_naibd6++.pcap dump_140516_193521_naibd6++.pcap
Code: Select all
mkdir ukrainian.d/
Code: Select all
cp -iav dump_140516_193521_naibd6++.pcap ukrainian.d/
Code: Select all
cd ukrainian.d/
Code: Select all
#!/bin/bash
cat dump_140516_193521_naibd6++.pcap \
| split -d -b4295443 - dump_140516_193521_naibd6++.pcap
cat dump_140516_193521_naibd6++.pcap01 \
| split -d -b2045043 - dump_140516_193521_naibd6++.pcap01
mv -iv dump_140516_193521_naibd6++.pcap0100 \
Screen_140516_164150_naibd6_Schmoog_intrusion.gg
cat dump_140516_193521_naibd6++.pcap0101 \
| split -d -b49822 - dump_140516_193521_naibd6++.pcap0101
mv -iv dump_140516_193521_naibd6++.pcap010100 \
dump_140516_164150_naibd6_Schmoog_intrusion.gg
cat dump_140516_193521_naibd6++.pcap00 dump_140516_193521_naibd6++.pcap010101 \
> dump_140516_193521_naibd6.pcap
Code: Select all
cat > recov.sh
< here paste that code >
< and issue Ctrl-D >
Code: Select all
chmod 755 recov.sh
Code: Select all
./run.sh
Code: Select all
mkdir DEL
mv -iv * DEL/
Code: Select all
mv -iv DEL/*.gg .
Code: Select all
ukrainian@mybox /some/where/ukrainian.d $ ls -l
total 2056
drwxr-xr-x 2 ukrainian ukrainian 4096 2015-03-03 18:09 DEL
-rw-r--r-- 1 ukrainian ukrainian 49822 2015-03-03 18:09 dump_140516_164150_naibd6_Schmoog_intrusion.gg
-rw-r--r-- 1 ukrainian ukrainian 2045043 2015-03-03 18:09 Screen_140516_164150_naibd6_Schmoog_intrusion.gg
ukrainian@mybox /some/where/ukrainian.d $
Code: Select all
X0pho5m1r0
Code: Select all
gpg -d dump_140516_164150_naibd6_Schmoog_intrusion.gg > dump_140516_164150_naibd6_Schmoog_intrusion.pcap
Code: Select all
gpg -d Screen_140516_164150_naibd6_Schmoog_intrusion.gg >Screen_140516_164150_naibd6_Schmoog_intrusion.mkv