Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
RFC2324
Jun 7, 2012

http 418

Docjowles posted:

I just tried this on CentOS 6, Ubuntu Trusty, and OS X. It worked all 3 times. Can you tell what version of awk you're running? ("awk -W version").

code:
echo "<heynerds>" | awk -F '[<>]' '{print $2}'
heynerds

This is not Linux or BSD, it is Solaris 10(SunOS 5.10)

And awk -W version does nothing >.<

Glad to see that my syntax should be right, and it is just a version specific thing, tho.

Once I googled this, based on your question about version, I discovered that Solaris has awk or oawk, which is 'old awk' and nawk which is 'new awk'

the statement worked with nawk.

Adbot
ADBOT LOVES YOU

Docjowles
Apr 9, 2009

RFC2324 posted:

This is not Linux or BSD, it is Solaris 10(SunOS 5.10)

And awk -W version does nothing >.<

Glad to see that my syntax should be right, and it is just a version specific thing, tho.

Once I googled this, based on your question about version, I discovered that Solaris has awk or oawk, which is 'old awk' and nawk which is 'new awk'

the statement worked with nawk.

Cool, glad you figured it out! I had a hunch it would be a weird version thing. Since even on Linux, CentOS and Ubuntu were using two different variants of awk. Let alone Solaris.

Odette
Mar 19, 2011

I'm dualbooting Ubuntu 14.04 LTS + Windows8, I have ZERO problems in Windows but on the other hand .. Linux is giving me so many loving problems it's not funny.

Most of my problems stem from network issues. I'm connecting via WiFi as a Wired connection is not possible. My WiFi chipset is a PCI-E adapter that I've had for a while (RTL8192CE PCIe Wireless Network Adapter)

Problems:
1. I can't saturate the bandwidth in Linux, no matter what. I can do so in Windows without any problems.
2. The overall internet speed in Linux is really bad. Like 25% of the speed that I get in Windows, for any service/application.
3. I'll go through periods of time (30min-1hour) where Linux will appear to be connected to the internet but it won't do anything. Examples: Browser stuck on loading pages, ping google.com returns "cannot find host" or something but takes a few minutes to return that, other services experience a sudden 'loading' or general slowdown where NOTHING is loaded at all.

speedtest results for Linux & Windows, respectively:


What can I do to fix this Linux-specific bullshit?

nosl
Jan 17, 2015

CHIM, bitch!

Hollow Talk posted:

Quality poster and linux savant nosl tried to mime to you that the only real solution is to use Arch Linux, for everything, forever.

And somewhat less facetious: Marinmo's link to the OBS works, since they build for Fedora. Another option would be the official mono repository from the mono project itself, which should keep you up-to-date without the need to trust a random person building packages: http://www.mono-project.com/docs/getting-started/install/linux/#centos-fedora-and-derivatives

That's technically option #3.5, since it's an external repository, but at least it is a first-person repository.

gently caress man I hosed up and tried to write snip in his post and post a suggestion. Nah, Arch is a hobbyist's distro, but it's okay for laptops I guess if you don't mind your poo poo breaking. If you want to use up-to-date software with super integration, you are going to have to use a rolling distro like Arch or Gentoo Linux ~ branch, but if you are happy with your current distro I'd just compile poo poo myself. But if you're doing that a lot... then why not switch to Gentoo? But Gentoo sucks for getting poo poo actually done, and like I said - arch is a hobbyists distro.

Sorry for my mucked up post. Hope I cleared up any confusion. Just stick to Fedora and build stuff. Third party repos are scary but not as scary as some official Arch repos have been in the past, and let's not even TALK about the AUR. Heh.

Dead Goon
Dec 13, 2002

No Obvious Flaws



Odette posted:

I'm dualbooting Ubuntu 14.04 LTS + Windows8, I have ZERO problems in Windows but on the other hand .. Linux is giving me so many loving problems it's not funny.

What can I do to fix this Linux-specific bullshit?

RealTek kernal drivers for Linux are broken, I had almost exactly the same problems you described with an RTL8192CU using Ubuntu.

I fixed it by following this guide - https://github.com/pvaret/rtl8192cu-fixes

It says RTL8192CU but a quick Google makes me think it will work with your RTL8192CE too.

Experto Crede
Aug 19, 2008

Keep on Truckin'

Odette posted:

I'm dualbooting Ubuntu 14.04 LTS + Windows8, I have ZERO problems in Windows but on the other hand .. Linux is giving me so many loving problems it's not funny.

Most of my problems stem from network issues. I'm connecting via WiFi as a Wired connection is not possible. My WiFi chipset is a PCI-E adapter that I've had for a while (RTL8192CE PCIe Wireless Network Adapter)

Problems:
1. I can't saturate the bandwidth in Linux, no matter what. I can do so in Windows without any problems.
2. The overall internet speed in Linux is really bad. Like 25% of the speed that I get in Windows, for any service/application.
3. I'll go through periods of time (30min-1hour) where Linux will appear to be connected to the internet but it won't do anything. Examples: Browser stuck on loading pages, ping google.com returns "cannot find host" or something but takes a few minutes to return that, other services experience a sudden 'loading' or general slowdown where NOTHING is loaded at all.

speedtest results for Linux & Windows, respectively:


What can I do to fix this Linux-specific bullshit?

I had a similar issue with that same card on xubuntu 15.04. Problem seems to be that it's trying to drop into some weird sort of powersaving mode which linux doesn't like.

Try running this in your terminal:

code:
echo "options rtl8192ce ips=0 fwlps=0" | sudo tee /etc/modprobe.d/rtl8192ce.conf && rmmod rtl8192ce && modprobe rtl8192ce
Which basically inserts a line that says "Don't try to use any sort of powersaving features on this card" into the kernel module configuration file and then restarts the module.

I've personally not had any power usage issues related to this but my connection is a lot more stable now.

Odette
Mar 19, 2011

While that probably works, I just switched to a USB wifi adapter that seems to work.

I'll be building another PC next year or so, should I just stick to Intel/Atheros for WiFi?

The_Franz
Aug 8, 2003

Odette posted:

While that probably works, I just switched to a USB wifi adapter that seems to work.

I'll be building another PC next year or so, should I just stick to Intel/Atheros for WiFi?

That's a good choice no matter what OS you are running. Realtek networking chips are the modern equivalent of winmodems.

Odette
Mar 19, 2011

The_Franz posted:

That's a good choice no matter what OS you are running. Realtek networking chips are the modern equivalent of winmodems.

Even their Ethernet offerings? I've been looking at motherboards & Realtek is the most common chip, it's a bit shocking.

Not Wolverine
Jul 1, 2007

Odette posted:

Even their Ethernet offerings? I've been looking at motherboards & Realtek is the most common chip, it's a bit shocking.

I'm not afraid of Realtek Ethernet chips, I have never tried a Realtek wireless chip. They use a few more precious CPU cycles than an Intel LAN but they have worked fine for me. That said, I am afraid of anything D-Link.

ExcessBLarg!
Sep 1, 2001

Odette posted:

I've been looking at motherboards & Realtek is the most common chip, it's a bit shocking.
They're dirt cheap.

Realtek WiFi chips were truly awful a decade ago. I made the mistake of buying a Realtek-based USB adapter and swore never again. Recently I've had the misfortune to use another USB adapter that was crashing multiple times day. Yep, it's a RTL892CU ....

I haven't had the same problems with Realtek's wired Ethernet adapters, but they're not particularly great performers either. Ten years ago is also when Intel Gigabit Ethernet adapters became sufficiently cheap (in absolute terms) that I've used them in any non-toy project.

Baconroll
Feb 6, 2009
On a throw-away test Linux vm I'd like to be able to force the system to require a manual fsck of the root filesystem on boot. I'm wondering if it could be something like setting a dirty flag, or maybe using dd to cause a minor corruption ?

Any suggestions appreciated.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Baconroll posted:

On a throw-away test Linux vm I'd like to be able to force the system to require a manual fsck of the root filesystem on boot. I'm wondering if it could be something like setting a dirty flag, or maybe using dd to cause a minor corruption ?

Any suggestions appreciated.
touch /forcefsck

ToxicFrog
Apr 26, 2008


Baconroll posted:

On a throw-away test Linux vm I'd like to be able to force the system to require a manual fsck of the root filesystem on boot. I'm wondering if it could be something like setting a dirty flag, or maybe using dd to cause a minor corruption ?

Any suggestions appreciated.

It depends on the distro and/or filesystem.

touch /forcefsck should work for older (SysVinit-based) systems. Adding fsck.mode=force to the boot parameters should work for systemd-based ones.

For filesystem-specific options, you can use tune2fs -c 1 to set the "max mounts between fsck" to 1 for ext2/3/4 filesystems, or add zpool scrub to your startup scripts for ZFS. btrfs and XFS presumably have something similar, but I don't know what.

RFC2324
Jun 7, 2012

http 418

I have an older laptop that currently has a pirated copy of win 7 pro that we are giving to my GFs 88 year old grandma. I am not gonna give her the pirated windows(its not actually cracked, so you have to reset the registry periodically to extend the trial for another year or 2).

What would be a good, reliable, distro for someone 88 years old, who just needs to get on email and surf porn? Assume she will have no tech support(I'm not driving from Texas to Florida to work on her comp).

CaptainSarcastic
Jul 6, 2013



RFC2324 posted:

I have an older laptop that currently has a pirated copy of win 7 pro that we are giving to my GFs 88 year old grandma. I am not gonna give her the pirated windows(its not actually cracked, so you have to reset the registry periodically to extend the trial for another year or 2).

What would be a good, reliable, distro for someone 88 years old, who just needs to get on email and surf porn? Assume she will have no tech support(I'm not driving from Texas to Florida to work on her comp).

I'd say openSUSE KDE. You can set it up with the apps she will need, make a user account for her with the proper rights, and then she will have a much harder time messing anything up. Users can run the updates without needing root permissions, and the update tool gives alerts when updates are needed.

A lot of the stuff not in the official repositories, like proprietary video drivers, can be found here:

http://opensuse-community.org/

I set up a machine for my nieces using this setup, and the only time I received a tech supportish question was when their mother called me to get the root password so she could remove the time limits my brother had asked me to impose on the girls' accounts.

You might also be able to use Teamviewer or something similar to remote access the machine if needed.

CaptainSarcastic fucked around with this message at 22:57 on Jun 23, 2015

tuyop
Sep 15, 2006

Every second that we're not growing BASIL is a second wasted

Fun Shoe
Is there any easy way to get the latest Broadcom bcm43xx chipset in Apple's AirPort Extreme cards working with aircrack-ng without spending money and hours installing the drivers?

I'm teaching some network security stuff (along with lockpicking) to kids this summer and I'd rather not spend like 40 bucks of the organization's money on a compatible USB network card.

evol262
Nov 30, 2010
#!/usr/bin/perl
Maybe. Google a lot. Then buy an atheros.

tuyop
Sep 15, 2006

Every second that we're not growing BASIL is a second wasted

Fun Shoe

evol262 posted:

Maybe. Google a lot. Then buy an atheros.

Yeah, the antenna card thing is In the mail. :(

Xenomorph
Jun 13, 2001
Dumb question, as I don't have all the details (and it's not my computer) - but is there a known issue with certain WiFi managers failing to connect if a username is too long or has special characters in it?

I'm not sure of the distribution used - I think it's something called Trisquel Linux 7.0. It looks like it was the LXDE desktop environment with "NetworkManager" for WiFi.

Connect using "username" and it works. Connect using "my.longer.username" and it does not. Where should I be looking to diagnose this? The WiFi AP doesn't even see an authentication attempt from the longer username. It's like the WiFi connection times out, then just prompts for the password again without ever trying to connect.

evol262
Nov 30, 2010
#!/usr/bin/perl

Xenomorph posted:

Dumb question, as I don't have all the details (and it's not my computer) - but is there a known issue with certain WiFi managers failing to connect if a username is too long or has special characters in it?

I'm not sure of the distribution used - I think it's something called Trisquel Linux 7.0. It looks like it was the LXDE desktop environment with "NetworkManager" for WiFi.

Connect using "username" and it works. Connect using "my.longer.username" and it does not. Where should I be looking to diagnose this? The WiFi AP doesn't even see an authentication attempt from the longer username. It's like the WiFi connection times out, then just prompts for the password again without ever trying to connect.

Try "grep -iR networkmanager /var/log/*"

I have no idea what logging structure Trisquel uses (/var/log/messages, /var/log/syslog, /var/log/daemon.log, something else entirely)

General_Failure
Apr 17, 2005
Pretty sure brain rot has set in. Help.

Running lubuntu 15.04. I want some variety of terminal accessible to my LAN only. Not sure which way would be the best to go. I don't want anything like RDP etc. Just text. Mostly for doing bits and pieces on my PC from my tablet like starting userspace daemons, perhaps some coding and compiling, general tweaking or whatever.

How should I set this up? Networking isn't my strongest skillset.

Hollow Talk
Feb 2, 2014

General_Failure posted:

Pretty sure brain rot has set in. Help.

Running lubuntu 15.04. I want some variety of terminal accessible to my LAN only. Not sure which way would be the best to go. I don't want anything like RDP etc. Just text. Mostly for doing bits and pieces on my PC from my tablet like starting userspace daemons, perhaps some coding and compiling, general tweaking or whatever.

How should I set this up? Networking isn't my strongest skillset.

Do you need anything that would require more than simply using SSH? I'm not sure if there exist any decent ssh apps for iOS, but ConnectBot works very well on Android. SSH is probably running anyway (check ps aux | grep sshd), and you can either use your firewall or iptables to restrict it to network internal addresses only (i.e. to the local subnet etc.), or you can simply let it run normally if your home network is firewalled from the outside world (which I assume it is).

ghostinmyshell
Sep 17, 2004



I am very particular about biscuits, I'll have you know.
I've been asked to build a Ubuntu 14 DNS Server with GeoIP capabilities. Anyone have some recommendations on the DNS or GeoIP applications? I never setup either before and if you have some handy guides I wouldn't mind looking at them.

spankmeister
Jun 15, 2008






For DNS use bind or possibly powerDNS

Geoip use maxmind I guess but I don't have experience with that.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

ghostinmyshell posted:

I've been asked to build a Ubuntu 14 DNS Server with GeoIP capabilities. Anyone have some recommendations on the DNS or GeoIP applications? I never setup either before and if you have some handy guides I wouldn't mind looking at them.
Seriously, just use Route53 or something. It will literally cost you single-digit dollars per month. Don't waste your salary on solved problems.

Docjowles
Apr 9, 2009

Yeah if outsourcing DNS is acceptable just do that. There are roughly infinity providers, and depending on how complex your needs are whoever you registered your domain through might even do it for free.

If it has to be in house, BIND is the gold standard. PowerDNS is nice in that you can back it with MySQL or something which is much more automation friendly than lovely BIND zone files.

waffle iron
Jan 16, 2004
Do any Red Hat/GNOME 3 people know of a decent "baby's first nontrivial GTK 3 application" guide/book? I'm looking for one that includes a sample project/repository with best practices file structure for packaging. Python would be good, but I'm willing to deal with C or even learn Vala.

I tried searching Amazon for O'Reilly style book, but didn't find anything that looked promising.

ghostinmyshell
Sep 17, 2004



I am very particular about biscuits, I'll have you know.

Vulture Culture posted:

Seriously, just use Route53 or something. It will literally cost you single-digit dollars per month. Don't waste your salary on solved problems.

Thanks for the options, I'll check them out. Unfortunately mgmt is all about inhouse cheap as peanuts, but I'll see if I can present Amazon as well.

ghostinmyshell fucked around with this message at 06:17 on Jun 29, 2015

Death Vomit Wizard
May 8, 2006
Bottom Feeder
My proprietary nvidia driver crapped the bed a couple days ago in Fedora 22. I'm just posting my fix in case anyone else has the same issue:

code:
dnf remove akmod-nvidia-340xx.x86_64
dnf --nogpg --releasever=21 install akmod-nvidia-340xx
This requires the rpmfusion-nonfree-updates repo.

Edit: OK, here's a question: I tried to disable updates to akmod-nvidia (and kmod-nvidia) so that this wouldn't be undone. To do this I added
code:
exclude=akmod*
exclude=kmod*
to my /etc/yum.conf and /etc/dnf/dnf.conf, but this doesn't seem to have any effect. When I do "dnf update" it wants to install the F22 akmod/kmod drivers.

Death Vomit Wizard fucked around with this message at 12:31 on Jul 1, 2015

reading
Jul 27, 2013
When I cat /proc/meminfo and it shows "hardware failures" or "hardware bad sectors" (can't remember the exact text) is that the actual bits which have failed and are being ignored, like it sounds? Will memtotal show a corresponding drop in total memory over time?

other people
Jun 27, 2004
Associate Christ
I want to blow away the Windows partitions on this disk and add them to the LVM pool:

code:
a# fdisk -l /dev/sda

Disk /dev/sda: 320.1 GB, 320072933376 bytes, 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x78033e78

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2       260098048   584050687   161976320   8e  Linux LVM
/dev/sda3       163842048   260098047    48128000    7  HPFS/NTFS/exFAT
/dev/sda4       584181760   625139711    20478976    f  W95 Ext'd (LBA)
/dev/sda5       584183808   625139711    20477952    7  HPFS/NTFS/exFAT

Partition table entries are not in disk order
It is curious to me that what is named sda3 is actually on the physical disk before the partition named sda2. I never realized the naming was ever anything other than physical partition order.

I imagine I will need to change the partition type of what is now /dev/sda3 to LVM and then I can safely delete what is now sda4 and sda5 and make a new LVM partition there?

Gucci Loafers
May 20, 2006

Ask yourself, do you really want to talk to pair of really nice gaudy shoes?


How am I suppose to read this?

code:
[ted@localhost ~]$ date --help
Usage: date [OPTION]... [+FORMAT]
  or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.
The first part makes sense, "[OPTION]..." indicates I can give date an unlimited amount of options but I don't understand what [+FORMAT] is trying to indicate? With the absence of"..." that tells you that you may only have one [+FORMAT] but doesn't explain much more.

I'm following the second half, the [-u|--utc|--universal] means I can pick either -u or --utc but not both but the [MMDDhhmm[[CC]YY][.ss]] is beyond me other than Month, Day, Hour, Minute, CC?, Year and seconds.

Gucci Loafers fucked around with this message at 19:26 on Jul 5, 2015

Powered Descent
Jul 13, 2008

We haven't had that spirit here since 1969.

Tab8715 posted:

How am I suppose to read this?

code:
[ted@localhost ~]$ date --help
Usage: date [OPTION]... [+FORMAT]
  or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.
The first part makes sense, "[OPTION]..." indicates I can give date an unlimited amount of options but I don't understand what [+FORMAT] is trying to indicate? With the "..." that tells you that you may only have one [+FORMAT] but doesn't explain much more.

I'm following the second half, the [-u|--utc|--universal] means I can pick either -u or --utc but not both but the [MMDDhhmm[[CC]YY][.ss]] is beyond me other than Month, Day, Hour, Minute, CC?, Year and seconds.

The format string lets you customize the output format to your heart's content and comes after the other option flags. The various fields you can put in it are all listed in the man page. For example:

code:
powereddescent@bigblue ~ $ date -u "+Today is %Y-%m-%d and the time is %H:%M"
Today is 2015-07-05 and the time is 18:25

hifi
Jul 25, 2012

To add to that, the second form is for setting the date.

kujeger
Feb 19, 2004

OH YES HA HA
and generally, if --help is too terse to understand, try the man page!

telcoM
Mar 21, 2009
Fallen Rib

Kaluza-Klein posted:

I want to blow away the Windows partitions on this disk and add them to the LVM pool:

code:
a# fdisk -l /dev/sda

Disk /dev/sda: 320.1 GB, 320072933376 bytes, 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x78033e78

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2       260098048   584050687   161976320   8e  Linux LVM
/dev/sda3       163842048   260098047    48128000    7  HPFS/NTFS/exFAT
/dev/sda4       584181760   625139711    20478976    f  W95 Ext'd (LBA)
/dev/sda5       584183808   625139711    20477952    7  HPFS/NTFS/exFAT

Partition table entries are not in disk order
It is curious to me that what is named sda3 is actually on the physical disk before the partition named sda2. I never realized the naming was ever anything other than physical partition order.

I imagine I will need to change the partition type of what is now /dev/sda3 to LVM and then I can safely delete what is now sda4 and sda5 and make a new LVM partition there?

The naming of partitions 1-4 matches the order of the primary partition entries in the partition table. It is usually recognized as a good thing to have these match the physical partition order, but that is not strictly mandatory. Linux accepts primary partitions in any order; other operating systems and/or some old BIOSes might not.

You don't actually _need_ to change the partition type: LVM can use the partitions even if the partition type is incorrect. It relies on the PV signature written to the beginning of the partition with pvcreate.

If you don't feel like editing the partition table, you could just run these commands:
code:
# pvcreate /dev/sda3
# pvreate /dev/sda5
Then, depending on whether you want to extend an existing LVM volume group or to create a new volume group:

Extension:
code:
# vgextend <name of existing VG> /dev/sda3 /dev/sda5
Creation of a new VG using both new PVs:
code:
# vgcreate <name of new VG> /dev/sda3 /dev/sda5
After that, the new space is available in your VG and you can use it to extend your existing logical volumes and/or to create new ones.
Note that the size of each PV does not in any way restrict the size of the LVs: a single LV can span any number of PVs.


But if you want to change the type of /dev/sda3 (and optionally sda5), then maybe also delete the sda4/5 extended partition/logical disk combo and then recreate sda4 as a single primary partition with an appropriate type, you can certainly do that.

Reasons why you might want to set the correct partition types:
- the satisfaction of having a neatly-configured system
- in case the system is ever booted with a non-Linux external media (i.e. Windows PE or similar), correct partition types ensure that the other OS won't detect them as badly corrupted NTFS/exFAT partitions and attempt to auto-recover (or maybe offer to format) them.

Reasons why you might want to remove sda5 and make sda4 into a regular primary partition:
- you might get some tiny amount of extra usable space, as you can reclaim the unused blocks between the start of sda4 and the start of sda5

Reasons why you might not want to fiddle with the partition table:
- modifying the partition table of a working system always has some non-zero risk of mistakes

However, in your case, the risk is as small as it can be for such an operation: changing the partition types is a trivial operation, and sda4 & sda5 are at the tail end of both the partition table and the actual disk.

If this system is in "production" role or any other way important to you, stop reading here.

For the following, I'm assuming that your version of Linux is not some ancient one that uses older than 2.6 series kernel and LVM version 1. Also, your fdisk tool must be a version that won't automatically zero the first 512 bytes of any partition it creates; check the man page.

If you have good backups and this is a system you can afford some experimenting on, you might even delete sda5 and sda4, then edit sda2 to have its end point at sector 625139711.

As long as sda2's start point stays at its current value, there *should* not be any damage to its contents.
After a successful reboot to have the OS fully detect the new partition table, you could then use "pvresize /dev/sda2" to make LVM recognize sda2's new size.
That will still leave you with sda3 as a separate entity, but with LVM that is not a problem.

GreenBuckanneer
Sep 15, 2007

I'm trying to figure out how to prevent all incoming/outgoing network activity but allow another specific computer to use telnet/ssh to the linux box along with web access (don't seem to need ssl) with iptables but I rarely do this, anyone got any tips for me?

I was thinking:

sudo iptables -A INPUT -s website -j DROP

but that wasn't enough to prevent outgoing activity so I have to be a bit more strict.

Tried a few other examples I found online, but they didn't quite seem to work. Basically I need access from one computer to the linux os, via putty or cygwin, and web access to get to the running apache server on the box to communicate back and forth to me, but not to the internet. Any tips?

also: is there a way to save existing iptable configs to revert back to them?

GreenBuckanneer fucked around with this message at 19:24 on Jul 6, 2015

Hollow Talk
Feb 2, 2014

GreenBuckanneer posted:

I'm trying to figure out how to prevent all incoming/outgoing network activity but allow another specific computer to use telnet/ssh to the linux box along with web access (don't seem to need ssl) with iptables but I rarely do this, anyone got any tips for me?

I was thinking:

sudo iptables -A INPUT -s website -j DROP

but that wasn't enough to prevent outgoing activity so I have to be a bit more strict.

Tried a few other examples I found online, but they didn't quite seem to work. Basically I need access from one computer to the linux os, via putty or cygwin, and web access to get to the running apache server on the box to communicate back and forth to me, but not to the internet. Any tips?

also: is there a way to save existing iptable configs to revert back to them?

If the computer that needs to have access has a static IP, you can allow it via -A INPUT -s $IP -j ACCEPT, or, if you would like to restrict this, you can probably do it for ports 22 and 80 (you can either define separate rules using "-p tcp --dport x" or pack them into one via "--dports x,y". As far as outgoing connections are concerned, your posted rule cannot work, because it's trying to block outgoing connections in the chain that deals with incoming connections. The chain you will need for this is OUTPUT, and you would have to put a destination, not source there.

Essentially: For INPUT, allow everything from SOURCE computer (or only port 22 and 80), drop everything else; for OUTPUT, allow everything to DESTINATION computer, drop everything else.

However, I do not have a whole lot of experience with filtering outgoing traffic, so somebody else might be able to chime in.

Adbot
ADBOT LOVES YOU

evol262
Nov 30, 2010
#!/usr/bin/perl

GreenBuckanneer posted:

I'm trying to figure out how to prevent all incoming/outgoing network activity but allow another specific computer to use telnet/ssh to the linux box along with web access (don't seem to need ssl) with iptables but I rarely do this, anyone got any tips for me?

I was thinking:

sudo iptables -A INPUT -s website -j DROP

but that wasn't enough to prevent outgoing activity so I have to be a bit more strict.

Tried a few other examples I found online, but they didn't quite seem to work. Basically I need access from one computer to the linux os, via putty or cygwin, and web access to get to the running apache server on the box to communicate back and forth to me, but not to the internet. Any tips?

also: is there a way to save existing iptable configs to revert back to them?

iptables relies on IPs. It doesn't do DNS or hostname lookups.

Set the default policy to drop, then add whitelists
code:
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -A INPUT -p tcp -m tcp -s $client --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -d $client -m state --state ESTABLISHED,RELATED -j ACCEPT

GreenBuckanneer posted:

web access to get to the running apache server on the box to communicate back and forth to me, but not to the internet. Any tips?
I have no idea what this means. Where is the web server running? The server that you need to SSH to? The client? Somewhere else entirely? Which system needs to access it?

What distro is this? Rules may be saved in /etc/sysconfig/iptables or /etc/iptables/rules (if it's a debian system with iptables-persistent) or somewhere else if your scripts use iptables-save|restore. Or you may have to set that up yourself.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply