# restart mss to froce to use new encryption key remote_operations.remote_operation(mx1_mss_host1_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) time.sleep(30) basic_class.mylogger_record.info('step5:MTA send another messege to inbox again') #myimap = imap_operations.IMAP_Ops(mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port) #myimap.imap_login('testuser1','testuser1') #myimap.imap_select() #myimap.imap_append() #myimap.imap_logout() smtp_operations.fast_send_mail(mx1_mta_host1_ip,mx1_mta_host1_SMTPPort,'testuser2',['testuser1+customerfolder@{}'.format(mx1_default_domain)]) time.sleep(3) #basic_class.mylogger_record.debug('step6:fetching the latest message uuid') #uuid2 = mxos_operations_MessageBodyEncryption.fetch_latest_message_uuid(mx1_mxos_host1_ip,mx1_mxos_host1_eureka_port,'*****@*****.**','customerfolder') # #basic_class.mylogger_record.debug('step7:fetch message body from cassandrablob directly') # #encrypted_flag,messagebody1 = cassandra_operations.cassandra_cqlsh_fetch_messagebody(mx1_cassblob_ip,mx1_search_cassandraBlobPort,uuid2,AES_mode1) # #body_check_flag1 = messagebody1.count('attachement,haha,are you OK? we love world') #basic_class.mylogger_record.debug('body_check_flag1= '+str(body_check_flag1)) # #if encrypted_flag == 1 and body_check_flag1 >=1: # result_lists.append('fetch messagebody from cassandra success') #else:
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ##steps: # (1) set keys: # /*/common/messageBodyEncryptionEnabled:[false] # /*/mss/compressionEnabled: [false] # need mss retart # /*/mxos/ldapEncryptionDn: [cn=encryption,cn=config] # /*/mxos/ldapReadEncryptionFilter: [(&(objectclass=messageBodyEncryption)(cn=encryption))] # /*/mxos/loadRulesOrder:[encryption] # (2) create passphrase import smtp_operations import global_variables #basic_class.mylogger_record.debug('Preparing... get some variables needed for tests') mx1_mta1_port,mx1_mta1_host_ip,mx1_mxos2_port,mx1_mxos2_host_ip,mx1_mss2_host_ip,mx1_mss1_host_ip,mx1_pop1_host,mx1_pop1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx1_mta1_port','mx1_mta1_host_ip','mx1_mxos2_port','mx1_mxos2_host_ip','mx1_mss2_host_ip','mx1_mss1_host_ip','mx1_pop1_host','mx1_pop1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') smtp_operations.fast_send_mail(mx1_mta1_host_ip, mx1_mta1_port, 'xx2', ['xx1'])
remote_operations.remote_operation(mx1_mss_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mss mxos\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mxos_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account),root_account,root_passwd,0) basic_class.mylogger_record.info('Sleeping 50 seconds ...') time.sleep(50) basic_class.mylogger_record.info('set passphrase') cuid,cpassphrase = mxos_operations_MessageBodyEncryption.fetch_current_uid_passphrase(mx1_mxos_host1_ip,mx1_mxos_host1_eureka_port) basic_class.mylogger_record.info('cuid,cpassphrase: '+str(cuid)+','+cpassphrase) if int(cuid) == -1: exit (1) else: pass basic_class.mylogger_record.info('new passphrase uid is: '+str(cuid)) mxos_operations_MessageBodyEncryption.create_passphrase(mx1_mxos_host1_ip,mx1_mxos_host1_eureka_port,str(cuid),AES_mode5,ASE_key192) # restart mss to froce to use new encryption key remote_operations.remote_operation(mx1_mss_host1_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) time.sleep(60) basic_class.mylogger_record.info('step2:create 2 accounts') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=2;i++));do account-create {1}$i@{2} {1}$i default;done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,1,'Mailbox Created Successfully',2) remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=2;i++));do immsgdelete {1}$i@{2} -all;done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,0) basic_class.mylogger_record.info('step3:deliever 1 message from testuser2 to testuser1') smtp_operations.fast_send_mail(mx1_mta_host1_ip,mx1_mta_host1_SMTPPort,'testuser2',[test_account_base+'1']) time.sleep(3)
basic_class.mylogger_record.info('new passphrase uid is: '+str(cuid)) mxos_operations_MessageBodyEncryption.create_passphrase(mx1_mxos_host1_ip,mx1_mxos_host1_eureka_port,str(cuid),AES_mode1,ASE_key128) # restart mss to froce to use new encryption key remote_operations.remote_operation(mx1_mss_host1_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) time.sleep(30) basic_class.mylogger_record.info('step2:create 2 accounts') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=2;i++));do account-create {1}$i@{2} {1}$i default;done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,1,'Mailbox Created Successfully',2) remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=2;i++));do immsgdelete {1}$i@{2} -all;done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,0) myimap = imap_operations.IMAP_Ops(mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port) myimap.imap_login('testuser1','testuser1') myimap.imap_create('customerfolder') myimap.imap_select() myimap.imap_logout() basic_class.mylogger_record.info('step3:mta 1 message to testuser1 to customerfolder for i in range(1,201): smtp_operations.fast_send_mail(mx1_mta_host1_ip,mx1_mta_host1_SMTPPort,'testuser2',['*****@*****.**']) #myimap = imap_operations.IMAP_Ops(mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port) #myimap.imap_login('testuser1','testuser1') #myimap.imap_select() #for i in range(1,201): # myimap.imap_append() #myimap.imap_logout()