expect, mpd5 and dynamic config loading The Next CEO of Stack OverflowSimple EXPECT script to execute remote command and displat outputHow to print the name of an expect script?Expect timeout, in Bash scriptingExpect Script, timeouts and error checkingSU and Run Command Using Expectexpect script + write “if” in expect scriptscreen, expect and scripted detached interactionexpect: how to use expect scripts from within a bash subroutineRouter config export via expect script - username in enable?Ansible “expect” module with sudo?

Planeswalker Ability and Death Timing

Ising model simulation

Why does sin(x) - sin(y) equal this?

Compensation for working overtime on Saturdays

My boss doesn't want me to have a side project

Can this transistor (2N2222) take 6 V on emitter-base? Am I reading the datasheet incorrectly?

Strange use of "whether ... than ..." in official text

Is the offspring between a demon and a celestial possible? If so what is it called and is it in a book somewhere?

Can I cast Thunderwave and be at the center of its bottom face, but not be affected by it?

Early programmable calculators with RS-232

How exploitable/balanced is this homebrew spell: Spell Permanency?

What difference does it make matching a word with/without a trailing whitespace?

Can a PhD from a non-TU9 German university become a professor in a TU9 university?

Was the Stack Exchange "Happy April Fools" page fitting with the 90s code?

Avoiding the "not like other girls" trope?

How dangerous is XSS

Mathematica command that allows it to read my intentions

Is it okay to majorly distort historical facts while writing a fiction story?

What does this strange code stamp on my passport mean?

Can you teleport closer to a creature you are Frightened of?

Shortening a title without changing its meaning

How to pronounce fünf in 45

Is a distribution that is normal, but highly skewed, considered Gaussian?

Is a linearly independent set whose span is dense a Schauder basis?



expect, mpd5 and dynamic config loading



The Next CEO of Stack OverflowSimple EXPECT script to execute remote command and displat outputHow to print the name of an expect script?Expect timeout, in Bash scriptingExpect Script, timeouts and error checkingSU and Run Command Using Expectexpect script + write “if” in expect scriptscreen, expect and scripted detached interactionexpect: how to use expect scripts from within a bash subroutineRouter config export via expect script - username in enable?Ansible “expect” module with sudo?










1















I have a FreeBSD server that's connected to WAN using PPPoE. Iva esuccessfully set ip the L2TP and PPTP VPN ontop of this PPPoE WAN connection. The problem is that L2TP needs to call 'set lt2p self ` clause to start listening to the udp/1701 port, so when the WAN PPPoE session is reestablished, I need to dynamically set up the L2TP config part. I'm using an expect script to do this, it connects to the mpd5 network console and loads the config part, and does it like this:



set timeout 2
spawn telnet localhost 5005

expect -re "Username: "
send myc00ll0g1nr
exp_continue -continue_timer

expect -re "Password: "
send myc00lpa$$r
exp_continue -continue_timer


# destroying the knob
send "destroy link l2tplinkr"
expect ".+"
send "destroy bundle l2tpbundler"
expect ".+"

# loading the full knob:
send "create bundle template l2tpbundler"
expect ".+"
send "set iface idle 1800r"
expect ".+"
send "set iface enable tcpmssfixr"
expect ".+"
send "set iface group vpnr"
expect ".+"
expect ".+"
send "set ipcp yes vjcompr"
expect ".+"
send "set ipcp ranges 192.168.58.1/32 ippool vpn-poolr"
expect ".+"
send "set ipcp dns 192.168.57.254r"
expect ".+"
send "set bundle enable compressionr"
expect ".+"
send "create link template l2tplink l2tpr"
expect ".+"
send "set link action bundle l2tpbundler"
expect ".+"
send "set link enable multilinkr"
expect ".+"
send "set link yes acfcomp protocompr"
expect ".+"
send "set link no pap chap eap chap-md5 chap-msv1 chap-msv2r"
expect ".+"
send "set link enable chapr"
expect ".+"
send "set link enable papr"
expect ".+"
send "set link enable chap-md5r"
expect ".+"
send "set link enable chap-msv1r"
expect ".+"
send "set link enable chap-msv2r"
expect ".+"
send "set link enable eapr"
expect ".+"
send "set eap no md5 radius-proxyr"
expect ".+"
send "set eap enable eapr"
expect ".+"
send "set eap enable radius-proxyr"
expect ".+"
send "set link keep-alive 10 60r"
expect ".+"
send "set link mtu 1360r"
expect ".+"
send "set link enable incomingr"
expect ".+"
send "set l2tp self 384.656.768.272r"
expect ".+"
send "set link max-children 50r"
expect ".+"
send "set radius server 127.0.0.1 myc00lradiuspa$$r"
expect ".+"
send "set radius retries 3r"
expect ".+"
send "set radius timeout 3r"
expect ".+"
send "set radius me 127.0.0.1r"
expect ".+"
send "set auth acct-update 300r"
expect ".+"
send "set auth enable radius-authr"
expect ".+"


It's fully working when I invoke it interactively via ssh. So I added it into the set iface up-script <expect wrapper> and the expect wrapper is calling it like expect -f myscript.exp. But when it does that on PPPoE connection reestablishing, I receive the following bunch of errors in the mpd.log:



Mar 21 17:42:23 ronin mpd[37412]: [wan] IFACE: Up event
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Connect
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Allocated new console session 0x802000010 from 127.0.0.1
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Failed login attempt from 127.0.0.1
Mar 21 17:42:23 ronin syslogd: last message repeated 34 times
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Error while reading: Connection reset by peer


And this is definitely my expect script (because it does send right about 34 lines of commands). Why ? Why does it work when I invoke it by hand and when mpd5 invokes it - it does not ? Okay, I understand that when I invoke it it has a controlling terminal, and when mpd5 invokes it it does not, but does it matter ? How do I solve this ? Or is the root of the problem something else ?










share|improve this question
























  • what about raising the timeout or add a sleep? maybe mpd5 needs some time? please add an debug output to your script like: ``` log_file /tmp/mylog.txt ```

    – Bastian Bittorf
    yesterday















1















I have a FreeBSD server that's connected to WAN using PPPoE. Iva esuccessfully set ip the L2TP and PPTP VPN ontop of this PPPoE WAN connection. The problem is that L2TP needs to call 'set lt2p self ` clause to start listening to the udp/1701 port, so when the WAN PPPoE session is reestablished, I need to dynamically set up the L2TP config part. I'm using an expect script to do this, it connects to the mpd5 network console and loads the config part, and does it like this:



set timeout 2
spawn telnet localhost 5005

expect -re "Username: "
send myc00ll0g1nr
exp_continue -continue_timer

expect -re "Password: "
send myc00lpa$$r
exp_continue -continue_timer


# destroying the knob
send "destroy link l2tplinkr"
expect ".+"
send "destroy bundle l2tpbundler"
expect ".+"

# loading the full knob:
send "create bundle template l2tpbundler"
expect ".+"
send "set iface idle 1800r"
expect ".+"
send "set iface enable tcpmssfixr"
expect ".+"
send "set iface group vpnr"
expect ".+"
expect ".+"
send "set ipcp yes vjcompr"
expect ".+"
send "set ipcp ranges 192.168.58.1/32 ippool vpn-poolr"
expect ".+"
send "set ipcp dns 192.168.57.254r"
expect ".+"
send "set bundle enable compressionr"
expect ".+"
send "create link template l2tplink l2tpr"
expect ".+"
send "set link action bundle l2tpbundler"
expect ".+"
send "set link enable multilinkr"
expect ".+"
send "set link yes acfcomp protocompr"
expect ".+"
send "set link no pap chap eap chap-md5 chap-msv1 chap-msv2r"
expect ".+"
send "set link enable chapr"
expect ".+"
send "set link enable papr"
expect ".+"
send "set link enable chap-md5r"
expect ".+"
send "set link enable chap-msv1r"
expect ".+"
send "set link enable chap-msv2r"
expect ".+"
send "set link enable eapr"
expect ".+"
send "set eap no md5 radius-proxyr"
expect ".+"
send "set eap enable eapr"
expect ".+"
send "set eap enable radius-proxyr"
expect ".+"
send "set link keep-alive 10 60r"
expect ".+"
send "set link mtu 1360r"
expect ".+"
send "set link enable incomingr"
expect ".+"
send "set l2tp self 384.656.768.272r"
expect ".+"
send "set link max-children 50r"
expect ".+"
send "set radius server 127.0.0.1 myc00lradiuspa$$r"
expect ".+"
send "set radius retries 3r"
expect ".+"
send "set radius timeout 3r"
expect ".+"
send "set radius me 127.0.0.1r"
expect ".+"
send "set auth acct-update 300r"
expect ".+"
send "set auth enable radius-authr"
expect ".+"


It's fully working when I invoke it interactively via ssh. So I added it into the set iface up-script <expect wrapper> and the expect wrapper is calling it like expect -f myscript.exp. But when it does that on PPPoE connection reestablishing, I receive the following bunch of errors in the mpd.log:



Mar 21 17:42:23 ronin mpd[37412]: [wan] IFACE: Up event
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Connect
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Allocated new console session 0x802000010 from 127.0.0.1
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Failed login attempt from 127.0.0.1
Mar 21 17:42:23 ronin syslogd: last message repeated 34 times
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Error while reading: Connection reset by peer


And this is definitely my expect script (because it does send right about 34 lines of commands). Why ? Why does it work when I invoke it by hand and when mpd5 invokes it - it does not ? Okay, I understand that when I invoke it it has a controlling terminal, and when mpd5 invokes it it does not, but does it matter ? How do I solve this ? Or is the root of the problem something else ?










share|improve this question
























  • what about raising the timeout or add a sleep? maybe mpd5 needs some time? please add an debug output to your script like: ``` log_file /tmp/mylog.txt ```

    – Bastian Bittorf
    yesterday













1












1








1








I have a FreeBSD server that's connected to WAN using PPPoE. Iva esuccessfully set ip the L2TP and PPTP VPN ontop of this PPPoE WAN connection. The problem is that L2TP needs to call 'set lt2p self ` clause to start listening to the udp/1701 port, so when the WAN PPPoE session is reestablished, I need to dynamically set up the L2TP config part. I'm using an expect script to do this, it connects to the mpd5 network console and loads the config part, and does it like this:



set timeout 2
spawn telnet localhost 5005

expect -re "Username: "
send myc00ll0g1nr
exp_continue -continue_timer

expect -re "Password: "
send myc00lpa$$r
exp_continue -continue_timer


# destroying the knob
send "destroy link l2tplinkr"
expect ".+"
send "destroy bundle l2tpbundler"
expect ".+"

# loading the full knob:
send "create bundle template l2tpbundler"
expect ".+"
send "set iface idle 1800r"
expect ".+"
send "set iface enable tcpmssfixr"
expect ".+"
send "set iface group vpnr"
expect ".+"
expect ".+"
send "set ipcp yes vjcompr"
expect ".+"
send "set ipcp ranges 192.168.58.1/32 ippool vpn-poolr"
expect ".+"
send "set ipcp dns 192.168.57.254r"
expect ".+"
send "set bundle enable compressionr"
expect ".+"
send "create link template l2tplink l2tpr"
expect ".+"
send "set link action bundle l2tpbundler"
expect ".+"
send "set link enable multilinkr"
expect ".+"
send "set link yes acfcomp protocompr"
expect ".+"
send "set link no pap chap eap chap-md5 chap-msv1 chap-msv2r"
expect ".+"
send "set link enable chapr"
expect ".+"
send "set link enable papr"
expect ".+"
send "set link enable chap-md5r"
expect ".+"
send "set link enable chap-msv1r"
expect ".+"
send "set link enable chap-msv2r"
expect ".+"
send "set link enable eapr"
expect ".+"
send "set eap no md5 radius-proxyr"
expect ".+"
send "set eap enable eapr"
expect ".+"
send "set eap enable radius-proxyr"
expect ".+"
send "set link keep-alive 10 60r"
expect ".+"
send "set link mtu 1360r"
expect ".+"
send "set link enable incomingr"
expect ".+"
send "set l2tp self 384.656.768.272r"
expect ".+"
send "set link max-children 50r"
expect ".+"
send "set radius server 127.0.0.1 myc00lradiuspa$$r"
expect ".+"
send "set radius retries 3r"
expect ".+"
send "set radius timeout 3r"
expect ".+"
send "set radius me 127.0.0.1r"
expect ".+"
send "set auth acct-update 300r"
expect ".+"
send "set auth enable radius-authr"
expect ".+"


It's fully working when I invoke it interactively via ssh. So I added it into the set iface up-script <expect wrapper> and the expect wrapper is calling it like expect -f myscript.exp. But when it does that on PPPoE connection reestablishing, I receive the following bunch of errors in the mpd.log:



Mar 21 17:42:23 ronin mpd[37412]: [wan] IFACE: Up event
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Connect
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Allocated new console session 0x802000010 from 127.0.0.1
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Failed login attempt from 127.0.0.1
Mar 21 17:42:23 ronin syslogd: last message repeated 34 times
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Error while reading: Connection reset by peer


And this is definitely my expect script (because it does send right about 34 lines of commands). Why ? Why does it work when I invoke it by hand and when mpd5 invokes it - it does not ? Okay, I understand that when I invoke it it has a controlling terminal, and when mpd5 invokes it it does not, but does it matter ? How do I solve this ? Or is the root of the problem something else ?










share|improve this question
















I have a FreeBSD server that's connected to WAN using PPPoE. Iva esuccessfully set ip the L2TP and PPTP VPN ontop of this PPPoE WAN connection. The problem is that L2TP needs to call 'set lt2p self ` clause to start listening to the udp/1701 port, so when the WAN PPPoE session is reestablished, I need to dynamically set up the L2TP config part. I'm using an expect script to do this, it connects to the mpd5 network console and loads the config part, and does it like this:



set timeout 2
spawn telnet localhost 5005

expect -re "Username: "
send myc00ll0g1nr
exp_continue -continue_timer

expect -re "Password: "
send myc00lpa$$r
exp_continue -continue_timer


# destroying the knob
send "destroy link l2tplinkr"
expect ".+"
send "destroy bundle l2tpbundler"
expect ".+"

# loading the full knob:
send "create bundle template l2tpbundler"
expect ".+"
send "set iface idle 1800r"
expect ".+"
send "set iface enable tcpmssfixr"
expect ".+"
send "set iface group vpnr"
expect ".+"
expect ".+"
send "set ipcp yes vjcompr"
expect ".+"
send "set ipcp ranges 192.168.58.1/32 ippool vpn-poolr"
expect ".+"
send "set ipcp dns 192.168.57.254r"
expect ".+"
send "set bundle enable compressionr"
expect ".+"
send "create link template l2tplink l2tpr"
expect ".+"
send "set link action bundle l2tpbundler"
expect ".+"
send "set link enable multilinkr"
expect ".+"
send "set link yes acfcomp protocompr"
expect ".+"
send "set link no pap chap eap chap-md5 chap-msv1 chap-msv2r"
expect ".+"
send "set link enable chapr"
expect ".+"
send "set link enable papr"
expect ".+"
send "set link enable chap-md5r"
expect ".+"
send "set link enable chap-msv1r"
expect ".+"
send "set link enable chap-msv2r"
expect ".+"
send "set link enable eapr"
expect ".+"
send "set eap no md5 radius-proxyr"
expect ".+"
send "set eap enable eapr"
expect ".+"
send "set eap enable radius-proxyr"
expect ".+"
send "set link keep-alive 10 60r"
expect ".+"
send "set link mtu 1360r"
expect ".+"
send "set link enable incomingr"
expect ".+"
send "set l2tp self 384.656.768.272r"
expect ".+"
send "set link max-children 50r"
expect ".+"
send "set radius server 127.0.0.1 myc00lradiuspa$$r"
expect ".+"
send "set radius retries 3r"
expect ".+"
send "set radius timeout 3r"
expect ".+"
send "set radius me 127.0.0.1r"
expect ".+"
send "set auth acct-update 300r"
expect ".+"
send "set auth enable radius-authr"
expect ".+"


It's fully working when I invoke it interactively via ssh. So I added it into the set iface up-script <expect wrapper> and the expect wrapper is calling it like expect -f myscript.exp. But when it does that on PPPoE connection reestablishing, I receive the following bunch of errors in the mpd.log:



Mar 21 17:42:23 ronin mpd[37412]: [wan] IFACE: Up event
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Connect
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Allocated new console session 0x802000010 from 127.0.0.1
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Failed login attempt from 127.0.0.1
Mar 21 17:42:23 ronin syslogd: last message repeated 34 times
Mar 21 17:42:23 ronin mpd[37412]: CONSOLE: Error while reading: Connection reset by peer


And this is definitely my expect script (because it does send right about 34 lines of commands). Why ? Why does it work when I invoke it by hand and when mpd5 invokes it - it does not ? Okay, I understand that when I invoke it it has a controlling terminal, and when mpd5 invokes it it does not, but does it matter ? How do I solve this ? Or is the root of the problem something else ?







freebsd expect mpd5






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday







drookie

















asked Mar 22 at 8:45









drookiedrookie

6,12711219




6,12711219












  • what about raising the timeout or add a sleep? maybe mpd5 needs some time? please add an debug output to your script like: ``` log_file /tmp/mylog.txt ```

    – Bastian Bittorf
    yesterday

















  • what about raising the timeout or add a sleep? maybe mpd5 needs some time? please add an debug output to your script like: ``` log_file /tmp/mylog.txt ```

    – Bastian Bittorf
    yesterday
















what about raising the timeout or add a sleep? maybe mpd5 needs some time? please add an debug output to your script like: ``` log_file /tmp/mylog.txt ```

– Bastian Bittorf
yesterday





what about raising the timeout or add a sleep? maybe mpd5 needs some time? please add an debug output to your script like: ``` log_file /tmp/mylog.txt ```

– Bastian Bittorf
yesterday










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f959467%2fexpect-mpd5-and-dynamic-config-loading%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Server Fault!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f959467%2fexpect-mpd5-and-dynamic-config-loading%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

RemoteApp sporadic failureWindows 2008 RemoteAPP client disconnects within a matter of minutesWhat is the minimum version of RDP supported by Server 2012 RDS?How to configure a Remoteapp server to increase stabilityMicrosoft RemoteApp Active SessionRDWeb TS connection broken for some users post RemoteApp certificate changeRemote Desktop Licensing, RemoteAPPRDS 2012 R2 some users are not able to logon after changed date and time on Connection BrokersWhat happens during Remote Desktop logon, and is there any logging?After installing RDS on WinServer 2016 I still can only connect with two users?RD Connection via RDGW to Session host is not connecting

How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos