Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #247474 > unrolled thread

macchanger - is it still working?

Started byHans <hans.ullrich@loop.de>
First post2022-04-24 14:40 +0200
Last post2022-05-13 17:20 +0200
Articles 3 on this page of 23 — 6 participants

Back to article view | Back to linux.debian.user


Contents

  macchanger - is it still working? Hans <hans.ullrich@loop.de> - 2022-04-24 14:40 +0200
    Re: macchanger - is it still working? Reco <recoverym4n@enotuniq.net> - 2022-04-24 15:20 +0200
      Re: macchanger - is it still working? Hans <hans.ullrich@loop.de> - 2022-04-24 15:30 +0200
        Re: macchanger - is it still working? "Andrew M.A. Cater" <amacater@einval.com> - 2022-04-24 16:20 +0200
          Re: macchanger - is it still working? "tv.debian" <tv.debian@googlemail.com> - 2022-04-24 16:30 +0200
          Re: macchanger - is it still working? Hans <hans.ullrich@loop.de> - 2022-04-24 16:50 +0200
        Re: macchanger - is it still working? David Wright <deblis@lionunicorn.co.uk> - 2022-04-24 17:00 +0200
          Re: macchanger - is it still working? Hans <hans.ullrich@loop.de> - 2022-04-24 17:10 +0200
            Re: macchanger - is it still working? David Wright <deblis@lionunicorn.co.uk> - 2022-04-24 18:10 +0200
              Re: macchanger - is it still working? Hans <hans.ullrich@loop.de> - 2022-04-24 19:10 +0200
        Re: macchanger - is it still working? Reco <recoverym4n@enotuniq.net> - 2022-04-24 19:10 +0200
          Re: macchanger - is it still working? Hans <hans.ullrich@loop.de> - 2022-04-24 19:30 +0200
          Re: macchanger - is it still working? David Wright <deblis@lionunicorn.co.uk> - 2022-04-24 20:50 +0200
          Re: macchanger - is it still working? Hans <hans.ullrich@loop.de> - 2022-05-09 09:00 +0200
            Re: macchanger - is it still working? David Wright <deblis@lionunicorn.co.uk> - 2022-05-09 19:30 +0200
              Re: macchanger - is it still working? Hans <hans.ullrich@loop.de> - 2022-05-09 19:50 +0200
                Re: macchanger - is it still working? David Wright <deblis@lionunicorn.co.uk> - 2022-05-10 01:20 +0200
            Re: macchanger - is it still working? Stefan Krusche <linux@stefan-krusche.de> - 2022-05-13 13:20 +0200
              Re: macchanger - is it still working? Stefan Krusche <linux@stefan-krusche.de> - 2022-05-13 13:40 +0200
            Re: macchanger - is it still working? Stefan Krusche <linux@stefan-krusche.de> - 2022-05-13 13:30 +0200
              Re: macchanger - is it still working? Hans <hans.ullrich@loop.de> - 2022-05-13 16:30 +0200
                Re: macchanger - is it still working? Stefan Krusche <linux@stefan-krusche.de> - 2022-05-13 16:50 +0200
                Re: macchanger - is it still working? David Wright <deblis@lionunicorn.co.uk> - 2022-05-13 17:20 +0200

Page 2 of 2 — ← Prev page 1 [2]


#248157

FromHans <hans.ullrich@loop.de>
Date2022-05-13 16:30 +0200
Message-ID<EmEsN-fdWy-13@gated-at.bofh.it>
In reply to#248151
Am Freitag, 13. Mai 2022, 13:21:17 CEST schrieb Stefan Krusche:
Hi Stefan,

I believe, changing the ifup-script might be a good idea. Additionally I will 
try to set the environment variable in /etc/default/macchanger to my needs. 

At the moment I am using a random MAC set by network-manager, but this one is 
always the same, what I also do not want. 

As I would like to forget about changing my MAC whenever I am online, 
macchanger looks like the best solution.

In the meantime I filed a buugreport to it,  because as we see, macchanger 
does not do its job by default as intended.

So it is indeed buggy! Or let's say: Its configuration and scripts are buggy.

I will also take a look at your script, maybe this will work, too.

Thank you for the help!

Best regards

Hans
> Good Day Everyone,
> 
> Am Montag, 9. Mai 2022 schrieb Hans:
> > IFACE = --all
> > /usr/bin/macchanger: unrecognized option '--all'
> > GNU MAC Changer
> 
> Yes. The problem is that the script /etc/macchanger/ifupdown.sh which is
> shipped with the macchanger package processes $IFACE without checking
> its value.
> 
> package=macchanger
> /usr/bin/${package} -e $IFACE >> $LOGFILE 2>&1
> 
> When $IFACE == "--all" which is a valid option for ifup as David pointed
> out then macchanger fails and reports the above error message to its
> logfile because macchanger understands "--all" as on option which it
> doesn't know.
> 
> Am Montag, 9. Mai 2022 schrieb David Wright:
> > A workaround for your problem might be to set IFACE appropriately
> > in /etc/default/macchanger.
> 
> A solution I found is to change the script /etc/macchanger/ifupdown.sh
> so that it checks for the value of $IFACE against the value of
> $ENABLE_INTERFACES (sourced from /etc/default/macchanger) and only then
> processes that accordingly. $ENABLE_INTERFACES on my system contains
> only "net0" so all is fine here.
> 
> A version of this script which works on my system (Devuan Beowulf) is
> attached.
> 
> Another approach I haven't tested yet could be to add "--" to the line
> which invokes maccanger so that the value of "$IFACE" being "--all"
> wouldn't be treated as an option but as an argument and given to ifup
> or whatever macchanger internally uses to actually change the MAC. But
> I don't know if macchanger understands "--".
> 
> /usr/bin/$package -a -- "$IFACE" >> $LOGFILE 2>&1
> 
> HTH
> 
> Kind regards,
> Stefan
> 
> 
> 
> $ cat /etc/macchanger/ifupdown.sh
> #!/bin/sh
> # $Id: ifupdown.sh,v 2.0 2021-04-21 16:23:42+02 stekru Exp $
> # randomize MAC address before connecting to wifi or ethernet
> #
> # This script should always be run in if-pre-up.d, but unfortunately
> # NetworkManager does not run if-pre-up.d scripts before it sets up a
> network
> # connection (https://bugzilla.gnome.org/show_bug.cgi?id=387832).
> # if-post-down.d scripts are run, so there is a symlink to this script
> # there. That means when running network config from the terminal,
> macchanger
> # will be run twice, but it'll only be run in if-post-down.d when using
> # NetworkManager.
> 
> package=macchanger
> LOGFILE=/var/log/$package.log
> #LOGFILE=~/.local/log/$package.log
> 
> echo >> $LOGFILE
> date '+%Y-%m-%d %T'  >> $LOGFILE
> 
> # Vorgaben einlesen; hier wird auch ENABLE_INTERFACES="net0" eingelesen.
> if [ -f /etc/default/$package ]; then
>     . /etc/default/$package
> else
>     echo "Config file /etc/default/$package not found" >> $LOGFILE
>     exit 1
> fi
> 
> if [ "$ENABLE_ON_POST_UP_DOWN" != "true" ]; then
>     echo "Macchanger is disabled in /etc/default/$package" >> $LOGFILE
>     exit
> fi
> 
> # Where comes '$IFACE' from? From networking or ifup/-down/-query?
> # The variable could be read from the environment. Where (from which
> # program) would it be exported. No arguemnts are being processed here.
> echo "Processing: IFACE = $IFACE" >> $LOGFILE
> 
> if [ -z "$ENABLE_INTERFACES" ]; then
>     echo "No interface enabled in /etc/default/$package" >> $LOGFILE
>     exit 0
> else
>     case "$IFACE" in
>         *$ENABLE_INTERFACES*)
>             /usr/bin/$package -a "$IFACE" >> $LOGFILE 2>&1
>         ;;
>         *)
>             echo "Ignoring not configured interface: $IFACE" >> $LOGFILE
>             exit 0
>         ;;
>     esac
> fi

[toc] | [prev] | [next] | [standalone]


#248158

FromStefan Krusche <linux@stefan-krusche.de>
Date2022-05-13 16:50 +0200
Message-ID<EmEM9-fe2M-9@gated-at.bofh.it>
In reply to#248157
Am Freitag, 13. Mai 2022 schrieb Hans:
> In the meantime I filed a buugreport to it,  because as we see,
> macchanger does not do its job by default as intended.

Yes, it is a bug. It has already been reported in 2015. I referenced 
that in my other message:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780165


Kind regards,
Stefan

PS: no need to CC me, I'm subscribed

[toc] | [prev] | [next] | [standalone]


#248160

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2022-05-13 17:20 +0200
Message-ID<EmFfb-ferl-11@gated-at.bofh.it>
In reply to#248157
On Fri 13 May 2022 at 16:19:52 (+0200), Hans wrote:
> Am Freitag, 13. Mai 2022, 13:21:17 CEST schrieb Stefan Krusche:
> 
> I believe, changing the ifup-script might be a good idea. Additionally I will 
> try to set the environment variable in /etc/default/macchanger to my needs. 
> 
> At the moment I am using a random MAC set by network-manager, but this one is 
> always the same, what I also do not want. 
> 
> As I would like to forget about changing my MAC whenever I am online, 
> macchanger looks like the best solution.

Did you consider systemd's approach, using a .link file? Pros, Cons?

> In the meantime I filed a buugreport to it,  because as we see, macchanger 
> does not do its job by default as intended.
> 
> So it is indeed buggy! Or let's say: Its configuration and scripts are buggy.

Did you track down who or what was setting --all, and where?
I think the bug report says somebody, but presumably, only
someone who hits this bug will be able to search for it.

> I will also take a look at your script, maybe this will work, too.

Cheers,
David.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.debian.user


csiph-web