'casename':
        'MX-11311',
        'receivers': [
            'u1+++ <test\'*****@*****.**>',
            'u3+++ <test\'*****@*****.**>'
        ],
        'commands':
        'su - imail -c "cat log/mta.log;> log/mta.log"',
        'check_flags':
        'UserDataException'
    },
}
#set  subAddressAllowedIPs=10.49.58.240
print("---->Set subAddressAllowedIPs=10.49.58.240 ...", end='')
remote_operation(
    'su - imail -c \'imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=10.49.58.149\n8.8.8.8\";imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=10.49.58.149\n8.8.8.8\"\'',
    '10.49.58.147', 'root', 'letmein', 0)

#set relaySourcePolicy
print("---->Set  relaySourcePolicy=allowALL ...", end='')
remote_operation(
    'su - imail -c \'imconfcontrol -install -key \"/*/mta/relaySourcePolicy=allowAll";imconfcontrol -install -key \"/inbound-standardmta-direct/mta/relaySourcePolicy=allowAll\"\'',
    '10.49.58.147', 'root', 'letmein', 0)

#set smtprelaytabl
#print ("---->Set  smtprelay...",end='')
#remote_operation('su - imail -c \'imconfcontrol -install -key \"/*/mta/mailRoutingTable=bigchina.com:10.49.58.147#25";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/mailRoutingTable=bigchina.com:10.49.58.147#25\"\'','10.49.58.147','root','letmein',0)

# restart mta server
print("---->Restarting mta server ...", end='')
remote_operation('su - imail -c "~/lib/imservctrl killStart mta"',
't27':{'casename':'MX-11338','receivers':['u1 <*****@*****.**>','u3 <test----u3>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'},
't28':{'casename':'MX-11339','receivers':['u1 <*****@*****.**>','u3 <Trash----u3>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'},
't29':{'casename':'MX-11340','receivers':['u1 <[email protected]>','u3 <!test--u3>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'},
't30':{'casename':'MX-11341','receivers':['u1 <test\'*****@*****.**>','u3 <test\'---u3>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'},
't31':{'casename':'MX-11342','receivers':[r'u1 <"te [email protected]">',r'u3 <"te st---u3">'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'},
't32':{'casename':'MX-11343','receivers':[r'u1 <"te\"*****@*****.**">',r'u3 <"te\"st---u3">'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'},
't33':{'casename':'MX-11344','receivers':['u1 <*****@*****.**>','u3 <u3--+test>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'AcctUnknownUser'},
't34':{'casename':'MX-11345','receivers':['u1 <*****@*****.**>','u3 <u3--+Trash>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'AcctUnknownUser'},
't35':{'casename':'MX-11346','receivers':['u1 <[email protected]>','u3 <test--!u3>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'AcctUnknownUser'},
't36':{'casename':'MX-11347','receivers':['u1 <[email protected]>','u3 <Trash--!u3>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'AcctUnknownUser'},
't37':{'casename':'MX-11348','receivers':['u1--- <u1++test\'@openwave.com>','u3--- <u3++test\'>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'},
't38':{'casename':'MX-11349','receivers':['u1+++ <test\'*****@*****.**>','u3+++ <test\'---u3>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'},
	          }
#set  subAddressAllowedIPs=10.49.58.240
print ("---->Set subAddressAllowedIPs=10.49.58.240 ...",end='')
remote_operation('su - imail -c "imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=10.49.58.240\";imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=10.49.58.240\""','10.49.58.239','root','letmein',0)

# restart mta server
print ("---->Restarting mta server ...",end='')
remote_operation('su - imail -c "~/lib/imservctrl killStart mta"', '10.49.58.239','root','letmein',1,'imservctrl: done',1)

print ('---->Delete u1,u2,u3 if already existed...',end='') #delete u1,u2,u3 if exists
remote_operation('su - imail -c \
  "account-delete [email protected];account-delete [email protected];account-delete [email protected]"',\
  '10.49.58.239','root','letmein',1,'Mailbox Deleted Successfully',3)
    
print ('---->Create u1,u2,u3 ...                  ',end='') #creaet account u1,u2,u3
remote_operation('su - imail -c \
  "account-create [email protected] p default;account-create [email protected] p default;account-create [email protected] p default"',\
  '10.49.58.239','root','letmein',1,'MailboxId',3)
Exemple #3
0
#!/usr/bin/env python3

from modules.remote_operations import remote_operation

remote_operation(
    'su - imail -c "imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=127.0.0.1\";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=127.0.0.1\""',
    '10.49.58.239', 'root', 'letmein', 0)
remote_operation('su - imail -c "~/lib/imservctrl killStart mta"',
                 '10.49.58.239', 'root', 'letmein', 1, 'imservctrl: done', 1)
Exemple #4
0
        'casename':
        'MX-11387',
        'receivers': [
            'u1+++ <test\'*****@*****.**>',
            'u3+++ <test\'*****@*****.**>'
        ],
        'commands':
        'su - imail -c "cat log/mta.log;> log/mta.log"',
        'check_flags':
        'UserDataException'
    },
}
#set  subAddressAllowedIPs=10.49.58.240/30
print("---->Set subAddressAllowedIPs=10.49.58.240/30 ...", end='')
remote_operation(
    'su - imail -c \'imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=10.49.58.240/30\n8.8.8.8\";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=10.49.58.240/30\n8.8.8.8\"\'',
    '10.49.58.239', 'root', 'letmein', 0)

#set relaySourcePolicy
print("---->Set  relaySourcePolicy=allowALL ...", end='')
remote_operation(
    'su - imail -c \'imconfcontrol -install -key \"/*/mta/relaySourcePolicy=allowAll";imconfcontrol -install -key \"/inbound-standardmta-direct/mta/relaySourcePolicy=allowAll\"\'',
    '10.49.58.239', 'root', 'letmein', 0)

#set smtprelaytabl
#print ("---->Set  smtprelay...",end='')
#remote_operation('su - imail -c \'imconfcontrol -install -key \"/*/mta/mailRoutingTable=bigchina.com:10.49.58.239#20025";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/mailRoutingTable=bigchina.com:10.49.58.239#20025\"\'','10.49.58.239','root','letmein',0)

# restart mta server
print("---->Restarting mta server ...", end='')
remote_operation('su - imail -c "~/lib/imservctrl killStart mta"',
        'MX-11425',
        'receivers': [
            'u1+++ <test\'*****@*****.**>',
            'u3+++ <test\'*****@*****.**>'
        ],
        'commands':
        'su - imail -c "cat log/mta.log;> log/mta.log"',
        'check_flags':
        'UserDataException'
    },
}
#set  subAddressAllowedIPs=10.49.58.240/30
print("---->Set subAddressAllowedIPs=10.49.58.240/30 on source mta ...",
      end='')
remote_operation(
    'su - imail -c \'imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=10.49.58.121\n8.8.8.8\";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=10.49.58.121\n8.8.8.8\"\'',
    '10.49.58.239', 'root', 'letmein', 0)

print("---->Set subAddressAllowedIPs=10.49.58.240/30 on dest mta  ...", end='')
remote_operation(
    'su - imail -c \'imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=10.49.58.240/30\n8.8.8.8\";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=10.49.58.240/30\n8.8.8.8\"\'',
    '10.49.58.121', 'root', 'letmein', 0)

#set relaySourcePolicy
print("---->Set  relaySourcePolicy=allowALL ...", end='')
remote_operation(
    'su - imail -c \'imconfcontrol -install -key \"/*/mta/relaySourcePolicy=allowAll";imconfcontrol -install -key \"/inbound-standardmta-direct/mta/relaySourcePolicy=allowAll\"\'',
    '10.49.58.239', 'root', 'letmein', 0)

#set smtprelaytabl
print("---->Set  smtprelay...", end='')
mtahost = '10.49.58.239'
imaphost = '10.49.58.239'
mtaport = 20025
imapport = 20143
sshtarget = '10.49.58.239'
sshaccount = 'root'
sshpasswd = 'letmein'
sender = 'x2 <*****@*****.**>'
mailboxname = 'INBOX'
loginuser = '******'
loginpass = '******'

print('---->Delete x1,x2,xx3 if already existed...',
      end='')  #delete x1,x2,xx3 if exists
remote_operation('su - imail -c \
  "account-delete [email protected];account-delete [email protected];account-delete [email protected]"'                                                                                                  ,\
  '10.49.58.239','root','letmein',1,'Mailbox Deleted Successfully',3)

print('---->Create x1,x2,xx3 ...                  ',
      end='')  #creaet account x1,x2,xx3
remote_operation('su - imail -c \
  "account-create [email protected] p default;account-create [email protected] p default;account-create [email protected] p default"'                                                                                                                                ,\
  '10.49.58.239','root','letmein',1,'MailboxId',3)

#set  account quota
print("---->Set  mailquotamaxmsgkb(mailquotatotkb) 0  ...", end='')
remote_operation(
    'su - imail -c "imdbcontrol sac x1 openwave.com mailquotamaxmsgkb 0;imdbcontrol sac x1 openwave.com mailquotatotkb 0"',
    '10.49.58.239', 'root', 'letmein', 0)

#deliver 100 messages:
Exemple #7
0
#print ("---->Restarting mta server ...",end='')
#remote_operation('su - imail -c "~/lib/imservctrl killStart mta"', '10.49.58.239','root','letmein',1,'imservctrl: done',1)
#
#print ('---->Delete u1,u2,u3 if already existed...',end='') #delete u1,u2,u3 if exists
#remote_operation('su - imail -c \
#  "account-delete [email protected];account-delete [email protected];account-delete [email protected]"',\
#  '10.49.58.239','root','letmein',1,'Mailbox Deleted Successfully',3)
#
#print ('---->Create u1,u2,u3 ...                  ',end='') #creaet account u1,u2,u3
#remote_operation('su - imail -c \
#  "account-create [email protected] p default;account-create [email protected] p default;account-create [email protected] p default"',\
#  '10.49.58.239','root','letmein',1,'MailboxId',3)

print('---->run imrecalcmboxstats ...           ', end='')
remote_operation(
    "su - imail -c \"msgid=\$(imboxstats [email protected]|grep Statistics|awk '{print \$5}');echo \$msgid >xx.txt;imrecalcmboxstats mx1 repair \$msgid ''\"",
    '10.49.58.239', 'root', 'letmein', 0)

# |grep Statistics|awk \'{print \$5}\'
# msgid=$(imboxstats [email protected]|grep Statistics|awk \'{print $5}\';echo $msgid)
#;imrecalcmboxstats mx1 repair $msgid \"\"

#print ('---->Clear mta.log firsltly ...           ',end='') #clear mta.log firstly
#remote_operation('su - imail -c "> log/mta.log"','10.49.58.239','root','letmein',0)
#
##set quote for sender and recepients
##ssdsdsd
#
#print ('###############Beginning testing...######################')
#for tck ,tcv in sorted(testcases.items(),key=lambda testcases:testcases[0]):
#    print ('\033[1;45mRunning testing testcase: '+tck+'---------->'+tcv['casename']+'\033[0m')
Exemple #8
0
        'receivers': ['u1 <*****@*****.**>', 'u3 <*****@*****.**>'],
        'commands': 'su - imail -c "cat log/mta.log;> log/mta.log"',
        'check_flags': 'delivered to c'
    },
    't3': {
        'casename': '1214',
        'receivers': ['u1 <*****@*****.**>', 'u3 <*****@*****.**>'],
        'commands': 'su - imail -c "cat log/mta.log;> log/mta.log"',
        'check_flags': 'delivered:'
    },
}

print('Delete u1,u2,u3 if already existed...',
      end='')  #delete u1,u2,u3 if exists
remote_operation('su - imail -c \
  "account-delete [email protected];account-delete [email protected];account-delete [email protected]"'                                                                                                 ,\
  '10.49.58.239','root','letmein',1,'Mailbox Deleted Successfully',3)

print('Create u1,u2,u3 ...                  ',
      end='')  #creaet account u1,u2,u3
remote_operation('su - imail -c \
  "account-create [email protected] p default;account-create [email protected] p default;account-create [email protected] p default"'                                                                                                                               ,\
  '10.49.58.239','root','letmein',1,'MailboxId',3)

print('Clear mta.log firsltly ...           ', end='')  #clear mta.log firstly
remote_operation('su - imail -c "> log/mta.log"', '10.49.58.239', 'root',
                 'letmein', 0)

#set quote for sender and recepients
#ssdsdsd
Exemple #9
0
#!/usr/bin/python3
from modules.sendmails import send_mail
from modules.remote_operations import remote_operation
mtahost = '10.49.58.239'
mtaport = 20025
sshtarget = '10.49.58.239'
sshaccount = 'root'
sshpasswd = 'letmein'
sender = 'u2 <*****@*****.**>'

remote_operation(
    'su - imail -c "imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=127.0.0.1\";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=127.0.0.1\""',
    '10.49.58.239', 'root', 'letmein', 0)