Giter Site home page Giter Site logo

Comments (15)

konstruktoid avatar konstruktoid commented on July 30, 2024 1

yeah, and that requires access to an external resource which I'm trying to avoid.

from hardening.

konstruktoid avatar konstruktoid commented on July 30, 2024

Thanks for catching this, I believe it's fixed with f4a9c30

from hardening.

hellresistor avatar hellresistor commented on July 30, 2024

nop. Getting the Gateway IP ;)
machine IP: 192.168.52.128
getting ip: 192.168.52.1

for me just. why use sed ?!
ADMINIP="$(hostname -I)"

from hardening.

konstruktoid avatar konstruktoid commented on July 30, 2024

https://github.com/konstruktoid/hardening/blob/master/ubuntu.sh#L50 is the correctly updated version.

can you run hostname -I | sed -E 's/\.[0-9]+ /.0\/24 /g'?
it's overkill, but it's a crude way to catch all local networks if w doesn't get anything useful

~$ hostname -I
10.0.2.15 
~$ hostname -I | sed -E 's/\.[0-9]+ /.0\/24 /g'
10.0.2.0/24 

from hardening.

hellresistor avatar hellresistor commented on July 30, 2024

After installation.. YES. you get right IP during installation. Getting 192.168.52.1
wronip
wronip2

from hardening.

hellresistor avatar hellresistor commented on July 30, 2024

works with this line (I think we have this discussion before ?! no? )

USERIP="$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')"

from hardening.

hellresistor avatar hellresistor commented on July 30, 2024

Try this!
USERIP="$(hostname --all-ip-addresses)"

or this
USERIP="$(ip -o addr show up primary scope global | while read -r num dev fam addr rest; do echo ${addr%/*}; done)"

from hardening.

konstruktoid avatar konstruktoid commented on July 30, 2024

https://manpages.ubuntu.com/manpages/focal/en/man1/hostname.1.html
-I, --all-ip-addresses

from hardening.

hellresistor avatar hellresistor commented on July 30, 2024

and about 2nd line?

from hardening.

konstruktoid avatar konstruktoid commented on July 30, 2024

USERIP="$(ip -o addr show up primary scope global | while read -r num dev fam addr rest; do echo ${addr%/*}; done)"?
Overly complicated.

from hardening.

hellresistor avatar hellresistor commented on July 30, 2024

USERIP="$(ip -o addr show up primary scope global | while read -r num dev fam addr rest; do echo ${addr%/*}; done)"?
Overly complicated.

well. but does what is needed :octocat:

from hardening.

konstruktoid avatar konstruktoid commented on July 30, 2024

hostname -I | sed -E 's/\.[0-9]+ /.0\/24 /g' doesn't work?

from hardening.

hellresistor avatar hellresistor commented on July 30, 2024

like command "says"
will replace the ip to a subnet ip 192.168.1.0/24

from hardening.

konstruktoid avatar konstruktoid commented on July 30, 2024

Yes, and that's the point, if we don't get a valid address from the w command, e.g. when installing locally, we'll allow the /24 subnet so we can administer the machine afterwards of ssh.

https://github.com/konstruktoid/hardening/blob/master/ubuntu.sh#L47-L51

    USERIP="$($WBIN -ih | awk '{print $3}' | head -n1)"

    if [[ "$USERIP" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
      ADMINIP="$USERIP"
    else
      ADMINIP="$(hostname -I | sed -E 's/\.[0-9]+ /.0\/24 /g')"
    fi

from hardening.

github-actions avatar github-actions commented on July 30, 2024

This issue is stale because it has been open 30 days with no activity, without any activity this will be closed in 5 days.

from hardening.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.